Skip to content

Commit b5ebeee

Browse files
Restoring lost review fixes for pull request #102 (instantiation of Arguments object).
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
1 parent 5c012a1 commit b5ebeee

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,6 +2383,14 @@ dump_variable_declaration (literal_index_t lit_id)
23832383
serializer_dump_op_meta (create_op_meta_100 (opcode, lit_id));
23842384
}
23852385

2386+
/**
2387+
* Dump template of 'meta' instruction for scope's code flags.
2388+
*
2389+
* Note:
2390+
* the instruction's flags field is written later (see also: rewrite_scope_code_flags).
2391+
*
2392+
* @return position of dumped instruction
2393+
*/
23862394
opcode_counter_t
23872395
dump_scope_code_flags_for_rewrite (void)
23882396
{
@@ -2392,19 +2400,27 @@ dump_scope_code_flags_for_rewrite (void)
23922400
serializer_dump_op_meta (create_op_meta_000 (opcode));
23932401

23942402
return oc;
2395-
}
2403+
} /* dump_scope_code_flags_for_rewrite */
23962404

2405+
/**
2406+
* Write scope's code flags to specified 'meta' instruction template,
2407+
* dumped earlier (see also: dump_scope_code_flags_for_rewrite).
2408+
*/
23972409
void
2398-
rewrite_scope_code_flags (opcode_counter_t scope_code_flags_oc,
2399-
opcode_scope_code_flags_t scope_flags)
2410+
rewrite_scope_code_flags (opcode_counter_t scope_code_flags_oc, /**< position of instruction to rewrite */
2411+
opcode_scope_code_flags_t scope_flags) /**< scope's code properties flags set */
24002412
{
24012413
JERRY_ASSERT ((idx_t) scope_flags == scope_flags);
24022414

24032415
op_meta opm = serializer_get_op_meta (scope_code_flags_oc);
24042416
JERRY_ASSERT (opm.op.op_idx == OPCODE (meta));
2417+
JERRY_ASSERT (opm.op.data.meta.type == OPCODE_META_TYPE_SCOPE_CODE_FLAGS);
2418+
JERRY_ASSERT (opm.op.data.meta.data_1 == INVALID_VALUE);
2419+
JERRY_ASSERT (opm.op.data.meta.data_2 == INVALID_VALUE);
2420+
24052421
opm.op.data.meta.data_1 = (idx_t) scope_flags;
24062422
serializer_rewrite_op_meta (scope_code_flags_oc, opm);
2407-
}
2423+
} /* rewrite_scope_code_flags */
24082424

24092425
void
24102426
dump_ret (void)

tests/jerry/arguments.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
function f_arg (arguments)
16+
{
17+
return arguments;
18+
}
19+
assert (f_arg (1) === 1);
20+
1521
function f (a, b, c)
1622
{
1723
return arguments;

0 commit comments

Comments
 (0)