Remove the ENABLED/DISABLED macros (#4515)
The removal of these macros enabled cppcheck to reveal new errors. These errors are also fixed by the patch. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
@@ -56,10 +56,10 @@ do_number_arithmetic (number_arithmetic_op op, /**< number arithmetic operation
|
||||
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
if (JERRY_LIKELY (!ecma_is_value_bigint (left_value)))
|
||||
{
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
ecma_number_t right_number;
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (right_value, &right_number)))
|
||||
@@ -91,17 +91,17 @@ do_number_arithmetic (number_arithmetic_op op, /**< number arithmetic operation
|
||||
result = ecma_op_number_remainder (left_number, right_number);
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case NUMBER_ARITHMETIC_EXPONENTIATION:
|
||||
{
|
||||
result = ecma_number_pow (left_number, right_number);
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
}
|
||||
|
||||
ret_value = ecma_make_number_value (result);
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -136,13 +136,13 @@ do_number_arithmetic (number_arithmetic_op op, /**< number arithmetic operation
|
||||
ret_value = ecma_bigint_div_mod (left_value, right_value, true);
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case NUMBER_ARITHMETIC_EXPONENTIATION:
|
||||
{
|
||||
ret_value = ecma_bigint_pow (left_value, right_value);
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
}
|
||||
|
||||
ecma_free_value (left_value);
|
||||
@@ -151,7 +151,7 @@ do_number_arithmetic (number_arithmetic_op op, /**< number arithmetic operation
|
||||
ecma_free_value (right_value);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
return ret_value;
|
||||
} /* do_number_arithmetic */
|
||||
|
||||
@@ -239,13 +239,13 @@ opfunc_addition (ecma_value_t left_value, /**< left value */
|
||||
|
||||
ecma_deref_ecma_string (string2_p);
|
||||
}
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
else if (JERRY_UNLIKELY (ecma_is_value_bigint (left_value))
|
||||
&& JERRY_UNLIKELY (ecma_is_value_bigint (right_value)))
|
||||
{
|
||||
ret_value = ecma_bigint_add_sub (left_value, right_value, true);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
else
|
||||
{
|
||||
ecma_number_t num_left;
|
||||
@@ -294,7 +294,7 @@ opfunc_unary_operation (ecma_value_t left_value, /**< left value */
|
||||
return left_value;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
if (JERRY_LIKELY (!ecma_is_value_bigint (left_value)))
|
||||
{
|
||||
return ecma_make_number_value (is_plus ? left_number : -left_number);
|
||||
@@ -318,9 +318,9 @@ opfunc_unary_operation (ecma_value_t left_value, /**< left value */
|
||||
|
||||
ecma_free_value (left_value);
|
||||
return ret_value;
|
||||
#else /* !ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
#else /* !JERRY_BUILTIN_BIGINT */
|
||||
return ecma_make_number_value (is_plus ? left_number : -left_number);
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
} /* opfunc_unary_operation */
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,10 +57,10 @@ do_number_bitwise_logic (number_bitwise_logic_op op, /**< number bitwise logic o
|
||||
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
if (JERRY_LIKELY (!ecma_is_value_bigint (left_value)))
|
||||
{
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
ecma_number_t right_number;
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (right_value, &right_number)))
|
||||
@@ -113,7 +113,7 @@ do_number_bitwise_logic (number_bitwise_logic_op op, /**< number bitwise logic o
|
||||
|
||||
ret_value = ecma_make_number_value (result);
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -168,7 +168,7 @@ do_number_bitwise_logic (number_bitwise_logic_op op, /**< number bitwise logic o
|
||||
ecma_free_value (right_value);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
return ret_value;
|
||||
} /* do_number_bitwise_logic */
|
||||
@@ -192,18 +192,18 @@ do_number_bitwise_not (ecma_value_t value) /**< value */
|
||||
return value;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
if (JERRY_LIKELY (!ecma_is_value_bigint (value)))
|
||||
{
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
return ecma_make_number_value ((ecma_number_t) ((int32_t) ~ecma_number_to_uint32 (number)));
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
}
|
||||
|
||||
ecma_value_t ret_value = ecma_bigint_unary (value, ECMA_BIGINT_UNARY_BITWISE_NOT);
|
||||
ecma_free_value (value);
|
||||
return ret_value;
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
} /* do_number_bitwise_not */
|
||||
|
||||
/**
|
||||
|
||||
@@ -109,7 +109,7 @@ opfunc_instanceof (ecma_value_t left_value, /**< left value */
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Right value of 'instanceof' must be an object"));
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
ecma_value_t has_instance_method = ecma_op_get_method_by_symbol_id (right_value, LIT_GLOBAL_SYMBOL_HAS_INSTANCE);
|
||||
if (ECMA_IS_VALUE_ERROR (has_instance_method))
|
||||
{
|
||||
@@ -133,7 +133,7 @@ opfunc_instanceof (ecma_value_t left_value, /**< left value */
|
||||
|
||||
return ecma_make_boolean_value (has_instance);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);
|
||||
return ecma_op_object_has_instance (right_value_obj_p, left_value);
|
||||
|
||||
+39
-39
@@ -82,12 +82,12 @@ opfunc_set_data_property (ecma_object_t *object_p, /**< object */
|
||||
|
||||
if (!(*property_p & ECMA_PROPERTY_FLAG_DATA))
|
||||
{
|
||||
#if ENABLED (JERRY_CPOINTER_32_BIT)
|
||||
#if JERRY_CPOINTER_32_BIT
|
||||
ecma_getter_setter_pointers_t *getter_setter_pair_p;
|
||||
getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t,
|
||||
ECMA_PROPERTY_VALUE_PTR (property_p)->getter_setter_pair_cp);
|
||||
jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));
|
||||
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
|
||||
*property_p |= ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_FLAG_WRITABLE;
|
||||
prop_value_p->value = ecma_copy_value_if_not_object (value);
|
||||
@@ -143,22 +143,22 @@ opfunc_set_accessor (bool is_getter, /**< is getter accessor */
|
||||
|
||||
if (*property_p & ECMA_PROPERTY_FLAG_DATA)
|
||||
{
|
||||
#if ENABLED (JERRY_CPOINTER_32_BIT)
|
||||
#if JERRY_CPOINTER_32_BIT
|
||||
ecma_getter_setter_pointers_t *getter_setter_pair_p;
|
||||
getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));
|
||||
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
|
||||
ecma_free_value_if_not_object (prop_value_p->value);
|
||||
*property_p = (uint8_t) (*property_p & ~(ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_FLAG_WRITABLE));
|
||||
|
||||
#if ENABLED (JERRY_CPOINTER_32_BIT)
|
||||
#if JERRY_CPOINTER_32_BIT
|
||||
ECMA_SET_POINTER (getter_setter_pair_p->getter_cp, getter_func_p);
|
||||
ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, setter_func_p);
|
||||
ECMA_SET_NON_NULL_POINTER (prop_value_p->getter_setter_pair_cp, getter_setter_pair_p);
|
||||
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#else /* !JERRY_CPOINTER_32_BIT */
|
||||
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_cp, getter_func_p);
|
||||
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_cp, setter_func_p);
|
||||
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -184,12 +184,12 @@ vm_op_delete_prop (ecma_value_t object, /**< base object */
|
||||
ecma_value_t property, /**< property name */
|
||||
bool is_strict) /**< strict mode */
|
||||
{
|
||||
#if !ENABLED (JERRY_ESNEXT)
|
||||
#if !JERRY_ESNEXT
|
||||
if (ecma_is_value_undefined (object))
|
||||
{
|
||||
return ECMA_VALUE_TRUE;
|
||||
}
|
||||
#endif /* !ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|
||||
if (!ecma_op_require_object_coercible (object))
|
||||
{
|
||||
@@ -215,12 +215,12 @@ vm_op_delete_prop (ecma_value_t object, /**< base object */
|
||||
ecma_deref_object (obj_p);
|
||||
ecma_deref_ecma_string (name_string_p);
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (is_strict && ecma_is_value_false (delete_op_ret))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Operator delete returned false in strict mode"));
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
return delete_op_ret;
|
||||
} /* vm_op_delete_prop */
|
||||
@@ -241,12 +241,12 @@ vm_op_delete_var (ecma_value_t name_literal, /**< name literal */
|
||||
|
||||
ecma_object_t *ref_base_lex_env_p = ecma_op_resolve_reference_base (lex_env_p, var_name_str_p);
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_PROXY)
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
if (JERRY_UNLIKELY (ref_base_lex_env_p == ECMA_OBJECT_POINTER_ERROR))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
if (ref_base_lex_env_p == NULL)
|
||||
{
|
||||
@@ -297,14 +297,14 @@ opfunc_for_in (ecma_value_t iterable_value, /**< ideally an iterable value */
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (obj_expr_value);
|
||||
ecma_collection_t *prop_names_p = ecma_op_object_enumerate (obj_p);
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (prop_names_p == NULL))
|
||||
{
|
||||
ecma_deref_object (obj_p);
|
||||
*result_obj_p = ECMA_VALUE_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
if (prop_names_p->item_count != 0)
|
||||
{
|
||||
@@ -318,7 +318,7 @@ opfunc_for_in (ecma_value_t iterable_value, /**< ideally an iterable value */
|
||||
return NULL;
|
||||
} /* opfunc_for_in */
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* 'VM_OC_APPEND_ARRAY' opcode handler specialized for spread objects
|
||||
@@ -499,7 +499,7 @@ opfunc_spread_arguments (ecma_value_t *stack_top_p, /**< pointer to the current
|
||||
return buff_p;
|
||||
} /* opfunc_spread_arguments */
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* 'VM_OC_APPEND_ARRAY' opcode handler, for setting array object properties
|
||||
@@ -512,12 +512,12 @@ opfunc_append_array (ecma_value_t *stack_top_p, /**< current stack top */
|
||||
uint16_t values_length) /**< number of elements to set
|
||||
* with potential OPFUNC_HAS_SPREAD_ELEMENT flag */
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (values_length >= OPFUNC_HAS_SPREAD_ELEMENT)
|
||||
{
|
||||
return opfunc_append_to_spread_array (stack_top_p, (uint16_t) (values_length & ~OPFUNC_HAS_SPREAD_ELEMENT));
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ecma_object_t *array_obj_p = ecma_get_object_from_value (stack_top_p[-1]);
|
||||
JERRY_ASSERT (ecma_get_object_type (array_obj_p) == ECMA_OBJECT_TYPE_ARRAY);
|
||||
@@ -575,7 +575,7 @@ opfunc_append_array (ecma_value_t *stack_top_p, /**< current stack top */
|
||||
return ECMA_VALUE_EMPTY;
|
||||
} /* opfunc_append_array */
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* Create an executable object using the current frame context
|
||||
@@ -779,16 +779,16 @@ opfunc_resume_executable_object (vm_executable_object_t *executable_object_p, /*
|
||||
ecma_object_t *old_new_target = JERRY_CONTEXT (current_new_target_p);
|
||||
JERRY_CONTEXT (current_new_target_p) = NULL;
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);
|
||||
JERRY_CONTEXT (global_object_p) = ecma_op_function_get_realm (bytecode_header_p);
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
|
||||
ecma_value_t result = vm_execute (&executable_object_p->frame_ctx);
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
JERRY_CONTEXT (global_object_p) = saved_global_object_p;
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
|
||||
JERRY_CONTEXT (current_new_target_p) = old_new_target;
|
||||
executable_object_p->extended_object.u.class_prop.extra_info &= (uint16_t) ~ECMA_EXECUTABLE_OBJECT_RUNNING;
|
||||
@@ -1143,10 +1143,10 @@ opfunc_create_implicit_class_constructor (uint8_t opcode) /**< current cbc opcod
|
||||
|
||||
ecma_native_function_t *native_function_p = (ecma_native_function_t *) function_obj_p;
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (native_function_p->realm_value,
|
||||
ecma_builtin_get_global ());
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
|
||||
/* 10.a.i */
|
||||
if (opcode == CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR_HERITAGE)
|
||||
@@ -1345,7 +1345,7 @@ opfunc_set_class_attributes (ecma_object_t *obj_p, /**< object */
|
||||
{
|
||||
jmem_cpointer_t prop_iter_cp = obj_p->u1.property_list_cp;
|
||||
|
||||
#if ENABLED (JERRY_PROPRETY_HASHMAP)
|
||||
#if JERRY_PROPRETY_HASHMAP
|
||||
if (prop_iter_cp != JMEM_CP_NULL)
|
||||
{
|
||||
ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
|
||||
@@ -1354,7 +1354,7 @@ opfunc_set_class_attributes (ecma_object_t *obj_p, /**< object */
|
||||
prop_iter_cp = prop_iter_p->next_property_cp;
|
||||
}
|
||||
}
|
||||
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
|
||||
#endif /* JERRY_PROPRETY_HASHMAP */
|
||||
|
||||
while (prop_iter_cp != JMEM_CP_NULL)
|
||||
{
|
||||
@@ -1643,13 +1643,13 @@ opfunc_copy_data_properties (ecma_value_t target_object, /**< target object */
|
||||
ecma_object_t *source_object_p = ecma_get_object_from_value (source_object);
|
||||
ecma_collection_t *names_p = ecma_op_object_own_property_keys (source_object_p);
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_PROXY)
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
if (names_p == NULL)
|
||||
{
|
||||
JERRY_ASSERT (!source_to_object);
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
ecma_object_t *target_object_p = ecma_get_object_from_value (target_object);
|
||||
ecma_value_t *buffer_p = names_p->buffer_p;
|
||||
@@ -1760,11 +1760,11 @@ opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *frame_ctx_p, /**< f
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_lex_env_type (frame_ctx_p->lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
JERRY_ASSERT (frame_ctx_p->this_binding == JERRY_CONTEXT (global_object_p)->this_binding);
|
||||
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#else /* !JERRY_BUILTIN_REALMS */
|
||||
JERRY_ASSERT (frame_ctx_p->this_binding == ecma_builtin_get_global ());
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
|
||||
ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;
|
||||
ecma_property_t *binding_p = ecma_find_named_property (lex_env_p, name_p);
|
||||
@@ -1774,11 +1774,11 @@ opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *frame_ctx_p, /**< f
|
||||
return ECMA_VALUE_TRUE;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
ecma_object_t *const global_scope_p = ecma_get_global_scope ((ecma_object_t *) JERRY_CONTEXT (global_object_p));
|
||||
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#else /* !JERRY_BUILTIN_REALMS */
|
||||
ecma_object_t *const global_scope_p = ecma_get_global_scope (global_obj_p);
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
|
||||
if (global_scope_p != lex_env_p)
|
||||
{
|
||||
@@ -1787,7 +1787,7 @@ opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *frame_ctx_p, /**< f
|
||||
|
||||
ecma_object_t *global_obj_p = ecma_get_object_from_value (frame_ctx_p->this_binding);
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_PROXY)
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
if (ECMA_OBJECT_IS_PROXY (global_obj_p))
|
||||
{
|
||||
ecma_property_descriptor_t prop_desc;
|
||||
@@ -1801,7 +1801,7 @@ opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *frame_ctx_p, /**< f
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
ecma_property_t property = ecma_op_object_get_own_property (global_obj_p,
|
||||
name_p,
|
||||
@@ -1812,7 +1812,7 @@ opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *frame_ctx_p, /**< f
|
||||
&& !ecma_is_property_configurable (property)));
|
||||
} /* opfunc_lexical_scope_has_restricted_binding */
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -35,9 +35,9 @@ typedef enum
|
||||
NUMBER_ARITHMETIC_MULTIPLICATION, /**< multiplication */
|
||||
NUMBER_ARITHMETIC_DIVISION, /**< division */
|
||||
NUMBER_ARITHMETIC_REMAINDER, /**< remainder calculation */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
NUMBER_ARITHMETIC_EXPONENTIATION, /**< exponentiation */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
} number_arithmetic_op;
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ typedef enum
|
||||
NUMBER_BITWISE_SHIFT_URIGHT, /**< bitwise UNSIGNED RIGHT SHIFT calculation */
|
||||
} number_bitwise_logic_op;
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* Types for opfunc_create_executable_object.
|
||||
@@ -64,7 +64,7 @@ typedef enum
|
||||
VM_CREATE_EXECUTABLE_OBJECT_ASYNC, /**< create an async function */
|
||||
} vm_create_executable_object_type_t;
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* The stack contains spread object during the upcoming APPEND_ARRAY operation
|
||||
@@ -116,15 +116,15 @@ vm_op_delete_var (ecma_value_t name_literal, ecma_object_t *lex_env_p);
|
||||
ecma_collection_t *
|
||||
opfunc_for_in (ecma_value_t left_value, ecma_value_t *result_obj_p);
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
ecma_collection_t *
|
||||
opfunc_spread_arguments (ecma_value_t *stack_top_p, uint8_t argument_list_len);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ecma_value_t
|
||||
opfunc_append_array (ecma_value_t *stack_top_p, uint16_t values_length);
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
vm_executable_object_t *
|
||||
opfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p, vm_create_executable_object_type_t type);
|
||||
@@ -180,7 +180,7 @@ opfunc_copy_data_properties (ecma_value_t target_object, ecma_value_t source_obj
|
||||
|
||||
ecma_value_t
|
||||
opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *vm_frame_ctx_p, ecma_string_t *name_p);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -44,11 +44,11 @@ typedef enum
|
||||
VM_FRAME_CTX_SHARED_DIRECT_EVAL = (1 << 1), /**< direct eval call */
|
||||
VM_FRAME_CTX_SHARED_FREE_THIS = (1 << 2), /**< free this binding */
|
||||
VM_FRAME_CTX_SHARED_FREE_LOCAL_ENV = (1 << 3), /**< free local environment */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
VM_FRAME_CTX_SHARED_NON_ARROW_FUNC = (1 << 4), /**< non-arrow function */
|
||||
VM_FRAME_CTX_SHARED_HERITAGE_PRESENT = (1 << 5), /**< class heritage present */
|
||||
VM_FRAME_CTX_SHARED_HAS_CLASS_FIELDS = (1 << 6), /**< has class fields */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
} vm_frame_ctx_shared_flags_t;
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ typedef struct
|
||||
uint32_t arg_list_len; /**< arguments list length */
|
||||
} vm_frame_ctx_shared_args_t;
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
#define VM_FRAME_CTX_GET_FUNCTION_OBJECT(frame_ctx_p) \
|
||||
(((vm_frame_ctx_shared_args_t *) (frame_ctx_p)->shared_p)->function_object_p)
|
||||
@@ -91,7 +91,7 @@ typedef struct
|
||||
#define VM_GET_COMPUTED_CLASS_FIELDS(frame_ctx_p) \
|
||||
(((vm_frame_ctx_shared_class_fields_t *) ((frame_ctx_p)->shared_p))->computed_class_fields_p)
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Flag bits of vm_frame_ctx_t
|
||||
@@ -116,9 +116,9 @@ typedef struct vm_frame_ctx_t
|
||||
struct vm_frame_ctx_t *prev_context_p; /**< previous context */
|
||||
ecma_value_t this_binding; /**< this binding */
|
||||
ecma_value_t block_result; /**< block result */
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
#if JERRY_LINE_INFO
|
||||
uint32_t current_line; /**< currently executed line */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
#endif /* JERRY_LINE_INFO */
|
||||
uint16_t context_depth; /**< current context depth */
|
||||
uint8_t status_flags; /**< combination of vm_frame_ctx_flags_t bits */
|
||||
uint8_t call_operation; /**< perform a call or construct operation */
|
||||
|
||||
+18
-18
@@ -41,7 +41,7 @@ JERRY_STATIC_ASSERT (PARSER_WITH_CONTEXT_STACK_ALLOCATION == PARSER_TRY_CONTEXT_
|
||||
JERRY_STATIC_ASSERT (PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION == PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION,
|
||||
for_of_context_stack_allocation_must_be_equal_to_for_await_of_context_stack_allocation);
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
/**
|
||||
* Abort (finalize) the current variable length stack context, and remove it.
|
||||
*
|
||||
@@ -74,7 +74,7 @@ vm_stack_context_abort_variable_length (vm_frame_ctx_t *frame_ctx_p, /**< frame
|
||||
|
||||
return vm_stack_top_p;
|
||||
} /* vm_stack_context_abort_variable_length */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Abort (finalize) the current stack context, and remove it.
|
||||
@@ -111,16 +111,16 @@ vm_stack_context_abort (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
}
|
||||
case VM_CONTEXT_TRY:
|
||||
case VM_CONTEXT_CATCH:
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_CONTEXT_BLOCK:
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case VM_CONTEXT_WITH:
|
||||
{
|
||||
VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_WITH_CONTEXT_STACK_ALLOCATION);
|
||||
vm_stack_top_p -= PARSER_WITH_CONTEXT_STACK_ALLOCATION;
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_CONTEXT_ITERATOR:
|
||||
case VM_CONTEXT_OBJ_INIT:
|
||||
case VM_CONTEXT_OBJ_INIT_REST:
|
||||
@@ -139,7 +139,7 @@ vm_stack_context_abort (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
vm_stack_top_p -= PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION;
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (VM_GET_CONTEXT_TYPE (vm_stack_top_p[-1]) == VM_CONTEXT_FOR_IN);
|
||||
@@ -199,7 +199,7 @@ vm_decode_branch_offset (const uint8_t *branch_offset_p, /**< start offset of by
|
||||
return branch_offset;
|
||||
} /* vm_decode_branch_offset */
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* Byte code which resumes an executable object with throw
|
||||
@@ -209,7 +209,7 @@ static const uint8_t vm_stack_resume_executable_object_with_context_end[1] =
|
||||
CBC_CONTEXT_END
|
||||
};
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Find a finally up to the end position.
|
||||
@@ -253,7 +253,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
return VM_CONTEXT_FOUND_EXPECTED;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (stack_top_p[-1] & VM_CONTEXT_HAS_LEX_ENV)
|
||||
{
|
||||
ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;
|
||||
@@ -261,7 +261,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
frame_ctx_p->lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);
|
||||
ecma_deref_object (lex_env_p);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
byte_code_p = frame_ctx_p->byte_code_start_p + context_end;
|
||||
|
||||
@@ -302,7 +302,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
{
|
||||
JERRY_ASSERT (context_type == VM_CONTEXT_CATCH);
|
||||
|
||||
#if !ENABLED (JERRY_ESNEXT)
|
||||
#if !JERRY_ESNEXT
|
||||
if (stack_top_p[-1] & VM_CONTEXT_HAS_LEX_ENV)
|
||||
{
|
||||
ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;
|
||||
@@ -310,7 +310,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
frame_ctx_p->lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);
|
||||
ecma_deref_object (lex_env_p);
|
||||
}
|
||||
#endif /* !ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|
||||
if (byte_code_p[0] == CBC_CONTEXT_END)
|
||||
{
|
||||
@@ -325,7 +325,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION);
|
||||
stack_top_p += PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION;
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (byte_code_p[1] == CBC_EXT_ASYNC_EXIT))
|
||||
{
|
||||
branch_offset = (uint32_t) (byte_code_p - frame_ctx_p->byte_code_start_p);
|
||||
@@ -335,7 +335,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
frame_ctx_p->stack_top_p = stack_top_p;
|
||||
return VM_CONTEXT_FOUND_FINALLY;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
JERRY_ASSERT (byte_code_p[1] >= CBC_EXT_FINALLY
|
||||
&& byte_code_p[1] <= CBC_EXT_FINALLY_3);
|
||||
@@ -353,7 +353,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
frame_ctx_p->stack_top_p = stack_top_p;
|
||||
return VM_CONTEXT_FOUND_FINALLY;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
else if (stack_top_p[-1] & VM_CONTEXT_CLOSE_ITERATOR)
|
||||
{
|
||||
JERRY_ASSERT (context_type == VM_CONTEXT_FOR_OF
|
||||
@@ -455,7 +455,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
jcontext_raise_exception (exception);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
stack_top_p = vm_stack_context_abort (frame_ctx_p, stack_top_p);
|
||||
}
|
||||
@@ -464,7 +464,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
return VM_CONTEXT_FOUND_EXPECTED;
|
||||
} /* vm_stack_find_finally */
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
* Get the offsets of ecma values corresponding to the passed context.
|
||||
@@ -586,7 +586,7 @@ vm_ref_lex_env_chain (ecma_object_t *lex_env_p, /**< top of lexical environment
|
||||
while (context_top_p > context_end_p);
|
||||
} /* vm_ref_lex_env_chain */
|
||||
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
+12
-12
@@ -67,12 +67,12 @@ typedef enum
|
||||
VM_CONTEXT_FINALLY_RETURN, /**< finally context with a return */
|
||||
VM_CONTEXT_TRY, /**< try context */
|
||||
VM_CONTEXT_CATCH, /**< catch context */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
VM_CONTEXT_BLOCK, /**< block context */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
VM_CONTEXT_WITH, /**< with context */
|
||||
VM_CONTEXT_FOR_IN, /**< for-in context */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
VM_CONTEXT_FOR_OF, /**< for-of context */
|
||||
VM_CONTEXT_FOR_AWAIT_OF, /**< for-await-of context */
|
||||
|
||||
@@ -80,7 +80,7 @@ typedef enum
|
||||
VM_CONTEXT_ITERATOR, /**< iterator context */
|
||||
VM_CONTEXT_OBJ_INIT, /**< object-initializer context */
|
||||
VM_CONTEXT_OBJ_INIT_REST, /**< object-initializer-rest context */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
} vm_stack_context_type_t;
|
||||
|
||||
/**
|
||||
@@ -89,10 +89,10 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
VM_CONTEXT_FOUND_FINALLY, /**< found finally */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
VM_CONTEXT_FOUND_ERROR, /**< found an error */
|
||||
VM_CONTEXT_FOUND_AWAIT, /**< found an await operation */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
VM_CONTEXT_FOUND_EXPECTED, /**< found the type specified in finally_type */
|
||||
} vm_stack_found_type;
|
||||
|
||||
@@ -104,12 +104,12 @@ typedef enum
|
||||
* - [JS values belong to the context]
|
||||
* - [previous JS values stored by the VM stack]
|
||||
*/
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
#define VM_CONTEXT_IS_VARIABLE_LENGTH(context_type) \
|
||||
((context_type) >= VM_CONTEXT_ITERATOR)
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
#define VM_CONTEXT_IS_VARIABLE_LENGTH(context_type) false
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* Checks whether the context type is a finally type.
|
||||
@@ -132,10 +132,10 @@ typedef enum
|
||||
*/
|
||||
#define VM_CONTEXT_GET_NEXT_OFFSET(offsets) (-((int32_t) ((offsets) & ((1 << VM_CONTEXT_OFFSET_SHIFT) - 1))))
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
ecma_value_t *vm_stack_context_abort_variable_length (vm_frame_ctx_t *frame_ctx_p, ecma_value_t *vm_stack_top_p,
|
||||
uint32_t context_stack_allocation);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
uint32_t context_stack_allocation);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
ecma_value_t *vm_stack_context_abort (vm_frame_ctx_t *frame_ctx_p, ecma_value_t *vm_stack_top_p);
|
||||
vm_stack_found_type vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, ecma_value_t *stack_top_p,
|
||||
vm_stack_context_type_t finally_type, uint32_t search_limit);
|
||||
|
||||
@@ -61,7 +61,7 @@ vm_is_direct_eval_form_call (void)
|
||||
ecma_value_t
|
||||
vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimited */
|
||||
{
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
#if JERRY_LINE_INFO
|
||||
vm_frame_ctx_t *context_p = JERRY_CONTEXT (vm_top_context_p);
|
||||
|
||||
if (max_depth == 0)
|
||||
@@ -107,9 +107,9 @@ vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimite
|
||||
}
|
||||
|
||||
return ecma_make_object_value (array_p);
|
||||
#else /* !ENABLED (JERRY_LINE_INFO) */
|
||||
#else /* !JERRY_LINE_INFO */
|
||||
JERRY_UNUSED (max_depth);
|
||||
|
||||
return ecma_make_object_value (ecma_op_new_array_object (0));
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
#endif /* JERRY_LINE_INFO */
|
||||
} /* vm_get_backtrace */
|
||||
|
||||
+132
-132
@@ -91,16 +91,16 @@ vm_op_get_value (ecma_value_t object, /**< base object */
|
||||
property_name_p = ecma_get_string_from_value (property);
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (ecma_is_value_symbol (property))
|
||||
{
|
||||
property_name_p = ecma_get_symbol_from_value (property);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
if (property_name_p != NULL)
|
||||
{
|
||||
#if ENABLED (JERRY_LCACHE)
|
||||
#if JERRY_LCACHE
|
||||
ecma_property_t *property_p = ecma_lcache_lookup (object_p, property_name_p);
|
||||
|
||||
if (property_p != NULL && (*property_p & ECMA_PROPERTY_FLAG_DATA))
|
||||
@@ -108,7 +108,7 @@ vm_op_get_value (ecma_value_t object, /**< base object */
|
||||
JERRY_ASSERT (!ECMA_PROPERTY_IS_INTERNAL (*property_p));
|
||||
return ecma_fast_copy_value (ECMA_PROPERTY_VALUE_PTR (property_p)->value);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_LCACHE) */
|
||||
#endif /* JERRY_LCACHE */
|
||||
|
||||
/* There is no need to free the name. */
|
||||
return ecma_op_object_get (object_p, property_name_p);
|
||||
@@ -117,14 +117,14 @@ vm_op_get_value (ecma_value_t object, /**< base object */
|
||||
|
||||
if (JERRY_UNLIKELY (ecma_is_value_undefined (object) || ecma_is_value_null (object)))
|
||||
{
|
||||
#if ENABLED (JERRY_ERROR_MESSAGES)
|
||||
#if JERRY_ERROR_MESSAGES
|
||||
ecma_value_t error_value = ecma_raise_standard_error_with_format (ECMA_ERROR_TYPE,
|
||||
"Cannot read property '%' of %",
|
||||
property,
|
||||
object);
|
||||
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
#else /* !JERRY_ERROR_MESSAGES */
|
||||
ecma_value_t error_value = ecma_raise_type_error (NULL);
|
||||
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
return error_value;
|
||||
}
|
||||
|
||||
@@ -164,14 +164,14 @@ vm_op_set_value (ecma_value_t base, /**< base object */
|
||||
{
|
||||
if (JERRY_UNLIKELY (ecma_is_value_null (base) || ecma_is_value_undefined (base)))
|
||||
{
|
||||
#if ENABLED (JERRY_ERROR_MESSAGES)
|
||||
#if JERRY_ERROR_MESSAGES
|
||||
result = ecma_raise_standard_error_with_format (ECMA_ERROR_TYPE,
|
||||
"Cannot set property '%' of %",
|
||||
property,
|
||||
base);
|
||||
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
#else /* !JERRY_ERROR_MESSAGES */
|
||||
result = ecma_raise_type_error (NULL);
|
||||
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
ecma_free_value (property);
|
||||
return result;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ static const uint16_t vm_decode_table[] JERRY_ATTR_CONST_DATA =
|
||||
|
||||
#undef CBC_OPCODE
|
||||
|
||||
#if ENABLED (JERRY_MODULE_SYSTEM)
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
/**
|
||||
* Run module code
|
||||
*
|
||||
@@ -287,7 +287,7 @@ vm_run_module (ecma_module_t *module_p) /**< module to be executed */
|
||||
|
||||
return vm_run (&shared, ECMA_VALUE_UNDEFINED, module_p->scope_p);
|
||||
} /* vm_run_module */
|
||||
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
|
||||
/**
|
||||
* Run global code
|
||||
@@ -300,18 +300,18 @@ vm_run_module (ecma_module_t *module_p) /**< module to be executed */
|
||||
ecma_value_t
|
||||
vm_run_global (const ecma_compiled_code_t *bytecode_p) /**< pointer to bytecode to run */
|
||||
{
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
ecma_object_t *global_obj_p = (ecma_object_t *) ecma_op_function_get_realm (bytecode_p);
|
||||
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#else /* !JERRY_BUILTIN_REALMS */
|
||||
ecma_object_t *global_obj_p = ecma_builtin_get_global ();
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (bytecode_p->status_flags & CBC_CODE_FLAGS_LEXICAL_BLOCK_NEEDED)
|
||||
{
|
||||
ecma_create_global_lexical_block (global_obj_p);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ecma_object_t *const global_scope_p = ecma_get_global_scope (global_obj_p);
|
||||
|
||||
@@ -319,20 +319,20 @@ vm_run_global (const ecma_compiled_code_t *bytecode_p) /**< pointer to bytecode
|
||||
shared.bytecode_header_p = bytecode_p;
|
||||
shared.status_flags = 0;
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
ecma_value_t this_binding = ((ecma_global_object_t *) global_obj_p)->this_binding;
|
||||
|
||||
ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);
|
||||
JERRY_CONTEXT (global_object_p) = (ecma_global_object_t *) global_obj_p;
|
||||
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#else /* !JERRY_BUILTIN_REALMS */
|
||||
ecma_value_t this_binding = ecma_make_object_value (global_obj_p);
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
|
||||
ecma_value_t result = vm_run (&shared, this_binding, global_scope_p);
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
JERRY_CONTEXT (global_object_p) = saved_global_object_p;
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
|
||||
return result;
|
||||
} /* vm_run_global */
|
||||
@@ -355,7 +355,7 @@ vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
|
||||
this_binding = ecma_copy_value (JERRY_CONTEXT (vm_top_context_p)->this_binding);
|
||||
lex_env_p = JERRY_CONTEXT (vm_top_context_p)->lex_env_p;
|
||||
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
uint32_t chain_index = parse_opts >> ECMA_PARSE_CHAIN_INDEX_SHIFT;
|
||||
parse_opts &= (1 << ECMA_PARSE_CHAIN_INDEX_SHIFT) - 1;
|
||||
|
||||
@@ -374,19 +374,19 @@ vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
|
||||
chain_index--;
|
||||
}
|
||||
}
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
}
|
||||
else
|
||||
{
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
ecma_object_t *global_obj_p = (ecma_object_t *) ecma_op_function_get_realm (bytecode_data_p);
|
||||
this_binding = ((ecma_global_object_t *) global_obj_p)->this_binding;
|
||||
ecma_ref_object (ecma_get_object_from_value (this_binding));
|
||||
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#else /* !JERRY_BUILTIN_REALMS */
|
||||
ecma_object_t *global_obj_p = ecma_builtin_get_global ();
|
||||
ecma_ref_object (global_obj_p);
|
||||
this_binding = ecma_make_object_value (global_obj_p);
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
lex_env_p = ecma_get_global_scope (global_obj_p);
|
||||
}
|
||||
|
||||
@@ -418,14 +418,14 @@ vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
|
||||
ecma_deref_object (lex_env_p);
|
||||
ecma_free_value (this_binding);
|
||||
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
#if JERRY_SNAPSHOT_EXEC
|
||||
if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
|
||||
{
|
||||
ecma_bytecode_deref (bytecode_data_p);
|
||||
}
|
||||
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
#else /* !JERRY_SNAPSHOT_EXEC */
|
||||
ecma_bytecode_deref (bytecode_data_p);
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
#endif /* JERRY_SNAPSHOT_EXEC */
|
||||
|
||||
return completion_value;
|
||||
} /* vm_run_eval */
|
||||
@@ -441,22 +441,22 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
{
|
||||
ecma_compiled_code_t *bytecode_p;
|
||||
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
#if JERRY_SNAPSHOT_EXEC
|
||||
if (JERRY_LIKELY (!(frame_ctx_p->shared_p->bytecode_header_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)))
|
||||
{
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
#endif /* JERRY_SNAPSHOT_EXEC */
|
||||
bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
|
||||
lit_value);
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
#if JERRY_SNAPSHOT_EXEC
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t *byte_p = ((uint8_t *) frame_ctx_p->shared_p->bytecode_header_p) + lit_value;
|
||||
bytecode_p = (ecma_compiled_code_t *) byte_p;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
#endif /* JERRY_SNAPSHOT_EXEC */
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
if (JERRY_UNLIKELY (!CBC_IS_FUNCTION (bytecode_p->status_flags)))
|
||||
{
|
||||
ecma_object_t *regexp_obj_p = ecma_op_regexp_alloc (NULL);
|
||||
@@ -468,13 +468,13 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
|
||||
return ecma_op_create_regexp_from_bytecode (regexp_obj_p, (re_compiled_code_t *) bytecode_p);
|
||||
}
|
||||
#else /* !ENABLED (JERRY_BUILTIN_REGEXP) */
|
||||
#else /* !JERRY_BUILTIN_REGEXP */
|
||||
JERRY_ASSERT (CBC_IS_FUNCTION (bytecode_p->status_flags));
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
|
||||
ecma_object_t *func_obj_p;
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (CBC_FUNCTION_IS_ARROW (bytecode_p->status_flags)))
|
||||
{
|
||||
func_obj_p = ecma_op_create_arrow_function_object (frame_ctx_p->lex_env_p,
|
||||
@@ -485,9 +485,9 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
{
|
||||
func_obj_p = ecma_op_create_any_function_object (frame_ctx_p->lex_env_p, bytecode_p);
|
||||
}
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
func_obj_p = ecma_op_create_simple_function_object (frame_ctx_p->lex_env_p, bytecode_p);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
return ecma_make_object_value (func_obj_p);
|
||||
} /* vm_construct_literal_object */
|
||||
@@ -527,7 +527,7 @@ static const uint8_t vm_error_byte_code_p[] =
|
||||
CBC_EXT_OPCODE, CBC_EXT_ERROR
|
||||
};
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
static ecma_object_t *
|
||||
vm_get_class_function (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
@@ -627,9 +627,9 @@ vm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))
|
||||
{
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;
|
||||
}
|
||||
else
|
||||
@@ -723,9 +723,9 @@ vm_spread_operation (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))
|
||||
{
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;
|
||||
}
|
||||
else
|
||||
@@ -750,7 +750,7 @@ vm_spread_operation (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
frame_ctx_p->byte_code_p += 3;
|
||||
}
|
||||
} /* vm_spread_operation */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/**
|
||||
* 'Function call' opcode handler.
|
||||
@@ -811,9 +811,9 @@ opfunc_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))
|
||||
{
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;
|
||||
}
|
||||
else
|
||||
@@ -888,9 +888,9 @@ opfunc_construct (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))
|
||||
{
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;
|
||||
}
|
||||
else
|
||||
@@ -1155,7 +1155,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
if (opcode_data & VM_OC_BACKWARD_BRANCH)
|
||||
{
|
||||
#if ENABLED (JERRY_VM_EXEC_STOP)
|
||||
#if JERRY_VM_EXEC_STOP
|
||||
if (JERRY_CONTEXT (vm_exec_stop_cb) != NULL
|
||||
&& --JERRY_CONTEXT (vm_exec_stop_counter) == 0)
|
||||
{
|
||||
@@ -1184,7 +1184,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
#endif /* ENABLED (JERRY_VM_EXEC_STOP) */
|
||||
#endif /* JERRY_VM_EXEC_STOP */
|
||||
|
||||
branch_offset = -branch_offset;
|
||||
}
|
||||
@@ -1327,9 +1327,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
case VM_OC_CREATE_BINDING:
|
||||
{
|
||||
#if !ENABLED (JERRY_ESNEXT)
|
||||
#if !JERRY_ESNEXT
|
||||
JERRY_ASSERT (opcode == CBC_CREATE_VAR);
|
||||
#endif /* !ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|
||||
uint32_t literal_index;
|
||||
|
||||
@@ -1342,7 +1342,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
uint8_t prop_attributes = ECMA_PROPERTY_FLAG_WRITABLE;
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (opcode == CBC_CREATE_LET)
|
||||
{
|
||||
prop_attributes = ECMA_PROPERTY_ENUMERABLE_WRITABLE;
|
||||
@@ -1359,9 +1359,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
{
|
||||
property_value_p->value = ECMA_VALUE_UNINITIALIZED;
|
||||
}
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
ecma_create_named_data_property (frame_ctx_p->lex_env_p, name_p, prop_attributes, NULL);
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -1388,37 +1388,37 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
while (lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT) && !(defined JERRY_NDEBUG)
|
||||
#if JERRY_ESNEXT && !(defined JERRY_NDEBUG)
|
||||
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
|
||||
{
|
||||
ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);
|
||||
|
||||
JERRY_ASSERT (property_p == NULL || !(*property_p & ECMA_PROPERTY_FLAG_ENUMERABLE));
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) && !JERRY_NDEBUG */
|
||||
#endif /* JERRY_ESNEXT && !JERRY_NDEBUG */
|
||||
|
||||
JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);
|
||||
lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT) && !(defined JERRY_NDEBUG)
|
||||
#if JERRY_ESNEXT && !(defined JERRY_NDEBUG)
|
||||
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
|
||||
{
|
||||
ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);
|
||||
|
||||
JERRY_ASSERT (property_p == NULL || !(*property_p & ECMA_PROPERTY_FLAG_ENUMERABLE));
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) && !JERRY_NDEBUG */
|
||||
#endif /* JERRY_ESNEXT && !JERRY_NDEBUG */
|
||||
|
||||
/* 'Variable declaration' */
|
||||
result = ecma_op_has_binding (lex_env_p, name_p);
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_PROXY)
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
if (ECMA_IS_VALUE_ERROR (result))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
ecma_property_t *prop_p = NULL;
|
||||
|
||||
@@ -1458,7 +1458,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_OC_EXT_VAR_EVAL:
|
||||
{
|
||||
uint32_t literal_index;
|
||||
@@ -1533,7 +1533,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
ecma_deref_object (ecma_get_object_from_value (lit_value));
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case VM_OC_CREATE_ARGUMENTS:
|
||||
{
|
||||
uint32_t literal_index;
|
||||
@@ -1564,14 +1564,14 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
ecma_deref_object (ecma_get_object_from_value (result));
|
||||
continue;
|
||||
}
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
#if JERRY_SNAPSHOT_EXEC
|
||||
case VM_OC_SET_BYTECODE_PTR:
|
||||
{
|
||||
memcpy (&byte_code_p, byte_code_p++, sizeof (uint8_t *));
|
||||
memcpy (&byte_code_p, byte_code_p++, sizeof (uintptr_t));
|
||||
frame_ctx_p->byte_code_start_p = byte_code_p;
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
#endif /* JERRY_SNAPSHOT_EXEC */
|
||||
case VM_OC_INIT_ARG_OR_FUNC:
|
||||
{
|
||||
uint32_t literal_index, value_index;
|
||||
@@ -1622,7 +1622,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
continue;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_OC_CHECK_VAR:
|
||||
{
|
||||
JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (frame_ctx_p->shared_p->bytecode_header_p->status_flags)
|
||||
@@ -1678,12 +1678,12 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
result = ecma_op_has_binding (lex_env_p, literal_name_p);
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_PROXY)
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
if (ECMA_IS_VALUE_ERROR (result))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
if (ecma_is_value_true (result))
|
||||
{
|
||||
@@ -1928,7 +1928,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
left_value ^= right_value;
|
||||
/* FALLTHRU */
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case VM_OC_SET_PROPERTY:
|
||||
{
|
||||
JERRY_STATIC_ASSERT (VM_OC_NON_STATIC_FLAG == VM_OC_BACKWARD_BRANCH,
|
||||
@@ -1944,7 +1944,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
goto error;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (ecma_compare_ecma_string_to_magic_id (prop_name_p, LIT_MAGIC_STRING_PROTOTYPE))
|
||||
&& !(opcode_data & VM_OC_NON_STATIC_FLAG))
|
||||
{
|
||||
@@ -1953,9 +1953,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
|
||||
const int index = (int) (opcode_data >> VM_OC_NON_STATIC_SHIFT) - 2;
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
const int index = -1;
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (stack_top_p[index]);
|
||||
|
||||
@@ -1977,7 +1977,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
goto error;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (ecma_compare_ecma_string_to_magic_id (prop_name_p, LIT_MAGIC_STRING_PROTOTYPE))
|
||||
&& !(opcode_data & VM_OC_NON_STATIC_FLAG))
|
||||
{
|
||||
@@ -1986,9 +1986,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
|
||||
const int index = (int) (opcode_data >> VM_OC_NON_STATIC_SHIFT) - 2;
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
const int index = -1;
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
opfunc_set_accessor (VM_OC_GROUP_GET_INDEX (opcode_data) == VM_OC_SET_GETTER,
|
||||
stack_top_p[index],
|
||||
@@ -2005,7 +2005,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
*stack_top_p++ = ecma_make_object_value (ecma_op_new_array_object (0));
|
||||
continue;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_OC_LOCAL_EVAL:
|
||||
{
|
||||
ECMA_CLEAR_LOCAL_PARSE_OPTS ();
|
||||
@@ -2817,7 +2817,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case VM_OC_PUSH_ELISON:
|
||||
{
|
||||
*stack_top_p++ = ECMA_VALUE_ARRAY_HOLE;
|
||||
@@ -2828,22 +2828,22 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
uint16_t values_length = *byte_code_p++;
|
||||
stack_top_p -= values_length;
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (*byte_code_start_p == CBC_EXT_OPCODE)
|
||||
{
|
||||
values_length = (uint16_t) (values_length | OPFUNC_HAS_SPREAD_ELEMENT);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
result = opfunc_append_array (stack_top_p, values_length);
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (ECMA_IS_VALUE_ERROR (result))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
JERRY_ASSERT (ecma_is_value_empty (result));
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
continue;
|
||||
}
|
||||
case VM_OC_IDENT_REFERENCE:
|
||||
@@ -3009,7 +3009,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
ecma_free_value (left_value);
|
||||
left_value = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
if (JERRY_UNLIKELY (ecma_is_value_bigint (result)))
|
||||
{
|
||||
ecma_bigint_unary_operation_type operation_type = ECMA_BIGINT_UNARY_INCREASE;
|
||||
@@ -3039,7 +3039,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
result = ecma_make_number_value (result_number);
|
||||
}
|
||||
@@ -3160,9 +3160,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
case VM_OC_ERROR:
|
||||
{
|
||||
JERRY_ASSERT (frame_ctx_p->byte_code_p[1] == CBC_EXT_ERROR);
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
frame_ctx_p->byte_code_p = JERRY_CONTEXT (debugger_exception_byte_code_p);
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
result = ECMA_VALUE_ERROR;
|
||||
goto error;
|
||||
@@ -3272,7 +3272,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
ecma_fast_free_value (value);
|
||||
continue;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_OC_BRANCH_IF_NULLISH:
|
||||
{
|
||||
left_value = stack_top_p[-1];
|
||||
@@ -3285,7 +3285,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
--stack_top_p;
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case VM_OC_PLUS:
|
||||
case VM_OC_MINUS:
|
||||
{
|
||||
@@ -3584,7 +3584,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
*stack_top_p++ = result;
|
||||
goto free_both_values;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_OC_EXP:
|
||||
{
|
||||
result = do_number_arithmetic (NUMBER_ARITHMETIC_EXPONENTIATION,
|
||||
@@ -3599,7 +3599,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
*stack_top_p++ = result;
|
||||
goto free_both_values;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case VM_OC_EQUAL:
|
||||
{
|
||||
result = opfunc_equality (left_value, right_value);
|
||||
@@ -3791,7 +3791,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
if (ecma_are_values_integer_numbers (left_value, right_value))
|
||||
{
|
||||
bool is_less = (ecma_integer_value_t) left_value < (ecma_integer_value_t) right_value;
|
||||
#if !ENABLED (JERRY_VM_EXEC_STOP)
|
||||
#if !JERRY_VM_EXEC_STOP
|
||||
/* This is a lookahead to the next opcode to improve performance.
|
||||
* If it is CBC_BRANCH_IF_TRUE_BACKWARD, execute it. */
|
||||
if (*byte_code_p <= CBC_BRANCH_IF_TRUE_BACKWARD_3 && *byte_code_p >= CBC_BRANCH_IF_TRUE_BACKWARD)
|
||||
@@ -3825,7 +3825,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
continue;
|
||||
}
|
||||
#endif /* !ENABLED (JERRY_VM_EXEC_STOP) */
|
||||
#endif /* !JERRY_VM_EXEC_STOP */
|
||||
*stack_top_p++ = ecma_make_boolean_value (is_less);
|
||||
continue;
|
||||
}
|
||||
@@ -3965,7 +3965,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
case VM_OC_BLOCK_CREATE_CONTEXT:
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
ecma_value_t *stack_context_top_p;
|
||||
stack_context_top_p = VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth;
|
||||
|
||||
@@ -4000,12 +4000,12 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
stack_context_top_p[-1] |= VM_CONTEXT_HAS_LEX_ENV;
|
||||
}
|
||||
#else /* !ENABLED (JERRY_ESNEXT) */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-2]) == VM_CONTEXT_CATCH
|
||||
&& !(stack_top_p[-2] & VM_CONTEXT_HAS_LEX_ENV));
|
||||
|
||||
stack_top_p[-2] |= VM_CONTEXT_HAS_LEX_ENV;
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
frame_ctx_p->lex_env_p = ecma_create_decl_lex_env (frame_ctx_p->lex_env_p);
|
||||
frame_ctx_p->lex_env_p->type_flags_refs |= ECMA_OBJECT_FLAG_BLOCK;
|
||||
@@ -4058,13 +4058,13 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
if (prop_names_p == NULL)
|
||||
{
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (expr_obj_value)))
|
||||
{
|
||||
result = expr_obj_value;
|
||||
goto error;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* The collection is already released */
|
||||
byte_code_p = byte_code_start_p + branch_offset;
|
||||
@@ -4080,13 +4080,13 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
stack_top_p[-3] = 0;
|
||||
stack_top_p[-4] = expr_obj_value;
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (byte_code_p[0] == CBC_EXT_OPCODE && byte_code_p[1] == CBC_EXT_CLONE_CONTEXT)
|
||||
{
|
||||
/* No need to duplicate the first context. */
|
||||
byte_code_p += 2;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
continue;
|
||||
}
|
||||
case VM_OC_FOR_IN_GET_NEXT:
|
||||
@@ -4152,7 +4152,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_OC_FOR_OF_INIT:
|
||||
{
|
||||
ecma_value_t value = *(--stack_top_p);
|
||||
@@ -4366,7 +4366,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
frame_ctx_p->stack_top_p = stack_top_p;
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case VM_OC_TRY:
|
||||
{
|
||||
/* Try opcode simply creates the try context. */
|
||||
@@ -4428,7 +4428,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
continue;
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (stack_top_p[-1] & VM_CONTEXT_HAS_LEX_ENV)
|
||||
{
|
||||
ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;
|
||||
@@ -4436,7 +4436,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
frame_ctx_p->lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);
|
||||
ecma_deref_object (lex_env_p);
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth,
|
||||
PARSER_FINALLY_CONTEXT_STACK_ALLOCATION);
|
||||
@@ -4453,9 +4453,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
jcontext_raise_exception (*stack_top_p);
|
||||
result = ECMA_VALUE_ERROR;
|
||||
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -4478,7 +4478,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
stack_top_p[-2] = jump_target;
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_CONTEXT_FOUND_ERROR:
|
||||
{
|
||||
JERRY_ASSERT (jcontext_has_pending_exception ());
|
||||
@@ -4491,7 +4491,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
stack_top_p[-2] = jump_target;
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
default:
|
||||
{
|
||||
byte_code_p = frame_ctx_p->byte_code_start_p + jump_target;
|
||||
@@ -4524,7 +4524,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
stack_top_p[-2] = (uint32_t) branch_offset;
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_CONTEXT_FOUND_ERROR:
|
||||
{
|
||||
JERRY_ASSERT (jcontext_has_pending_exception ());
|
||||
@@ -4537,7 +4537,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
stack_top_p[-2] = (uint32_t) branch_offset;
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
default:
|
||||
{
|
||||
byte_code_p = frame_ctx_p->byte_code_start_p + branch_offset;
|
||||
@@ -4548,7 +4548,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);
|
||||
continue;
|
||||
}
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
case VM_OC_BREAKPOINT_ENABLED:
|
||||
{
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_IGNORE)
|
||||
@@ -4622,8 +4622,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
#if JERRY_LINE_INFO
|
||||
case VM_OC_LINE:
|
||||
{
|
||||
uint32_t value = 0;
|
||||
@@ -4639,7 +4639,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
frame_ctx_p->current_line = value;
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
#endif /* JERRY_LINE_INFO */
|
||||
case VM_OC_NONE:
|
||||
default:
|
||||
{
|
||||
@@ -4756,17 +4756,17 @@ error:
|
||||
while (stack_top_p > stack_bottom_p)
|
||||
{
|
||||
ecma_value_t stack_item = *(--stack_top_p);
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
if (stack_item == ECMA_VALUE_RELEASE_LEX_ENV)
|
||||
{
|
||||
opfunc_pop_lexical_environment (frame_ctx_p);
|
||||
continue;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
ecma_fast_free_value (stack_item);
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
const uint32_t dont_stop = (JERRY_DEBUGGER_VM_IGNORE_EXCEPTION
|
||||
| JERRY_DEBUGGER_VM_IGNORE
|
||||
| JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
|
||||
@@ -4796,7 +4796,7 @@ error:
|
||||
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
}
|
||||
|
||||
JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);
|
||||
@@ -4826,7 +4826,7 @@ error:
|
||||
stack_top_p[-2] = result;
|
||||
continue;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_CONTEXT_FOUND_ERROR:
|
||||
{
|
||||
JERRY_ASSERT (jcontext_has_pending_exception ());
|
||||
@@ -4844,7 +4844,7 @@ error:
|
||||
stack_top_p[-2] = result;
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
default:
|
||||
{
|
||||
goto finish;
|
||||
@@ -4869,9 +4869,9 @@ error:
|
||||
JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);
|
||||
JERRY_ASSERT (!(stack_top_p[-1] & VM_CONTEXT_HAS_LEX_ENV));
|
||||
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
result = jcontext_take_exception ();
|
||||
|
||||
@@ -4886,13 +4886,13 @@ error:
|
||||
*stack_top_p++ = result;
|
||||
continue;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_CONTEXT_FOUND_AWAIT:
|
||||
{
|
||||
JERRY_ASSERT (VM_GET_CONTEXT_TYPE (frame_ctx_p->stack_top_p[-1]) == VM_CONTEXT_FINALLY_THROW);
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -4940,9 +4940,9 @@ vm_init_exec (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
frame_ctx_p->prev_context_p = JERRY_CONTEXT (vm_top_context_p);
|
||||
frame_ctx_p->block_result = ECMA_VALUE_UNDEFINED;
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
#if JERRY_LINE_INFO
|
||||
frame_ctx_p->current_line = 0;
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
#endif /* JERRY_LINE_INFO */
|
||||
frame_ctx_p->context_depth = 0;
|
||||
frame_ctx_p->status_flags = (uint8_t) ((shared_p->status_flags & VM_FRAME_CTX_DIRECT_EVAL)
|
||||
| (bytecode_header_p->status_flags & VM_FRAME_CTX_IS_STRICT));
|
||||
@@ -5034,7 +5034,7 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
opfunc_call (frame_ctx_p);
|
||||
break;
|
||||
}
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
case VM_EXEC_SUPER_CALL:
|
||||
{
|
||||
vm_super_call (frame_ctx_p);
|
||||
@@ -5049,7 +5049,7 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
{
|
||||
return completion_value;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case VM_EXEC_CONSTRUCT:
|
||||
{
|
||||
opfunc_construct (frame_ctx_p);
|
||||
@@ -5078,14 +5078,14 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
ecma_fast_free_value (registers_p[i]);
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
if (JERRY_CONTEXT (debugger_stop_context) == JERRY_CONTEXT (vm_top_context_p))
|
||||
{
|
||||
/* The engine will stop when the next breakpoint is reached. */
|
||||
JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_STOP);
|
||||
JERRY_CONTEXT (debugger_stop_context) = NULL;
|
||||
}
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
JERRY_CONTEXT (vm_top_context_p) = frame_ctx_p->prev_context_p;
|
||||
return completion_value;
|
||||
|
||||
+22
-22
@@ -162,9 +162,9 @@ typedef enum
|
||||
VM_OC_ERROR, /**< error while the vm_loop is suspended */
|
||||
|
||||
VM_OC_JUMP, /**< jump */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
VM_OC_BRANCH_IF_NULLISH, /** branch if undefined or null */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
VM_OC_BRANCH_IF_STRICT_EQUAL, /**< branch if strict equal */
|
||||
|
||||
/* These four opcodes must be in this order. */
|
||||
@@ -186,9 +186,9 @@ typedef enum
|
||||
VM_OC_MUL, /**< mul */
|
||||
VM_OC_DIV, /**< div */
|
||||
VM_OC_MOD, /**< mod */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
VM_OC_EXP, /**< exponentiation */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
VM_OC_EQUAL, /**< equal */
|
||||
VM_OC_NOT_EQUAL, /**< not equal */
|
||||
@@ -224,20 +224,20 @@ typedef enum
|
||||
VM_OC_CREATE_ARGUMENTS, /**< create arguments object */
|
||||
VM_OC_SET_BYTECODE_PTR, /**< setting bytecode pointer */
|
||||
VM_OC_VAR_EVAL, /**< variable and function evaluation */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#if JERRY_ESNEXT
|
||||
VM_OC_EXT_VAR_EVAL, /**< variable and function evaluation for
|
||||
* functions with separate argument context */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
VM_OC_INIT_ARG_OR_FUNC, /**< create and init a function or argument binding */
|
||||
|
||||
#if ENABLED (JERRY_DEBUGGER)
|
||||
#if JERRY_DEBUGGER
|
||||
VM_OC_BREAKPOINT_ENABLED, /**< enabled breakpoint for debugger */
|
||||
VM_OC_BREAKPOINT_DISABLED, /**< disabled breakpoint for debugger */
|
||||
#endif /* ENABLED (JERRY_DEBUGGER) */
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
#if JERRY_LINE_INFO
|
||||
VM_OC_LINE, /**< line number of the next statement */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#endif /* JERRY_LINE_INFO */
|
||||
#if JERRY_ESNEXT
|
||||
VM_OC_CHECK_VAR, /**< check redeclared vars in the global scope */
|
||||
VM_OC_CHECK_LET, /**< check redeclared lets in the global scope */
|
||||
VM_OC_ASSIGN_LET_CONST, /**< assign values to let/const declarations */
|
||||
@@ -302,7 +302,7 @@ typedef enum
|
||||
VM_OC_SET__PROTO__, /**< set prototype when __proto__: form is used */
|
||||
VM_OC_PUSH_STATIC_FIELD_FUNC, /**< push static field initializer function */
|
||||
VM_OC_ADD_COMPUTED_FIELD, /**< add computed field name */
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
VM_OC_NONE, /**< a special opcode for unsupported byte codes */
|
||||
} vm_oc_types;
|
||||
|
||||
@@ -311,18 +311,18 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
#if !ENABLED (JERRY_ESNEXT)
|
||||
#if !JERRY_ESNEXT
|
||||
VM_OC_EXP = VM_OC_NONE, /**< exponentiation */
|
||||
VM_OC_BRANCH_IF_NULLISH = VM_OC_NONE, /** branch if undefined or null */
|
||||
#endif /* !ENABLED (JERRY_ESNEXT) */
|
||||
#if !ENABLED (JERRY_DEBUGGER)
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
#if !JERRY_DEBUGGER
|
||||
VM_OC_BREAKPOINT_ENABLED = VM_OC_NONE, /**< enabled breakpoint for debugger is unused */
|
||||
VM_OC_BREAKPOINT_DISABLED = VM_OC_NONE, /**< disabled breakpoint for debugger is unused */
|
||||
#endif /* !ENABLED (JERRY_DEBUGGER) */
|
||||
#if !ENABLED (JERRY_LINE_INFO)
|
||||
#endif /* !JERRY_DEBUGGER */
|
||||
#if !JERRY_LINE_INFO
|
||||
VM_OC_LINE = VM_OC_NONE, /**< line number of the next statement is unused */
|
||||
#endif /* !ENABLED (JERRY_LINE_INFO) */
|
||||
#if !ENABLED (JERRY_ESNEXT)
|
||||
#endif /* !JERRY_LINE_INFO */
|
||||
#if !JERRY_ESNEXT
|
||||
VM_OC_EXT_VAR_EVAL = VM_OC_NONE, /**< variable and function evaluation for
|
||||
* functions with separate argument context */
|
||||
VM_OC_CHECK_VAR = VM_OC_NONE, /**< check redeclared vars in the global scope */
|
||||
@@ -389,7 +389,7 @@ typedef enum
|
||||
VM_OC_SET__PROTO__ = VM_OC_NONE, /**< set prototype when __proto__: form is used */
|
||||
VM_OC_PUSH_STATIC_FIELD_FUNC = VM_OC_NONE, /**< push static field initializer function */
|
||||
VM_OC_ADD_COMPUTED_FIELD = VM_OC_NONE, /**< add computed field name */
|
||||
#endif /* !ENABLED (JERRY_ESNEXT) */
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|
||||
VM_OC_UNUSED = VM_OC_NONE /**< placeholder if the list is empty */
|
||||
} vm_oc_unused_types;
|
||||
@@ -479,9 +479,9 @@ typedef enum
|
||||
ecma_value_t vm_run_global (const ecma_compiled_code_t *bytecode_p);
|
||||
ecma_value_t vm_run_eval (ecma_compiled_code_t *bytecode_data_p, uint32_t parse_opts);
|
||||
|
||||
#if ENABLED (JERRY_MODULE_SYSTEM)
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
ecma_value_t vm_run_module (ecma_module_t *module_p);
|
||||
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
|
||||
ecma_value_t vm_run (vm_frame_ctx_shared_t *shared_p, ecma_value_t this_binding_value, ecma_object_t *lex_env_p);
|
||||
ecma_value_t vm_execute (vm_frame_ctx_t *frame_ctx_p);
|
||||
|
||||
Reference in New Issue
Block a user