Introducing 'scope flags' opcode containing set of flags that indicate various properties of a scope; replacing 'strict mode' meta opcode with a flag in the flags set.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
Ruben Ayrapetyan
2015-05-26 16:54:18 +03:00
parent e984bc30ea
commit cb600da269
10 changed files with 81 additions and 25 deletions
+7 -1
View File
@@ -2648,10 +2648,14 @@ preparse_scope (bool is_global)
const locus start_loc = tok.loc;
const token_type end_tt = is_global ? TOK_EOF : TOK_CLOSE_BRACE;
opcode_counter_t scope_code_flags_oc = dump_scope_code_flags_for_rewrite ();
opcode_scope_code_flags_t scope_flags = OPCODE_SCOPE_CODE_FLAGS__NO_FLAGS;
if (token_is (TOK_STRING) && literal_equal_s (lexer_get_literal_by_id (token_data ()), "use strict"))
{
scopes_tree_set_strict_mode (STACK_TOP (scopes), true);
dump_strict_mode_header ();
scope_flags = (opcode_scope_code_flags_t) (scope_flags | OPCODE_SCOPE_CODE_FLAGS_STRICT);
}
lexer_set_strict_mode (scopes_tree_strict_mode (STACK_TOP (scopes)));
@@ -2688,6 +2692,8 @@ preparse_scope (bool is_global)
skip_newlines ();
}
rewrite_scope_code_flags (scope_code_flags_oc, scope_flags);
if (start_loc != tok.loc)
{
lexer_seek (start_loc);