Support of multiple bytecode arrays in interpreter and ecma-runtime.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
@@ -320,7 +320,8 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
case ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE: /* compressed pointer to a ecma_number_t */
|
||||
case ECMA_INTERNAL_PROPERTY_PRIMITIVE_BOOLEAN_VALUE: /* a simple boolean value */
|
||||
case ECMA_INTERNAL_PROPERTY_CLASS: /* an enum */
|
||||
case ECMA_INTERNAL_PROPERTY_CODE: /* an integer */
|
||||
case ECMA_INTERNAL_PROPERTY_CODE_BYTECODE: /* compressed pointer to a bytecode array */
|
||||
case ECMA_INTERNAL_PROPERTY_CODE_FLAGS_AND_OFFSET: /* an integer */
|
||||
case ECMA_INTERNAL_PROPERTY_NATIVE_CODE: /* an external pointer */
|
||||
case ECMA_INTERNAL_PROPERTY_NATIVE_HANDLE: /* an external pointer */
|
||||
case ECMA_INTERNAL_PROPERTY_FREE_CALLBACK: /* an object's native free callback */
|
||||
|
||||
@@ -217,7 +217,9 @@ typedef enum
|
||||
ECMA_INTERNAL_PROPERTY_EXTENSIBLE, /**< [[Extensible]] */
|
||||
ECMA_INTERNAL_PROPERTY_SCOPE, /**< [[Scope]] */
|
||||
ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP, /**< [[ParametersMap]] */
|
||||
ECMA_INTERNAL_PROPERTY_CODE, /**< [[Code]] */
|
||||
ECMA_INTERNAL_PROPERTY_CODE_BYTECODE, /**< first part of [[Code]] - compressed pointer to bytecode array */
|
||||
ECMA_INTERNAL_PROPERTY_CODE_FLAGS_AND_OFFSET, /**< second part of [[Code]] - offset in bytecode array and code flags
|
||||
* (see also: ecma_pack_code_internal_property_value) */
|
||||
ECMA_INTERNAL_PROPERTY_NATIVE_CODE, /**< native handler location descriptor */
|
||||
ECMA_INTERNAL_PROPERTY_NATIVE_HANDLE, /**< native handle associated with an object */
|
||||
ECMA_INTERNAL_PROPERTY_FREE_CALLBACK, /**< object's native free callback */
|
||||
|
||||
@@ -793,7 +793,8 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */
|
||||
case ECMA_INTERNAL_PROPERTY_PROTOTYPE: /* the property's value is located in ecma_object_t */
|
||||
case ECMA_INTERNAL_PROPERTY_EXTENSIBLE: /* the property's value is located in ecma_object_t */
|
||||
case ECMA_INTERNAL_PROPERTY_CLASS: /* an enum */
|
||||
case ECMA_INTERNAL_PROPERTY_CODE: /* an integer */
|
||||
case ECMA_INTERNAL_PROPERTY_CODE_BYTECODE: /* compressed pointer to a bytecode array */
|
||||
case ECMA_INTERNAL_PROPERTY_CODE_FLAGS_AND_OFFSET: /* an integer */
|
||||
case ECMA_INTERNAL_PROPERTY_BUILT_IN_ID: /* an integer */
|
||||
case ECMA_INTERNAL_PROPERTY_BUILT_IN_ROUTINE_ID: /* an integer */
|
||||
case ECMA_INTERNAL_PROPERTY_EXTENSION_ID: /* an integer */
|
||||
|
||||
@@ -157,7 +157,8 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
bool is_strict, /**< 'strict' flag */
|
||||
bool do_instantiate_arguments_object, /**< should an Arguments object be instantiated
|
||||
* for the function object upon call */
|
||||
opcode_counter_t first_opcode_idx) /**< index of first opcode of function's body */
|
||||
const opcode_t *opcodes_p, /**< byte-code array */
|
||||
opcode_counter_t first_opcode_index) /**< index of first opcode of function's body */
|
||||
{
|
||||
// 1., 4., 13.
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
|
||||
@@ -199,10 +200,13 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
}
|
||||
|
||||
// 12.
|
||||
ecma_property_t *code_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CODE);
|
||||
ecma_property_t *opcodes_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CODE_BYTECODE);
|
||||
MEM_CP_SET_NON_NULL_POINTER (opcodes_prop_p->u.internal_property.value, opcodes_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,
|
||||
do_instantiate_arguments_object,
|
||||
first_opcode_idx);
|
||||
first_opcode_index);
|
||||
|
||||
// 14.
|
||||
ecma_number_t* len_p = ecma_alloc_number ();
|
||||
@@ -612,15 +616,18 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
{
|
||||
/* Entering Function Code (ECMA-262 v5, 10.4.3) */
|
||||
ecma_property_t *scope_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
ecma_property_t *code_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_CODE);
|
||||
ecma_property_t *opcodes_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_CODE_BYTECODE);
|
||||
ecma_property_t *code_prop_p = ecma_get_internal_property (func_obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_CODE_FLAGS_AND_OFFSET);
|
||||
|
||||
ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t,
|
||||
scope_prop_p->u.internal_property.value);
|
||||
uint32_t code_prop_value = code_prop_p->u.internal_property.value;
|
||||
|
||||
// 8.
|
||||
bool is_strict;
|
||||
bool do_instantiate_args_obj;
|
||||
// 8.
|
||||
const opcode_t *opcodes_p = MEM_CP_GET_POINTER (const opcode_t, opcodes_prop_p->u.internal_property.value);
|
||||
opcode_counter_t code_first_opcode_idx = ecma_unpack_code_internal_property_value (code_prop_value,
|
||||
&is_strict,
|
||||
&do_instantiate_args_obj);
|
||||
@@ -659,7 +666,8 @@ 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 (code_first_opcode_idx,
|
||||
ecma_completion_value_t completion = vm_run_from_pos (opcodes_p,
|
||||
code_first_opcode_idx,
|
||||
this_binding,
|
||||
local_env_p,
|
||||
is_strict,
|
||||
@@ -853,6 +861,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 opcode_t *opcodes_p, /**< byte-code array */
|
||||
opcode_counter_t function_code_opcode_idx, /**< index of first opcode of function code */
|
||||
ecma_string_t* formal_parameter_list_p[], /**< formal parameters list */
|
||||
ecma_length_t formal_parameter_list_length, /**< length of formal parameters list */
|
||||
@@ -869,6 +878,7 @@ ecma_op_function_declaration (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
lex_env_p,
|
||||
is_strict,
|
||||
do_instantiate_arguments_object,
|
||||
opcodes_p,
|
||||
function_code_opcode_idx);
|
||||
|
||||
// c.
|
||||
|
||||
@@ -35,6 +35,7 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[],
|
||||
ecma_object_t *scope_p,
|
||||
bool is_strict,
|
||||
bool do_instantiate_arguments_object,
|
||||
const opcode_t *opcodes_p,
|
||||
opcode_counter_t first_opcode_idx);
|
||||
extern ecma_object_t*
|
||||
ecma_op_create_external_function_object (ecma_external_pointer_t code_p);
|
||||
@@ -57,6 +58,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 opcode_t *opcodes_p,
|
||||
opcode_counter_t function_code_opcode_idx,
|
||||
ecma_string_t* formal_parameter_list_p[],
|
||||
ecma_length_t formal_parameter_list_length,
|
||||
|
||||
Reference in New Issue
Block a user