Update bytecode header structure so that bytecode could be stored independently from hash table and bytecode header.

JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
This commit is contained in:
Andrey Shitov
2015-09-03 18:11:27 +03:00
committed by Ruben Ayrapetyan
parent 6a6fb3fdfa
commit 443673fc5d
22 changed files with 207 additions and 194 deletions
@@ -271,13 +271,13 @@ ecma_builtin_function_dispatch_construct (const ecma_value_t *arguments_list_p,
utf8_string_buffer_pos += sz;
}
const vm_instr_t* instrs_p;
const bytecode_data_header_t* bytecode_data_p;
jsp_status_t parse_status;
parse_status = parser_parse_new_function ((const jerry_api_char_t **) utf8_string_params_p,
utf8_string_params_size,
params_count,
&instrs_p);
&bytecode_data_p);
if (parse_status == JSP_STATUS_SYNTAX_ERROR)
{
@@ -293,7 +293,7 @@ ecma_builtin_function_dispatch_construct (const ecma_value_t *arguments_list_p,
bool is_strict = false;
bool do_instantiate_arguments_object = true;
opcode_scope_code_flags_t scope_flags = vm_get_scope_flags (instrs_p,
opcode_scope_code_flags_t scope_flags = vm_get_scope_flags (bytecode_data_p->instrs_p,
0);
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_STRICT)
@@ -321,7 +321,7 @@ ecma_builtin_function_dispatch_construct (const ecma_value_t *arguments_list_p,
glob_lex_env_p,
is_strict,
do_instantiate_arguments_object,
instrs_p,
bytecode_data_p,
1);
ecma_deref_object (glob_lex_env_p);
+4 -4
View File
@@ -86,7 +86,7 @@ ecma_op_eval_chars_buffer (const jerry_api_char_t *code_p, /**< code characters
ecma_completion_value_t completion;
const vm_instr_t *instrs_p;
const bytecode_data_header_t *bytecode_data_p;
jsp_status_t parse_status;
bool is_strict_call = (is_direct && is_called_from_strict_mode_code);
@@ -95,7 +95,7 @@ ecma_op_eval_chars_buffer (const jerry_api_char_t *code_p, /**< code characters
parse_status = parser_parse_eval (code_p,
code_buffer_size,
is_strict_call,
&instrs_p,
&bytecode_data_p,
&code_contains_functions);
if (parse_status == JSP_STATUS_SYNTAX_ERROR)
@@ -110,11 +110,11 @@ ecma_op_eval_chars_buffer (const jerry_api_char_t *code_p, /**< code characters
{
JERRY_ASSERT (parse_status == JSP_STATUS_OK);
completion = vm_run_eval (instrs_p, is_direct);
completion = vm_run_eval (bytecode_data_p, is_direct);
if (!code_contains_functions)
{
serializer_remove_instructions (instrs_p);
serializer_remove_bytecode_data (bytecode_data_p);
}
}
@@ -216,7 +216,7 @@ ecma_op_create_function_object (ecma_collection_header_t *formal_params_collecti
bool is_strict, /**< 'strict' flag */
bool do_instantiate_arguments_object, /**< should an Arguments object be instantiated
* for the function object upon call */
const vm_instr_t *instrs_p, /**< byte-code array */
const bytecode_data_header_t *bytecode_data_p, /**< byte-code array */
vm_instr_counter_t first_instr_pos) /**< position of first instruction
* of function's body */
{
@@ -252,7 +252,7 @@ ecma_op_create_function_object (ecma_collection_header_t *formal_params_collecti
// 12.
ecma_property_t *bytecode_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CODE_BYTECODE);
MEM_CP_SET_NON_NULL_POINTER (bytecode_prop_p->u.internal_property.value, instrs_p);
MEM_CP_SET_NON_NULL_POINTER (bytecode_prop_p->u.internal_property.value, bytecode_data_p);
ecma_property_t *code_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CODE_FLAGS_AND_OFFSET);
code_prop_p->u.internal_property.value = ecma_pack_code_internal_property_value (is_strict,
@@ -824,7 +824,8 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
// 8.
bool is_strict;
bool do_instantiate_args_obj;
const vm_instr_t *instrs_p = MEM_CP_GET_POINTER (const vm_instr_t, bytecode_prop_p->u.internal_property.value);
const bytecode_data_header_t *bytecode_data_p;
bytecode_data_p = MEM_CP_GET_POINTER (const bytecode_data_header_t, bytecode_prop_p->u.internal_property.value);
vm_instr_counter_t code_first_instr_pos = ecma_unpack_code_internal_property_value (code_prop_value,
&is_strict,
&do_instantiate_args_obj);
@@ -862,7 +863,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
do_instantiate_args_obj),
ret_value);
ecma_completion_value_t completion = vm_run_from_pos (instrs_p,
ecma_completion_value_t completion = vm_run_from_pos (bytecode_data_p,
code_first_instr_pos,
this_binding,
local_env_p,
@@ -1105,7 +1106,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
ecma_completion_value_t
ecma_op_function_declaration (ecma_object_t *lex_env_p, /**< lexical environment */
ecma_string_t *function_name_p, /**< function name */
const vm_instr_t *instrs_p, /**< byte-code array */
const bytecode_data_header_t *bytecode_data_p, /**< byte-code data */
vm_instr_counter_t function_first_instr_pos, /**< position of first instruction
* of function code */
ecma_collection_header_t *formal_params_collection_p, /**< formal parameters collection
@@ -1126,7 +1127,7 @@ ecma_op_function_declaration (ecma_object_t *lex_env_p, /**< lexical environment
lex_env_p,
is_strict,
do_instantiate_arguments_object,
instrs_p,
bytecode_data_p,
function_first_instr_pos);
// c.
@@ -34,7 +34,7 @@ ecma_op_create_function_object (ecma_collection_header_t *formal_params_collecti
ecma_object_t *scope_p,
bool is_strict,
bool do_instantiate_arguments_object,
const vm_instr_t *instrs_p,
const bytecode_data_header_t *bytecode_data_p,
vm_instr_counter_t first_opcode_idx);
extern ecma_object_t*
ecma_op_create_external_function_object (ecma_external_pointer_t code_p);
@@ -66,7 +66,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p,
extern ecma_completion_value_t
ecma_op_function_declaration (ecma_object_t *lex_env_p,
ecma_string_t *function_name_p,
const vm_instr_t *instrs_p,
const bytecode_data_header_t *bytecode_data_p,
vm_instr_counter_t function_code_opcode_idx,
ecma_collection_header_t *formal_params_collection_p,
bool is_strict,