Skip to content

Commit 4e7af61

Browse files
Merge pull request jerryscript-project#25 from ruben-ayrapetyan/experiments-dev
Experiments dev
2 parents b88bb13 + decc852 commit 4e7af61

File tree

3 files changed

+431
-268
lines changed

3 files changed

+431
-268
lines changed

jerry-core/parser/js/opcodes-dumper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ jsp_dmp_gen_instr (vm_op_t opcode, /**< operation code */
402402
{
403403
instr.data.raw_args[i] = ops[i].get_idx_const ();
404404
}
405-
else if (ops[i].is_register_operand ())
405+
else if (ops[i].is_register_operand () || ops[i].is_this_operand ())
406406
{
407407
instr.data.raw_args[i] = ops[i].get_idx ();
408408
}
@@ -999,7 +999,7 @@ dump_call_additional_info (opcode_call_flags_t flags, /**< call flags */
999999
{
10001000
if (flags & OPCODE_CALL_FLAGS_HAVE_THIS_ARG)
10011001
{
1002-
JERRY_ASSERT (this_arg.is_register_operand ());
1002+
JERRY_ASSERT (this_arg.is_register_operand () || this_arg.is_this_operand ());
10031003
JERRY_ASSERT (!operand_is_empty (this_arg));
10041004
}
10051005
else

jerry-core/parser/js/opcodes-dumper.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class jsp_operand_t
3232
EMPTY, /**< empty operand */
3333
LITERAL, /**< operand contains literal value */
3434
IDENTIFIER, /**< Identifier reference */
35+
THIS_BINDING, /**< ThisBinding operand */
3536
TMP, /**< operand contains byte-code register index */
3637
IDX_CONST, /**< operand contains an integer constant that fits vm_idx_t */
3738
UNKNOWN, /**< operand, representing unknown value that would be rewritten later */
@@ -67,6 +68,21 @@ class jsp_operand_t
6768
return ret;
6869
} /* make_empty_operand */
6970

71+
/**
72+
* Construct ThisBinding operand
73+
*
74+
* @return constructed operand
75+
*/
76+
static jsp_operand_t
77+
make_this_operand (void)
78+
{
79+
jsp_operand_t ret;
80+
81+
ret._type = jsp_operand_t::THIS_BINDING;
82+
83+
return ret;
84+
} /* make_this_operand */
85+
7086
/**
7187
* Construct unknown operand
7288
*
@@ -175,6 +191,19 @@ class jsp_operand_t
175191
return (_type == jsp_operand_t::EMPTY);
176192
} /* is_empty_operand */
177193

194+
/**
195+
* Is it ThisBinding operand?
196+
*
197+
* @return true / false
198+
*/
199+
bool
200+
is_this_operand (void) const
201+
{
202+
JERRY_ASSERT (_type != jsp_operand_t::UNINITIALIZED);
203+
204+
return (_type == jsp_operand_t::THIS_BINDING);
205+
} /* is_this_operand */
206+
178207
/**
179208
* Is it unknown operand?
180209
*
@@ -270,6 +299,10 @@ class jsp_operand_t
270299
{
271300
return VM_IDX_REWRITE_LITERAL_UID;
272301
}
302+
else if (_type == jsp_operand_t::THIS_BINDING)
303+
{
304+
return VM_REG_SPECIAL_THIS_BINDING;
305+
}
273306
else
274307
{
275308
JERRY_ASSERT (_type == jsp_operand_t::EMPTY);

0 commit comments

Comments
 (0)