Skip to content

Restoring lost review fixes for pull request #102 #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions jerry-core/parser/js/opcodes-dumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,14 @@ dump_variable_declaration (literal_index_t lit_id)
serializer_dump_op_meta (create_op_meta_100 (opcode, lit_id));
}

/**
* Dump template of 'meta' instruction for scope's code flags.
*
* Note:
* the instruction's flags field is written later (see also: rewrite_scope_code_flags).
*
* @return position of dumped instruction
*/
opcode_counter_t
dump_scope_code_flags_for_rewrite (void)
{
Expand All @@ -2392,19 +2400,27 @@ dump_scope_code_flags_for_rewrite (void)
serializer_dump_op_meta (create_op_meta_000 (opcode));

return oc;
}
} /* dump_scope_code_flags_for_rewrite */

/**
* Write scope's code flags to specified 'meta' instruction template,
* dumped earlier (see also: dump_scope_code_flags_for_rewrite).
*/
void
rewrite_scope_code_flags (opcode_counter_t scope_code_flags_oc,
opcode_scope_code_flags_t scope_flags)
rewrite_scope_code_flags (opcode_counter_t scope_code_flags_oc, /**< position of instruction to rewrite */
opcode_scope_code_flags_t scope_flags) /**< scope's code properties flags set */
{
JERRY_ASSERT ((idx_t) scope_flags == scope_flags);

op_meta opm = serializer_get_op_meta (scope_code_flags_oc);
JERRY_ASSERT (opm.op.op_idx == OPCODE (meta));
JERRY_ASSERT (opm.op.data.meta.type == OPCODE_META_TYPE_SCOPE_CODE_FLAGS);
JERRY_ASSERT (opm.op.data.meta.data_1 == INVALID_VALUE);
JERRY_ASSERT (opm.op.data.meta.data_2 == INVALID_VALUE);

opm.op.data.meta.data_1 = (idx_t) scope_flags;
serializer_rewrite_op_meta (scope_code_flags_oc, opm);
}
} /* rewrite_scope_code_flags */

void
dump_ret (void)
Expand Down
6 changes: 6 additions & 0 deletions tests/jerry/arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

function f_arg (arguments)
{
return arguments;
}
assert (f_arg (1) === 1);

function f (a, b, c)
{
return arguments;
Expand Down