Split opcode and instruction entities and perform related renamings: opcode_t is now vm_instr_t, opcode position is instruction position, etc.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
committed by
Evgeny Gavrin
parent
1990762cf0
commit
502f4c4623
@@ -50,7 +50,7 @@ typedef enum
|
||||
static token tok;
|
||||
static bool inside_eval = false;
|
||||
static bool inside_function = false;
|
||||
static bool parser_show_opcodes = false;
|
||||
static bool parser_show_instrs = false;
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -1920,7 +1920,7 @@ jsp_parse_for_statement (jsp_label_t *outermost_stmt_label_p, /**< outermost (fi
|
||||
|
||||
// Setup ContinueTarget
|
||||
jsp_label_setup_continue_target (outermost_stmt_label_p,
|
||||
serializer_get_current_opcode_counter ());
|
||||
serializer_get_current_instr_counter ());
|
||||
|
||||
// Increment
|
||||
lexer_seek (increment_loc);
|
||||
@@ -2027,7 +2027,7 @@ jsp_parse_for_in_statement_iterator (operand *base_p, /**< out: base value of me
|
||||
* Note:
|
||||
* Layout of generate byte-code is the following:
|
||||
* tmp <- Collection (Expression)
|
||||
* for_in instruction (tmp, opcode counter of for-in end mark)
|
||||
* for_in instruction (tmp, instruction counter of for-in end mark)
|
||||
* {
|
||||
* Assignment of OPCODE_REG_SPECIAL_FOR_IN_PROPERTY_NAME to
|
||||
* Iterator (VariableDeclarationNoIn / LeftHandSideExpression)
|
||||
@@ -2081,7 +2081,7 @@ jsp_parse_for_in_statement (jsp_label_t *outermost_stmt_label_p, /**< outermost
|
||||
skip_token ();
|
||||
|
||||
// Dump for-in instruction
|
||||
opcode_counter_t for_in_oc = dump_for_in_for_rewrite (collection);
|
||||
vm_instr_counter_t for_in_oc = dump_for_in_for_rewrite (collection);
|
||||
|
||||
// Dump assignment VariableDeclarationNoIn / LeftHandSideExpression <- OPCODE_REG_SPECIAL_FOR_IN_PROPERTY_NAME
|
||||
lexer_seek (iterator_loc);
|
||||
@@ -2111,7 +2111,7 @@ jsp_parse_for_in_statement (jsp_label_t *outermost_stmt_label_p, /**< outermost
|
||||
|
||||
// Setup ContinueTarget
|
||||
jsp_label_setup_continue_target (outermost_stmt_label_p,
|
||||
serializer_get_current_opcode_counter ());
|
||||
serializer_get_current_instr_counter ());
|
||||
|
||||
// Write position of for-in end to for_in instruction
|
||||
rewrite_for_in (for_in_oc);
|
||||
@@ -2261,7 +2261,7 @@ parse_do_while_statement (jsp_label_t *outermost_stmt_label_p) /**< outermost (f
|
||||
parse_statement (NULL);
|
||||
|
||||
jsp_label_setup_continue_target (outermost_stmt_label_p,
|
||||
serializer_get_current_opcode_counter ());
|
||||
serializer_get_current_instr_counter ());
|
||||
|
||||
token_after_newlines_must_be_keyword (KW_WHILE);
|
||||
const operand cond = parse_expression_inside_parens ();
|
||||
@@ -2290,7 +2290,7 @@ parse_while_statement (jsp_label_t *outermost_stmt_label_p) /**< outermost (firs
|
||||
parse_statement (NULL);
|
||||
|
||||
jsp_label_setup_continue_target (outermost_stmt_label_p,
|
||||
serializer_get_current_opcode_counter ());
|
||||
serializer_get_current_instr_counter ());
|
||||
|
||||
rewrite_jump_to_end ();
|
||||
|
||||
@@ -2318,7 +2318,7 @@ parse_with_statement (void)
|
||||
|
||||
bool is_raised = jsp_label_raise_nested_jumpable_border ();
|
||||
|
||||
opcode_counter_t with_begin_oc = dump_with_for_rewrite (expr);
|
||||
vm_instr_counter_t with_begin_oc = dump_with_for_rewrite (expr);
|
||||
skip_newlines ();
|
||||
parse_statement (NULL);
|
||||
rewrite_with (with_begin_oc);
|
||||
@@ -2442,7 +2442,7 @@ parse_switch_statement (void)
|
||||
skip_token ();
|
||||
|
||||
jsp_label_rewrite_jumps_and_pop (&label,
|
||||
serializer_get_current_opcode_counter ());
|
||||
serializer_get_current_instr_counter ());
|
||||
|
||||
finish_dumping_case_clauses ();
|
||||
}
|
||||
@@ -2595,7 +2595,7 @@ parse_iterational_statement (jsp_label_t *outermost_named_stmt_label_p) /**< out
|
||||
}
|
||||
|
||||
jsp_label_rewrite_jumps_and_pop (&label,
|
||||
serializer_get_current_opcode_counter ());
|
||||
serializer_get_current_instr_counter ());
|
||||
} /* parse_iterational_statement */
|
||||
|
||||
/* statement
|
||||
@@ -2831,7 +2831,7 @@ parse_statement (jsp_label_t *outermost_stmt_label_p) /**< outermost (first) lab
|
||||
parse_statement (outermost_stmt_label_p != NULL ? outermost_stmt_label_p : &label);
|
||||
|
||||
jsp_label_rewrite_jumps_and_pop (&label,
|
||||
serializer_get_current_opcode_counter ());
|
||||
serializer_get_current_instr_counter ());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2921,7 +2921,7 @@ 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 ();
|
||||
vm_instr_counter_t scope_code_flags_oc = dump_scope_code_flags_for_rewrite ();
|
||||
|
||||
bool is_use_strict = false;
|
||||
bool is_ref_arguments_identifier = false;
|
||||
@@ -3169,10 +3169,10 @@ parser_parse_program (const jerry_api_char_t *source_p, /**< source code buffer
|
||||
bool in_eval, /**< flag indicating if we are parsing body of eval code */
|
||||
bool is_strict, /**< flag, indicating whether current code
|
||||
* inherited strict mode from code of an outer scope */
|
||||
const opcode_t **out_opcodes_p) /**< out: generated byte-code array
|
||||
* (in case there were no syntax errors) */
|
||||
const vm_instr_t **out_instrs_p) /**< out: generated byte-code array
|
||||
* (in case there were no syntax errors) */
|
||||
{
|
||||
JERRY_ASSERT (out_opcodes_p != NULL);
|
||||
JERRY_ASSERT (out_instrs_p != NULL);
|
||||
|
||||
inside_function = in_function;
|
||||
inside_eval = in_eval;
|
||||
@@ -3186,7 +3186,7 @@ parser_parse_program (const jerry_api_char_t *source_p, /**< source code buffer
|
||||
jsp_mm_init ();
|
||||
jsp_label_init ();
|
||||
|
||||
serializer_set_show_opcodes (parser_show_opcodes);
|
||||
serializer_set_show_instrs (parser_show_instrs);
|
||||
dumper_init ();
|
||||
jsp_early_error_init ();
|
||||
|
||||
@@ -3205,7 +3205,7 @@ parser_parse_program (const jerry_api_char_t *source_p, /**< source code buffer
|
||||
* Operations that could raise an early error can be performed only during execution of the block.
|
||||
*/
|
||||
|
||||
lexer_init (source_p, source_size, parser_show_opcodes);
|
||||
lexer_init (source_p, source_size, parser_show_instrs);
|
||||
lexer_set_strict_mode (scopes_tree_strict_mode (STACK_TOP (scopes)));
|
||||
|
||||
skip_newlines ();
|
||||
@@ -3233,7 +3233,7 @@ parser_parse_program (const jerry_api_char_t *source_p, /**< source code buffer
|
||||
|
||||
jsp_early_error_free ();
|
||||
|
||||
*out_opcodes_p = serializer_merge_scopes_into_bytecode ();
|
||||
*out_instrs_p = serializer_merge_scopes_into_bytecode ();
|
||||
|
||||
dumper_free ();
|
||||
|
||||
@@ -3252,7 +3252,7 @@ parser_parse_program (const jerry_api_char_t *source_p, /**< source code buffer
|
||||
JERRY_ASSERT (!is_parse_finished);
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
|
||||
*out_opcodes_p = NULL;
|
||||
*out_instrs_p = NULL;
|
||||
|
||||
jsp_label_remove_all_labels ();
|
||||
jsp_mm_free_all ();
|
||||
@@ -3286,10 +3286,10 @@ parser_parse_program (const jerry_api_char_t *source_p, /**< source code buffer
|
||||
jsp_status_t
|
||||
parser_parse_script (const jerry_api_char_t *source, /**< source script */
|
||||
size_t source_size, /**< source script size it bytes */
|
||||
const opcode_t **opcodes_p) /**< out: generated byte-code array
|
||||
* (in case there were no syntax errors) */
|
||||
const vm_instr_t **out_instrs_p) /**< out: generated byte-code array
|
||||
* (in case there were no syntax errors) */
|
||||
{
|
||||
return parser_parse_program (source, source_size, false, false, false, opcodes_p);
|
||||
return parser_parse_program (source, source_size, false, false, false, out_instrs_p);
|
||||
} /* parser_parse_script */
|
||||
|
||||
/**
|
||||
@@ -3303,10 +3303,10 @@ parser_parse_eval (const jerry_api_char_t *source, /**< string passed to eval()
|
||||
size_t source_size, /**< string size in bytes */
|
||||
bool is_strict, /**< flag, indicating whether eval is called
|
||||
* from strict code in direct mode */
|
||||
const opcode_t **opcodes_p) /**< out: generated byte-code array
|
||||
* (in case there were no syntax errors) */
|
||||
const vm_instr_t **out_instrs_p) /**< out: generated byte-code array
|
||||
* (in case there were no syntax errors) */
|
||||
{
|
||||
return parser_parse_program (source, source_size, false, true, is_strict, opcodes_p);
|
||||
return parser_parse_program (source, source_size, false, true, is_strict, out_instrs_p);
|
||||
} /* parser_parse_eval */
|
||||
|
||||
/**
|
||||
@@ -3324,8 +3324,8 @@ parser_parse_new_function (const jerry_api_char_t **params, /**< array of argume
|
||||
* body) call */
|
||||
const size_t *params_size, /**< sizes of arguments strings */
|
||||
size_t params_count, /**< total number of arguments passed to new Function (...) */
|
||||
const opcode_t **out_opcodes_p) /**< out: generated byte-code array
|
||||
* (in case there were no syntax errors) */
|
||||
const vm_instr_t **out_instrs_p) /**< out: generated byte-code array
|
||||
* (in case there were no syntax errors) */
|
||||
{
|
||||
// Process arguments
|
||||
JERRY_ASSERT (params_count > 0);
|
||||
@@ -3339,14 +3339,14 @@ parser_parse_new_function (const jerry_api_char_t **params, /**< array of argume
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
out_opcodes_p);
|
||||
out_instrs_p);
|
||||
} /* parser_parse_new_function */
|
||||
|
||||
/**
|
||||
* Tell parser to dump bytecode
|
||||
* Tell parser whether to dump bytecode
|
||||
*/
|
||||
void
|
||||
parser_set_show_opcodes (bool show_opcodes) /**< flag indicating if to dump bytecode */
|
||||
parser_set_show_instrs (bool show_instrs) /**< flag indicating whether to dump bytecode */
|
||||
{
|
||||
parser_show_opcodes = show_opcodes;
|
||||
} /* parser_set_show_opcodes */
|
||||
parser_show_instrs = show_instrs;
|
||||
} /* parser_set_show_instrs */
|
||||
|
||||
Reference in New Issue
Block a user