Rework built-in processing of JerryScript (#4347)

- All built-ins are native functions now
- Native handlers have a built-in id: ECMA_BUILTIN_ID_HANDLER
- Built-in routine identifiers start from 1
- Built-in routines have an own flag set
- Name property of routines is resolved dynamically
- Style fixes

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-12-01 11:37:08 +01:00
committed by GitHub
parent 577a605ead
commit c0fc67f5bd
39 changed files with 441 additions and 442 deletions
+74 -69
View File
@@ -802,41 +802,42 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
}
case ECMA_OBJECT_TYPE_FUNCTION:
{
if (!ecma_get_object_is_builtin (object_p))
{
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
ext_func_p->u.function.scope_cp));
JERRY_ASSERT (!ecma_get_object_is_builtin (object_p));
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
ext_func_p->u.function.scope_cp));
#if ENABLED (JERRY_ESNEXT)
const ecma_compiled_code_t *byte_code_p = ecma_op_function_get_compiled_code (ext_func_p);
const ecma_compiled_code_t *byte_code_p = ecma_op_function_get_compiled_code (ext_func_p);
if (CBC_FUNCTION_IS_ARROW (byte_code_p->status_flags))
if (CBC_FUNCTION_IS_ARROW (byte_code_p->status_flags))
{
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) object_p;
if (ecma_is_value_object (arrow_func_p->this_binding))
{
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) object_p;
if (ecma_is_value_object (arrow_func_p->this_binding))
{
ecma_gc_set_object_visited (ecma_get_object_from_value (arrow_func_p->this_binding));
}
if (ecma_is_value_object (arrow_func_p->new_target))
{
ecma_gc_set_object_visited (ecma_get_object_from_value (arrow_func_p->new_target));
}
ecma_gc_set_object_visited (ecma_get_object_from_value (arrow_func_p->this_binding));
}
if (ecma_is_value_object (arrow_func_p->new_target))
{
ecma_gc_set_object_visited (ecma_get_object_from_value (arrow_func_p->new_target));
}
#endif /* ENABLED (JERRY_ESNEXT) */
}
#endif /* ENABLED (JERRY_ESNEXT) */
break;
}
#if ENABLED (JERRY_ESNEXT)
case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:
{
if (ecma_get_object_is_builtin (object_p))
{
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
switch (ext_func_p->u.native_handler.id)
if (ecma_get_object_is_builtin (object_p)
&& ext_func_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER)
{
switch (ext_func_p->u.built_in.routine_id)
{
case ECMA_NATIVE_HANDLER_PROMISE_RESOLVE:
case ECMA_NATIVE_HANDLER_PROMISE_REJECT:
@@ -1282,68 +1283,72 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
{
uint8_t length_and_bitset_size;
if (object_type == ECMA_OBJECT_TYPE_CLASS
|| object_type == ECMA_OBJECT_TYPE_ARRAY)
if (object_type == ECMA_OBJECT_TYPE_CLASS || object_type == ECMA_OBJECT_TYPE_ARRAY)
{
ext_object_size = sizeof (ecma_extended_built_in_object_t);
length_and_bitset_size = ((ecma_extended_built_in_object_t *) object_p)->built_in.length_and_bitset_size;
ext_object_size += (2 * sizeof (uint32_t)) * (length_and_bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);
length_and_bitset_size = ((ecma_extended_built_in_object_t *) object_p)->built_in.u.length_and_bitset_size;
ext_object_size += sizeof (uint64_t) * (length_and_bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);
}
else
{
#if ENABLED (JERRY_ESNEXT)
if (object_type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION)
if (object_type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION
&& ecma_builtin_function_is_routine (object_p))
{
#if ENABLED (JERRY_ESNEXT)
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
switch (ext_obj_p->u.native_handler.id)
if (ext_obj_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER)
{
case ECMA_NATIVE_HANDLER_PROMISE_RESOLVE:
case ECMA_NATIVE_HANDLER_PROMISE_REJECT:
switch (ext_obj_p->u.built_in.routine_id)
{
ext_object_size = sizeof (ecma_promise_resolver_t);
break;
}
case ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY:
case ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY:
{
ext_object_size = sizeof (ecma_promise_finally_function_t);
break;
}
case ECMA_NATIVE_HANDLER_PROMISE_CAPABILITY_EXECUTOR:
{
ext_object_size = sizeof (ecma_promise_capability_executor_t);
break;
}
case ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER:
{
ext_object_size = sizeof (ecma_promise_all_executor_t);
break;
}
case ECMA_NATIVE_HANDLER_PROMISE_RESOLVE:
case ECMA_NATIVE_HANDLER_PROMISE_REJECT:
{
ext_object_size = sizeof (ecma_promise_resolver_t);
break;
}
case ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY:
case ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY:
{
ext_object_size = sizeof (ecma_promise_finally_function_t);
break;
}
case ECMA_NATIVE_HANDLER_PROMISE_CAPABILITY_EXECUTOR:
{
ext_object_size = sizeof (ecma_promise_capability_executor_t);
break;
}
case ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER:
{
ext_object_size = sizeof (ecma_promise_all_executor_t);
break;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
case ECMA_NATIVE_HANDLER_PROXY_REVOKE:
{
ext_object_size = sizeof (ecma_revocable_proxy_object_t);
break;
}
case ECMA_NATIVE_HANDLER_PROXY_REVOKE:
{
ext_object_size = sizeof (ecma_revocable_proxy_object_t);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
case ECMA_NATIVE_HANDLER_VALUE_THUNK:
case ECMA_NATIVE_HANDLER_VALUE_THROWER:
{
ecma_free_value_if_not_object (((ecma_promise_value_thunk_t *) object_p)->value);
ext_object_size = sizeof (ecma_promise_value_thunk_t);
break;
}
default:
{
JERRY_UNREACHABLE ();
case ECMA_NATIVE_HANDLER_VALUE_THUNK:
case ECMA_NATIVE_HANDLER_VALUE_THROWER:
{
ecma_free_value_if_not_object (((ecma_promise_value_thunk_t *) object_p)->value);
ext_object_size = sizeof (ecma_promise_value_thunk_t);
break;
}
default:
{
JERRY_UNREACHABLE ();
}
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
}
else
#endif /* ENABLED (JERRY_ESNEXT) */
{
length_and_bitset_size = ((ecma_extended_object_t *) object_p)->u.built_in.length_and_bitset_size;
ext_object_size += (2 * sizeof (uint32_t)) * (length_and_bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);
length_and_bitset_size = ((ecma_extended_object_t *) object_p)->u.built_in.u.length_and_bitset_size;
ext_object_size += sizeof (uint64_t) * (length_and_bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);
}
ecma_gc_free_properties (object_p);
+16 -18
View File
@@ -851,20 +851,27 @@ typedef struct
typedef struct
{
uint8_t id; /**< built-in id */
uint8_t length_and_bitset_size; /**< length for built-in functions and
* bit set size for all built-ins */
uint16_t routine_id; /**< routine id for built-in functions */
uint8_t routine_id; /**< routine id for built-in functions */
/** built-in specific field */
union
{
uint32_t instantiated_bitset[1]; /**< bit set for instantiated properties */
struct
{
uint16_t name; /**< name of the built-in functions */
uint16_t bitset; /**< bit set for instantiated properties of builtin functions */
} builtin_routine;
uint8_t length_and_bitset_size; /**< length and bit set size for generic built-ins */
uint8_t routine_index; /**< property descriptor index for built-in routines */
} u;
/** extra built-in info */
union
{
uint8_t instantiated_bitset[1]; /**< instantiated property bit set for generic built-ins */
uint8_t routine_flags; /**< flags for built-in routines */
} u2;
uint32_t continue_instantiated_bitset[1]; /**< bit set for instantiated properties */
} ecma_built_in_props_t;
/**
* Number of bits available in the instantiated bitset without allocation
*/
#define ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE (8 + 32)
/**
* Builtin routine function object status flags
*/
@@ -977,15 +984,6 @@ typedef struct
ecma_value_t args_len_or_this; /**< length of arguments or this value */
} bound_function;
/**
* Description of a built-in native handler object.
*/
struct
{
uint32_t id; /**< handler id */
uint32_t flags; /**< handler flags */
} native_handler;
ecma_native_handler_t external_handler_cb; /**< external function */
} u;
} ecma_extended_object_t;
@@ -44,7 +44,7 @@
*/
enum
{
ECMA_ARRAY_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_ARRAY_PROTOTYPE_ROUTINE_START = 0,
/* Note: these 2 routine ids must be in this order */
#if !ENABLED (JERRY_ESNEXT)
ECMA_ARRAY_PROTOTYPE_TO_STRING,
@@ -2888,11 +2888,10 @@ ecma_builtin_array_prototype_object_flat_map (ecma_value_t callback, /**< callba
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_array_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
{
ecma_value_t obj_this = ecma_op_to_object (this_arg);
@@ -43,7 +43,7 @@
*/
enum
{
ECMA_ARRAY_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_ARRAY_ROUTINE_START = 0,
ECMA_ARRAY_ROUTINE_IS_ARRAY,
#if ENABLED (JERRY_ESNEXT)
ECMA_ARRAY_ROUTINE_FROM,
@@ -544,8 +544,7 @@ ecma_builtin_array_dispatch_construct (const ecma_value_t *arguments_list_p, /**
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_array_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_array_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -40,7 +40,7 @@
*/
enum
{
ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_START = 0,
ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT,
ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_THROW,
ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_RETURN
@@ -85,8 +85,8 @@ JERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENER
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_async_generator_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_async_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to
@@ -39,7 +39,7 @@
*/
enum
{
ECMA_BOOLEAN_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_BOOLEAN_PROTOTYPE_ROUTINE_START = 0,
ECMA_BOOLEAN_PROTOTYPE_ROUTINE_TO_STRING,
ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF
};
@@ -98,8 +98,8 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_value_t this_arg) /**< this
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_boolean_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_boolean_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -37,7 +37,7 @@
*/
enum
{
ECMA_DATAVIEW_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_DATAVIEW_PROTOTYPE_ROUTINE_START = 0,
ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER,
ECMA_DATAVIEW_PROTOTYPE_BYTE_LENGTH_GETTER,
ECMA_DATAVIEW_PROTOTYPE_BYTE_OFFSET_GETTER,
@@ -146,7 +146,7 @@ ecma_builtin_dataview_prototype_object_getters (ecma_value_t this_arg, /**< this
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_dataview_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_builtin_dataview_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -46,7 +46,7 @@
*/
enum
{
ECMA_DATE_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_DATE_PROTOTYPE_ROUTINE_START = 0,
ECMA_DATE_PROTOTYPE_GET_FULL_YEAR, /* ECMA-262 v5 15.9.5.10 */
ECMA_DATE_PROTOTYPE_GET_UTC_FULL_YEAR, /* ECMA-262 v5 15.9.5.11 */
@@ -584,8 +584,8 @@ ecma_builtin_date_prototype_dispatch_set (uint16_t builtin_routine_id, /**< buil
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_date_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list[], /**< list of arguments
* passed to routine */
@@ -40,7 +40,7 @@
*/
enum
{
ECMA_FUNCTION_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_FUNCTION_PROTOTYPE_ROUTINE_START = 0,
ECMA_FUNCTION_PROTOTYPE_TO_STRING,
ECMA_FUNCTION_PROTOTYPE_CALL,
ECMA_FUNCTION_PROTOTYPE_APPLY,
@@ -417,11 +417,10 @@ ecma_builtin_function_prototype_dispatch_construct (const ecma_value_t *argument
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_function_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_function_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
{
if (!ecma_op_is_callable (this_arg))
@@ -38,7 +38,7 @@
*/
enum
{
ECMA_GENERATOR_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_GENERATOR_PROTOTYPE_ROUTINE_START = 0,
ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT,
ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW,
ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN
@@ -200,8 +200,8 @@ ecma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_ob
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_generator_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -43,7 +43,7 @@
*/
enum
{
ECMA_GLOBAL_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_GLOBAL_ROUTINE_START = 0,
/* Note: these 5 routine ids must be in this order */
ECMA_GLOBAL_IS_NAN,
ECMA_GLOBAL_IS_FINITE,
@@ -590,7 +590,7 @@ ecma_builtin_global_object_unescape (lit_utf8_byte_t *input_start_p, /**< routin
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_global_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -42,8 +42,8 @@ static const uint8_t ecma_native_handler_lengths[] =
ecma_native_handler_t
ecma_builtin_handler_get (ecma_native_handler_id_t id) /**< handler id */
{
JERRY_ASSERT (id < ECMA_NATIVE_HANDLER__COUNT);
return ecma_native_handlers[id];
JERRY_ASSERT (id != ECMA_NATIVE_HANDLER_START && id < ECMA_NATIVE_HANDLER__COUNT);
return ecma_native_handlers[id - 1];
} /* ecma_builtin_handler_get */
/**
@@ -54,8 +54,8 @@ ecma_builtin_handler_get (ecma_native_handler_id_t id) /**< handler id */
uint8_t
ecma_builtin_handler_get_length (ecma_native_handler_id_t id) /**< handler id */
{
JERRY_ASSERT (id < ECMA_NATIVE_HANDLER__COUNT);
return ecma_native_handler_lengths[id];
JERRY_ASSERT (id != ECMA_NATIVE_HANDLER_START && id < ECMA_NATIVE_HANDLER__COUNT);
return ecma_native_handler_lengths[id - 1];
} /* ecma_builtin_handler_get_length */
#endif /* ENABLED (JERRY_ESNEXT) */
@@ -27,6 +27,7 @@
typedef enum
{
ECMA_NATIVE_HANDLER_START = 0,
#define ECMA_NATIVE_HANDLER(id, handler, length) id,
#include "ecma-builtin-handlers.inc.h"
#undef ECMA_NATIVE_HANDLER
@@ -65,7 +65,7 @@
*/
enum
{
PASTE (ECMA_ROUTINE_START_, BUILTIN_UNDERSCORED_ID) = ECMA_BUILTIN_ID__COUNT - 1,
PASTE (ECMA_ROUTINE_START_, BUILTIN_UNDERSCORED_ID) = 0,
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
ECMA_ROUTINE_ ## name ## c_function_name,
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
@@ -230,8 +230,8 @@ const ecma_builtin_property_descriptor_t PROPERTY_DESCRIPTOR_LIST_NAME[] =
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
DISPATCH_ROUTINE_ROUTINE_NAME (uint16_t builtin_routine_id, /**< built-in wide routine
identifier */
DISPATCH_ROUTINE_ROUTINE_NAME (uint8_t builtin_routine_id, /**< built-in wide routine
identifier */
ecma_value_t this_arg_value, /**< 'this' argument
value */
const ecma_value_t arguments_list[], /**< list of arguments
@@ -39,7 +39,7 @@
*/
enum
{
ECMA_INTRINSIC_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_INTRINSIC_ROUTINE_START = 0,
ECMA_INTRINSIC_ARRAY_PROTOTYPE_VALUES,
ECMA_INTRINSIC_TYPEDARRAY_PROTOTYPE_VALUES,
ECMA_INTRINSIC_MAP_PROTOTYPE_ENTRIES,
@@ -153,7 +153,7 @@ ecma_builtin_intrinsic_set_prototype_values (ecma_value_t this_value)
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_intrinsic_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -45,8 +45,7 @@
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_map_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_map_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -47,7 +47,7 @@
*/
enum
{
ECMA_MATH_OBJECT_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_MATH_OBJECT_ROUTINE_START = 0,
ECMA_MATH_OBJECT_ABS, /* ECMA-262 v5, 15.8.2.1 */
ECMA_MATH_OBJECT_ACOS, /* ECMA-262 v5, 15.8.2.2 */
@@ -328,8 +328,7 @@ ecma_builtin_math_object_random (void)
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_math_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list[], /**< list of arguments
* passed to routine */
@@ -43,7 +43,7 @@
*/
enum
{
ECMA_NUMBER_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_NUMBER_PROTOTYPE_ROUTINE_START = 0,
ECMA_NUMBER_PROTOTYPE_VALUE_OF,
ECMA_NUMBER_PROTOTYPE_TO_STRING,
ECMA_NUMBER_PROTOTYPE_TO_LOCALE_STRING,
@@ -748,11 +748,10 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_number_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_number_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
{
ecma_value_t this_value = ecma_builtin_number_prototype_object_value_of (this_arg);
@@ -43,7 +43,7 @@
*/
enum
{
ECMA_NUMBER_OBJECT_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_NUMBER_OBJECT_ROUTINE_START = 0,
ECMA_NUMBER_OBJECT_ROUTINE_IS_FINITE,
ECMA_NUMBER_OBJECT_ROUTINE_IS_NAN,
ECMA_NUMBER_OBJECT_ROUTINE_IS_INTEGER,
@@ -200,8 +200,7 @@ ecma_builtin_number_object_is_integer_helper (ecma_value_t arg, /**< routine's a
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_number_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_number_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -42,7 +42,7 @@
enum
{
/* Note: these 6 routines must be in this order */
ECMA_OBJECT_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_OBJECT_PROTOTYPE_ROUTINE_START = 0,
ECMA_OBJECT_PROTOTYPE_TO_STRING,
ECMA_OBJECT_PROTOTYPE_VALUE_OF,
ECMA_OBJECT_PROTOTYPE_TO_LOCALE_STRING,
@@ -405,11 +405,11 @@ ecma_builtin_object_prototype_lookup_getter_setter (ecma_value_t this_arg, /**<
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_object_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_object_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
{
JERRY_UNUSED (arguments_number);
@@ -46,7 +46,7 @@
*/
enum
{
ECMA_OBJECT_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_OBJECT_ROUTINE_START = 0,
ECMA_OBJECT_ROUTINE_CREATE,
ECMA_OBJECT_ROUTINE_IS,
@@ -1375,8 +1375,7 @@ ecma_op_object_get_own_property_keys (ecma_value_t this_arg, /**< this argument
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_object_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -31,7 +31,7 @@
*/
enum
{
ECMA_PROMISE_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_PROMISE_PROTOTYPE_ROUTINE_START = 0,
ECMA_PROMISE_PROTOTYPE_ROUTINE_THEN,
ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH,
ECMA_PROMISE_PROTOTYPE_ROUTINE_FINALLY
@@ -58,8 +58,7 @@ enum
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_promise_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_promise_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -41,7 +41,7 @@
*/
enum
{
ECMA_PROMISE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_PROMISE_ROUTINE_START = 0,
ECMA_PROMISE_ROUTINE_REJECT,
ECMA_PROMISE_ROUTINE_RESOLVE,
ECMA_PROMISE_ROUTINE_RACE,
@@ -465,12 +465,12 @@ ecma_builtin_promise_dispatch_construct (const ecma_value_t *arguments_list_p, /
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_promise_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
ecma_builtin_promise_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
{
ecma_value_t argument = (arguments_number > 0) ? arguments_list_p[0] : ECMA_VALUE_UNDEFINED;
@@ -40,7 +40,7 @@
*/
enum
{
ECMA_REFLECT_OBJECT_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_REFLECT_OBJECT_ROUTINE_START = 0,
ECMA_REFLECT_OBJECT_GET, /* ECMA-262 v6, 26.1.6 */
ECMA_REFLECT_OBJECT_SET, /* ECMA-262 v6, 26.1.13 */
ECMA_REFLECT_OBJECT_HAS, /* ECMA-262 v6, 26.1.9 */
@@ -77,8 +77,7 @@ enum
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_reflect_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list[], /**< list of arguments
* passed to routine */
@@ -45,7 +45,7 @@
enum
{
/** These routines must be in this order */
ECMA_REGEXP_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_REGEXP_PROTOTYPE_ROUTINE_START = 0,
ECMA_REGEXP_PROTOTYPE_ROUTINE_EXEC,
#if ENABLED (JERRY_BUILTIN_ANNEXB)
ECMA_REGEXP_PROTOTYPE_ROUTINE_COMPILE,
@@ -521,8 +521,7 @@ ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p)
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_regexp_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -44,8 +44,7 @@
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_set_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_set_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -52,7 +52,7 @@
*/
enum
{
ECMA_STRING_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_STRING_PROTOTYPE_ROUTINE_START = 0,
/* Note: These 4 routines MUST be in this order */
ECMA_STRING_PROTOTYPE_TO_STRING,
ECMA_STRING_PROTOTYPE_VALUE_OF,
@@ -1368,11 +1368,11 @@ ecma_builtin_string_prototype_object_iterator (ecma_value_t to_string) /**< this
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_string_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_string_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
{
if (builtin_routine_id <= ECMA_STRING_PROTOTYPE_VALUE_OF)
@@ -39,7 +39,7 @@
*/
enum
{
ECMA_SYMBOL_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_SYMBOL_PROTOTYPE_ROUTINE_START = 0,
ECMA_SYMBOL_PROTOTYPE_VALUE_OF, /**< ECMA-262 v11, 19.4.3.4 */
ECMA_SYMBOL_PROTOTYPE_TO_PRIMITIVE, /**< ECMA-262 v11, 19.4.3.5 */
ECMA_SYMBOL_PROTOTYPE_TO_STRING, /**< ECMA-262 v11, 19.4.3.3 */
@@ -67,11 +67,10 @@ enum
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_symbol_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_symbol_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list[], /**< list of arguments
* passed to routine */
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
{
JERRY_UNUSED_2 (arguments_list, arguments_number);
@@ -44,8 +44,7 @@
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_weakmap_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_weakmap_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -45,8 +45,8 @@
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_weakset_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_builtin_weakset_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -94,7 +94,7 @@ ecma_value_t \
ecma_builtin_ ## lowercase_name ## _dispatch_construct (const ecma_value_t *, \
uint32_t); \
ecma_value_t \
ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint16_t builtin_routine_id, \
ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint8_t builtin_routine_id, \
ecma_value_t this_arg_value, \
const ecma_value_t [], \
uint32_t);
@@ -106,7 +106,7 @@ ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint16_t builtin_routine_i
extern const ecma_builtin_property_descriptor_t \
ecma_builtin_ ## lowercase_name ## _property_descriptor_list[]; \
ecma_value_t \
ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint16_t builtin_routine_id, \
ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint8_t builtin_routine_id, \
ecma_value_t this_arg_value, \
const ecma_value_t [], \
uint32_t);
+189 -73
View File
@@ -44,7 +44,7 @@ typedef const ecma_builtin_property_descriptor_t *ecma_builtin_property_list_ref
/**
* Definition of built-in dispatch routine function pointer.
*/
typedef ecma_value_t (*ecma_builtin_dispatch_routine_t) (uint16_t builtin_routine_id,
typedef ecma_value_t (*ecma_builtin_dispatch_routine_t) (uint8_t builtin_routine_id,
ecma_value_t this_arg,
const ecma_value_t arguments_list[],
uint32_t arguments_number);
@@ -329,11 +329,11 @@ ecma_builtin_get_global (void)
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_builtin_function_is_routine (ecma_object_t *func_obj_p) /**< function object */
{
JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION);
JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
JERRY_ASSERT (ecma_get_object_is_builtin (func_obj_p));
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;
return (ext_func_obj_p->u.built_in.routine_id >= ECMA_BUILTIN_ID__COUNT);
return (ext_func_obj_p->u.built_in.routine_id != 0);
} /* ecma_builtin_function_is_routine */
/**
@@ -376,13 +376,13 @@ ecma_instantiate_builtin (ecma_builtin_id_t obj_builtin_id) /**< built-in id */
size_t property_count = ecma_builtin_get_property_count (obj_builtin_id);
if (property_count > 32)
if (property_count > ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE)
{
/* Only 64 extra properties supported at the moment.
* This can be extended to 256 later. */
JERRY_ASSERT (property_count <= (32 + 64));
JERRY_ASSERT (property_count <= (ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE + 64));
ext_object_size += sizeof (uint32_t) * 2;
ext_object_size += sizeof (uint64_t);
}
ecma_object_t *obj_p = ecma_create_object (prototype_obj_p, ext_object_size, obj_type);
@@ -415,21 +415,19 @@ ecma_instantiate_builtin (ecma_builtin_id_t obj_builtin_id) /**< built-in id */
}
built_in_props_p->id = (uint8_t) obj_builtin_id;
built_in_props_p->routine_id = (uint16_t) obj_builtin_id;
built_in_props_p->u.instantiated_bitset[0] = 0;
built_in_props_p->routine_id = 0;
built_in_props_p->u.length_and_bitset_size = 0;
built_in_props_p->u2.instantiated_bitset[0] = 0;
built_in_props_p->continue_instantiated_bitset[0] = 0;
if (property_count > 32)
if (property_count > 40)
{
built_in_props_p->length_and_bitset_size = 1 << ECMA_BUILT_IN_BITSET_SHIFT;
built_in_props_p->u.length_and_bitset_size = 1 << ECMA_BUILT_IN_BITSET_SHIFT;
uint32_t *instantiated_bitset_p = built_in_props_p->u.instantiated_bitset;
uint32_t *instantiated_bitset_p = built_in_props_p->continue_instantiated_bitset;
instantiated_bitset_p[1] = 0;
instantiated_bitset_p[2] = 0;
}
else
{
built_in_props_p->length_and_bitset_size = 0;
}
/** Initializing [[PrimitiveValue]] properties of built-in prototype objects */
switch (obj_builtin_id)
@@ -569,33 +567,29 @@ ecma_finalize_builtins (void)
*/
static ecma_object_t *
ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**< identifier of built-in object */
uint16_t routine_id, /**< builtin-wide identifier of the built-in
* object's routine property */
uint16_t name_id, /**< magic string id of 'name' property */
uint16_t flags, /**< see also: ecma_builtin_routine_flags */
uint8_t length_prop_value) /**< value of 'length' property */
uint8_t routine_id, /**< builtin-wide identifier of the built-in
* object's routine property */
uint32_t routine_index, /**< property descriptor index of routine */
uint8_t flags) /**< see also: ecma_builtin_routine_flags */
{
JERRY_ASSERT (length_prop_value < (1 << ECMA_BUILT_IN_BITSET_SHIFT));
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
size_t ext_object_size = sizeof (ecma_extended_object_t);
ecma_object_t *func_obj_p = ecma_create_object (prototype_obj_p,
ext_object_size,
ECMA_OBJECT_TYPE_FUNCTION);
ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
ecma_set_object_is_builtin (func_obj_p);
JERRY_ASSERT (routine_id >= ECMA_BUILTIN_ID__COUNT);
JERRY_ASSERT (routine_id > 0);
JERRY_ASSERT (routine_index <= UINT8_MAX);
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;
ext_func_obj_p->u.built_in.id = (uint8_t) builtin_id;
ext_func_obj_p->u.built_in.routine_id = routine_id;
ext_func_obj_p->u.built_in.u.builtin_routine.name = name_id;
ext_func_obj_p->u.built_in.u.builtin_routine.bitset = flags;
ext_func_obj_p->u.built_in.length_and_bitset_size = length_prop_value;
ext_func_obj_p->u.built_in.u.routine_index = (uint8_t) routine_index;
ext_func_obj_p->u.built_in.u2.routine_flags = flags;
return func_obj_p;
} /* ecma_builtin_make_function_object_for_routine */
@@ -607,15 +601,15 @@ ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**
*/
static ecma_object_t *
ecma_builtin_make_function_object_for_getter_accessor (ecma_builtin_id_t builtin_id, /**< id of built-in object */
uint16_t routine_id, /**< builtin-wide id of the built-in
uint8_t routine_id, /**< builtin-wide id of the built-in
* object's routine property */
uint16_t name_id) /**< magic string id of 'name' property */
uint32_t routine_index) /**< property descriptor index
* of routine */
{
return ecma_builtin_make_function_object_for_routine (builtin_id,
routine_id,
name_id,
ECMA_BUILTIN_ROUTINE_GETTER,
0);
routine_index,
ECMA_BUILTIN_ROUTINE_GETTER);
} /* ecma_builtin_make_function_object_for_getter_accessor */
/**
@@ -625,17 +619,70 @@ ecma_builtin_make_function_object_for_getter_accessor (ecma_builtin_id_t builtin
*/
static ecma_object_t *
ecma_builtin_make_function_object_for_setter_accessor (ecma_builtin_id_t builtin_id, /**< id of built-in object */
uint16_t routine_id, /**< builtin-wide id of the built-in
uint8_t routine_id, /**< builtin-wide id of the built-in
* object's routine property */
uint16_t name_id) /**< magic string id of 'name' property */
uint32_t routine_index) /**< property descriptor index
* of routine */
{
return ecma_builtin_make_function_object_for_routine (builtin_id,
routine_id,
name_id,
ECMA_BUILTIN_ROUTINE_SETTER,
1);
routine_index,
ECMA_BUILTIN_ROUTINE_SETTER);
} /* ecma_builtin_make_function_object_for_setter_accessor */
#if ENABLED (JERRY_ESNEXT)
/**
* Create specification defined properties for built-in native handlers.
*
* @return pointer property, if one was instantiated,
* NULL - otherwise.
*/
static ecma_property_t *
ecma_builtin_native_handler_try_to_instantiate_property (ecma_object_t *object_p, /**< object */
ecma_string_t *property_name_p) /**< property's name */
{
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION
&& ecma_get_object_is_builtin (object_p));
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
ecma_property_t *prop_p = NULL;
if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_NAME))
{
if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED) == 0)
{
ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
property_name_p,
ECMA_PROPERTY_FLAG_CONFIGURABLE,
&prop_p);
value_p->value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
ext_obj_p->u.built_in.u2.routine_flags |= ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED;
}
}
else if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH))
{
if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED) == 0)
{
ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
property_name_p,
ECMA_PROPERTY_FLAG_CONFIGURABLE,
&prop_p);
const uint8_t length = ecma_builtin_handler_get_length (ext_obj_p->u.built_in.routine_id);
value_p->value = ecma_make_integer_value (length);
ext_obj_p->u.built_in.u2.routine_flags |= ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED;
}
}
return prop_p;
} /* ecma_builtin_native_handler_try_to_instantiate_property */
#endif /* ENABLED (JERRY_ESNEXT) */
/**
* Lazy instantiation of builtin routine property of builtin object
*
@@ -650,24 +697,34 @@ ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, /**<
ecma_string_t *string_p) /**< property's name */
{
JERRY_ASSERT (ecma_get_object_is_builtin (object_p));
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION);
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
JERRY_ASSERT (ecma_builtin_function_is_routine (object_p));
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
#if ENABLED (JERRY_ESNEXT)
if (JERRY_UNLIKELY (ext_func_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER))
{
return ecma_builtin_native_handler_try_to_instantiate_property (object_p, string_p);
}
#endif /* !ENABLED (JERRY_ESNEXT) */
if (ecma_string_is_length (string_p))
{
/*
* Lazy instantiation of 'length' property
*/
ecma_property_t *len_prop_p;
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
#if ENABLED (JERRY_ESNEXT)
uint16_t *bitset_p = &ext_func_p->u.built_in.u.builtin_routine.bitset;
uint8_t *bitset_p = &ext_func_p->u.built_in.u2.routine_flags;
if (*bitset_p & ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED)
{
/* length property was already instantiated */
return NULL;
}
/* We mark that the property was lazily instantiated,
* as it is configurable and so can be deleted (ECMA-262 v6, 19.2.4.1) */
*bitset_p |= ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED;
@@ -684,11 +741,25 @@ ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, /**<
&len_prop_p);
#endif /* ENABLED (JERRY_ESNEXT) */
uint8_t length = ext_func_p->u.built_in.length_and_bitset_size;
JERRY_ASSERT (length < (1 << ECMA_BUILT_IN_BITSET_SHIFT));
uint8_t length = 0;
if (ext_func_p->u.built_in.u2.routine_flags & ECMA_BUILTIN_ROUTINE_SETTER)
{
length = 1;
}
else if (!(ext_func_p->u.built_in.u2.routine_flags & ECMA_BUILTIN_ROUTINE_GETTER))
{
uint8_t routine_index = ext_func_p->u.built_in.u.routine_index;
const ecma_builtin_property_descriptor_t *property_list_p;
property_list_p = ecma_builtin_property_list_references[ext_func_p->u.built_in.id];
JERRY_ASSERT (property_list_p[routine_index].type == ECMA_BUILTIN_PROPERTY_ROUTINE);
length = ECMA_GET_ROUTINE_LENGTH (property_list_p[routine_index].value);
}
len_prop_value_p->value = ecma_make_integer_value (length);
return len_prop_p;
}
@@ -698,8 +769,7 @@ ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, /**<
*/
if (ecma_compare_ecma_string_to_magic_id (string_p, LIT_MAGIC_STRING_NAME))
{
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
uint16_t *bitset_p = &ext_func_p->u.built_in.u.builtin_routine.bitset;
uint8_t *bitset_p = &ext_func_p->u.built_in.u2.routine_flags;
if (*bitset_p & ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED)
{
@@ -715,8 +785,17 @@ ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, /**<
ECMA_PROPERTY_FLAG_CONFIGURABLE,
&name_prop_p);
uint8_t routine_index = ext_func_p->u.built_in.u.routine_index;
const ecma_builtin_property_descriptor_t *property_list_p;
property_list_p = ecma_builtin_property_list_references[ext_func_p->u.built_in.id];
JERRY_ASSERT (property_list_p[routine_index].type == ECMA_BUILTIN_PROPERTY_ROUTINE
|| property_list_p[routine_index].type == ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE
|| property_list_p[routine_index].type == ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY);
lit_magic_string_id_t name_id = property_list_p[routine_index].magic_string_id;
ecma_string_t *name_p;
lit_magic_string_id_t name_id = ext_func_p->u.built_in.u.builtin_routine.name;
if (JERRY_UNLIKELY (name_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT))
{
@@ -828,10 +907,8 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
}
uint32_t index = (uint32_t) (curr_property_p - property_list_p);
uint32_t *bitset_p = built_in_props_p->u.instantiated_bitset + (index >> 5);
uint32_t bit_for_index = (uint32_t) (1u << (index & 0x1f));
uint8_t *bitset_p = built_in_props_p->u2.instantiated_bitset + (index >> 3);
uint8_t bit_for_index = (uint8_t) (1u << (index & 0x7));
if (*bitset_p & bit_for_index)
{
@@ -969,23 +1046,18 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
ecma_object_t *func_obj_p;
func_obj_p = ecma_builtin_make_function_object_for_routine (builtin_id,
ECMA_GET_ROUTINE_ID (curr_property_p->value),
curr_property_p->magic_string_id,
ECMA_BUILTIN_ROUTINE_NO_OPTS,
ECMA_GET_ROUTINE_LENGTH (curr_property_p->value));
index,
ECMA_BUILTIN_ROUTINE_NO_OPTS);
value = ecma_make_object_value (func_obj_p);
break;
}
case ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE:
{
is_accessor = true;
uint16_t getter_id = ECMA_ACCESSOR_READ_WRITE_GET_GETTER_ID (curr_property_p->value);
uint16_t setter_id = ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID (curr_property_p->value);
getter_p = ecma_builtin_make_function_object_for_getter_accessor (builtin_id,
getter_id,
curr_property_p->magic_string_id);
setter_p = ecma_builtin_make_function_object_for_setter_accessor (builtin_id,
setter_id,
curr_property_p->magic_string_id);
uint8_t getter_id = ECMA_ACCESSOR_READ_WRITE_GET_GETTER_ID (curr_property_p->value);
uint8_t setter_id = ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID (curr_property_p->value);
getter_p = ecma_builtin_make_function_object_for_getter_accessor (builtin_id, getter_id, index);
setter_p = ecma_builtin_make_function_object_for_setter_accessor (builtin_id, setter_id, index);
break;
}
default:
@@ -993,9 +1065,8 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
JERRY_ASSERT (curr_property_p->type == ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY);
is_accessor = true;
getter_p = ecma_builtin_make_function_object_for_getter_accessor (builtin_id,
curr_property_p->value,
curr_property_p->magic_string_id);
uint8_t getter_id = (uint8_t) curr_property_p->value;
getter_p = ecma_builtin_make_function_object_for_getter_accessor (builtin_id, getter_id, index);
break;
}
}
@@ -1035,6 +1106,36 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
return prop_p;
} /* ecma_builtin_try_to_instantiate_property */
#if ENABLED (JERRY_ESNEXT)
/**
* List names of an Built-in native handler object's lazy instantiated properties,
* adding them to corresponding string collections
*/
static void
ecma_builtin_native_handler_list_lazy_property_names (ecma_object_t *object_p, /**< function object */
ecma_collection_t *prop_names_p, /**< prop name collection */
ecma_property_counter_t *prop_counter_p) /**< prop counter */
{
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION
&& ecma_get_object_is_builtin (object_p));
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED) == 0)
{
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_NAME));
prop_counter_p->string_named_props++;
}
if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED) == 0)
{
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
prop_counter_p->string_named_props++;
}
} /* ecma_builtin_native_handler_list_lazy_property_names */
#endif /* ENABLED (JERRY_ESNEXT) */
/**
* List names of a built-in function's lazy instantiated properties
*
@@ -1047,18 +1148,25 @@ ecma_builtin_routine_list_lazy_property_names (ecma_object_t *object_p, /**< a b
ecma_property_counter_t *prop_counter_p) /**< prop counter */
{
JERRY_ASSERT (ecma_get_object_is_builtin (object_p));
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION);
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
JERRY_ASSERT (ecma_builtin_function_is_routine (object_p));
#if ENABLED (JERRY_ESNEXT)
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
if (!(ext_func_p->u.built_in.u.builtin_routine.bitset & ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED))
if (JERRY_UNLIKELY (ext_func_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER))
{
ecma_builtin_native_handler_list_lazy_property_names (object_p, prop_names_p, prop_counter_p);
return;
}
if (!(ext_func_p->u.built_in.u2.routine_flags & ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED))
{
/* Unintialized 'length' property is non-enumerable (ECMA-262 v6, 19.2.4.1) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
prop_counter_p->string_named_props++;
}
if (!(ext_func_p->u.built_in.u.builtin_routine.bitset & ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED))
if (!(ext_func_p->u.built_in.u2.routine_flags & ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED))
{
/* Unintialized 'name' property is non-enumerable (ECMA-262 v6, 19.2.4.2) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_NAME));
@@ -1106,11 +1214,11 @@ ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in
const ecma_builtin_property_descriptor_t *curr_property_p = ecma_builtin_property_list_references[builtin_id];
uint32_t index = 0;
uint32_t *bitset_p = built_in_props_p->u.instantiated_bitset;
uint8_t *bitset_p = built_in_props_p->u2.instantiated_bitset;
while (curr_property_p->magic_string_id != LIT_MAGIC_STRING__COUNT)
{
if (index == 32)
if (index == 8)
{
bitset_p++;
index = 0;
@@ -1211,13 +1319,21 @@ ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< arguments list length */
{
JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_FUNCTION);
JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
JERRY_ASSERT (ecma_get_object_is_builtin (obj_p));
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
if (ecma_builtin_function_is_routine (obj_p))
{
#if ENABLED (JERRY_ESNEXT)
if (JERRY_UNLIKELY (ext_obj_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER))
{
ecma_native_handler_t handler = ecma_builtin_handler_get (ext_obj_p->u.built_in.routine_id);
return handler (ecma_make_object_value (obj_p), this_arg_value, arguments_list_p, arguments_list_len);
}
#endif /* !ENABLED (JERRY_ESNEXT) */
return ecma_builtin_dispatch_routine (ext_obj_p,
this_arg_value,
arguments_list_p,
@@ -1240,7 +1356,7 @@ ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */
const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< arguments list length */
{
JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_FUNCTION);
JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
JERRY_ASSERT (ecma_get_object_is_builtin (obj_p));
if (ecma_builtin_function_is_routine (obj_p))
@@ -48,6 +48,16 @@ typedef enum
ECMA_BUILTIN_ID__COUNT /**< number of built-in objects */
} ecma_builtin_id_t;
#if ENABLED (JERRY_ESNEXT)
/**
* Special id for handlers (handlers are not regular built-ins, but
* they use the same ecma_built_in_props_t structure as other built-ins)
*/
#define ECMA_BUILTIN_ID_HANDLER ECMA_BUILTIN_ID__COUNT
#endif /* ENABLED (JERRY_ESNEXT) */
/**
* Construct a routine value
*/
@@ -61,7 +71,7 @@ typedef enum
/**
* Get routine ID
*/
#define ECMA_GET_ROUTINE_ID(value) ((uint16_t) ((value) >> 4))
#define ECMA_GET_ROUTINE_ID(value) ((uint8_t) ((value) >> 4))
/**
* Construct a fully accessor value
@@ -71,12 +81,12 @@ typedef enum
/**
* Get accessor setter ID
*/
#define ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID(value) ((uint16_t) ((value) & 0xff))
#define ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID(value) ((uint8_t) ((value) & 0xff))
/**
* Get accessor getter ID
*/
#define ECMA_ACCESSOR_READ_WRITE_GET_GETTER_ID(value) ((uint16_t) ((value) >> 8))
#define ECMA_ACCESSOR_READ_WRITE_GET_GETTER_ID(value) ((uint8_t) ((value) >> 8))
/* ecma-builtins.c */
void ecma_finalize_builtins (void);
@@ -25,7 +25,7 @@ BUILTIN (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
/* The Object object (15.2.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_OBJECT,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
object)
@@ -40,7 +40,7 @@ BUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE,
/* The Array object (15.4.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
array)
@@ -94,7 +94,7 @@ BUILTIN (ECMA_BUILTIN_ID_STRING_PROTOTYPE,
/* The String object (15.5.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_STRING,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
string)
@@ -110,7 +110,7 @@ BUILTIN (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE,
/* The Boolean object (15.6.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BOOLEAN,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
boolean)
@@ -126,7 +126,7 @@ BUILTIN (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE,
/* The Number object (15.7.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_NUMBER,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
number)
@@ -134,14 +134,14 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_NUMBER,
/* The Function.prototype object (15.3.4) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
true,
function_prototype)
/* The Function object (15.3.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
function)
@@ -177,7 +177,7 @@ BUILTIN (ECMA_BUILTIN_ID_JSON,
#if ENABLED (JERRY_BUILTIN_DATE)
/* The Date object (15.9.3) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATE,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
date)
@@ -186,7 +186,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATE,
#if ENABLED (JERRY_BUILTIN_REGEXP)
/* The RegExp object (15.10) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REGEXP,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
regexp)
@@ -200,7 +200,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REGEXP,
/* The Error object (15.11.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ERROR,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
error)
@@ -222,7 +222,7 @@ BUILTIN (ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE,
/* The EvalError object (15.11.6.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_EVAL_ERROR,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
true,
eval_error)
@@ -236,7 +236,7 @@ BUILTIN (ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE,
/* The RangeError object (15.11.6.2) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_RANGE_ERROR,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
true,
range_error)
@@ -250,7 +250,7 @@ BUILTIN (ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE,
/* The ReferenceError object (15.11.6.3) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REFERENCE_ERROR,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
true,
reference_error)
@@ -264,7 +264,7 @@ BUILTIN (ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE,
/* The SyntaxError object (15.11.6.4) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYNTAX_ERROR,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
true,
syntax_error)
@@ -278,7 +278,7 @@ BUILTIN (ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE,
/* The TypeError object (15.11.6.5) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
true,
type_error)
@@ -292,7 +292,7 @@ BUILTIN (ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE,
/* The URIError object (15.11.6.6) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_URI_ERROR,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
true,
uri_error)
@@ -300,7 +300,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_URI_ERROR,
/**< The [[ThrowTypeError]] object (13.2.3) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
false,
type_error_thrower)
@@ -316,7 +316,7 @@ BUILTIN (ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE,
/* The ArrayBuffer object (ES2015 24.1.2) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAYBUFFER,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
arraybuffer)
@@ -331,62 +331,62 @@ BUILTIN (ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,
/* The %TypedArray% intrinsic object (ES2015 22.2.1)
Note: The routines must be in this order. */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPEDARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
typedarray)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT8ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
int8array)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
uint8array)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
uint8clampedarray)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT16ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
int16array)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT16ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
uint16array)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT32ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
int32array)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT32ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
uint32array)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT32ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
float32array)
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT64ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
float64array)
@@ -394,13 +394,13 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT64ARRAY,
#if ENABLED (JERRY_BUILTIN_BIGINT)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGINT64ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
bigint64array)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGUINT64ARRAY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_TYPEDARRAY,
true,
biguint64array)
@@ -486,7 +486,7 @@ BUILTIN (ECMA_BUILTIN_ID_PROMISE_PROTOTYPE,
promise_prototype)
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROMISE,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
promise)
@@ -504,7 +504,7 @@ BUILTIN (ECMA_BUILTIN_ID_MAP_PROTOTYPE,
/* The Map routine (ECMA-262 v6, 23.1.1.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
map)
@@ -522,7 +522,7 @@ BUILTIN (ECMA_BUILTIN_ID_SET_PROTOTYPE,
/* The Set routine (ECMA-262 v6, 23.1.1.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SET,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
set)
@@ -540,7 +540,7 @@ BUILTIN (ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE,
/* The WeakMap routine (ECMA-262 v6, 23.1.1.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKMAP,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
weakmap)
@@ -558,7 +558,7 @@ BUILTIN (ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE,
/* The WeakSet routine (ECMA-262 v6, 23.1.1.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKSET,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
weakset)
@@ -568,7 +568,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKSET,
#if ENABLED (JERRY_BUILTIN_PROXY)
/* The Proxy routine (ECMA-262 v6, 26.2.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROXY,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
proxy)
@@ -579,14 +579,14 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROXY,
/* Intrinsic hidden builtin object */
BUILTIN (ECMA_BUILTIN_ID_INTRINSIC_OBJECT,
ECMA_OBJECT_TYPE_GENERAL,
ECMA_BUILTIN_ID__COUNT,
ECMA_BUILTIN_ID__COUNT /* no prototype */,
true,
intrinsic)
/* The Array.prototype[@@unscopables] object */
BUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE_UNSCOPABLES,
ECMA_OBJECT_TYPE_GENERAL,
ECMA_BUILTIN_ID__COUNT,
ECMA_BUILTIN_ID__COUNT /* no prototype */,
true,
array_prototype_unscopables)
@@ -599,14 +599,14 @@ BUILTIN (ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE,
/* The Symbol routine (ECMA-262 v6, 19.4.2.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYMBOL,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
symbol)
/* The %AsyncFunction% object (ECMA-262 v11, 25.7.2) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ASYNC_FUNCTION,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION,
true,
async_function)
@@ -648,7 +648,7 @@ BUILTIN (ECMA_BUILTIN_ID_ASYNC_ITERATOR_PROTOTYPE,
/* The %(GeneratorFunction)% object */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_GENERATOR_FUNCTION,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION,
true,
generator_function)
@@ -669,7 +669,7 @@ BUILTIN (ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE,
/* The %(AsyncGeneratorFunction)% object */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION,
true,
async_generator_function)
@@ -718,7 +718,7 @@ BUILTIN (ECMA_BUILTIN_ID_BIGINT_PROTOTYPE,
/* The %BigInt% object */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGINT,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
bigint)
@@ -734,7 +734,7 @@ BUILTIN (ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE,
/* The DataView routine (ECMA-262 v6, 24.2.2.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATAVIEW,
ECMA_OBJECT_TYPE_FUNCTION,
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
true,
dataview)
@@ -53,7 +53,7 @@
enum
{
/* These routines must be in this order */
ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_START = 0,
ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_MAP,
ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE,
ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT,
@@ -1688,7 +1688,8 @@ ecma_builtin_typedarray_prototype_includes (ecma_typedarray_info_t *info_p, /**<
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_typedarray_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< routine identifier */
ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide
* routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
@@ -33,7 +33,7 @@
*/
enum
{
ECMA_CONTAINER_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
ECMA_CONTAINER_ROUTINE_START = 0,
ECMA_CONTAINER_ROUTINE_ADD,
ECMA_CONTAINER_ROUTINE_CLEAR,
ECMA_CONTAINER_ROUTINE_DELETE_WEAK,
+23 -110
View File
@@ -159,17 +159,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
if (JERRY_LIKELY (type == ECMA_OBJECT_TYPE_FUNCTION))
{
bool is_builtin = ecma_get_object_is_builtin (obj_p);
if (is_builtin)
{
if (ecma_builtin_function_is_routine (obj_p))
{
return ECMA_ERR_MSG ("Built-in routines are not constructors.");
}
return ECMA_IS_VALID_CONSTRUCTOR;
}
JERRY_ASSERT (!ecma_get_object_is_builtin (obj_p));
#if ENABLED (JERRY_ESNEXT)
const ecma_compiled_code_t *byte_code_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) obj_p);
@@ -231,9 +221,17 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
if (ecma_get_object_is_builtin (obj_p))
{
return ECMA_ERR_MSG ("Built-ins are not constructors.");
if (ecma_builtin_function_is_routine (obj_p))
{
return ECMA_ERR_MSG ("Built-in routines are not constructors.");
}
#if ENABLED (JERRY_ESNEXT)
JERRY_ASSERT (((ecma_extended_object_t *) obj_p)->u.built_in.id != ECMA_BUILTIN_ID_HANDLER);
#endif /* !ENABLED (JERRY_ESNEXT) */
}
return ECMA_IS_VALID_CONSTRUCTOR;
@@ -682,6 +680,7 @@ ecma_op_create_external_function_object (ecma_native_handler_t handler_cb) /**<
} /* ecma_op_create_external_function_object */
#if ENABLED (JERRY_ESNEXT)
/**
* Create built-in native handler object.
*
@@ -699,11 +698,13 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */
ecma_set_object_is_builtin (function_obj_p);
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) function_obj_p;
ext_func_obj_p->u.native_handler.id = id;
ext_func_obj_p->u.native_handler.flags = ECMA_NATIVE_HANDLER_FLAGS_NONE;
ext_func_obj_p->u.built_in.id = ECMA_BUILTIN_ID_HANDLER;
ext_func_obj_p->u.built_in.routine_id = (uint8_t) id;
ext_func_obj_p->u.built_in.u2.routine_flags = ECMA_NATIVE_HANDLER_FLAGS_NONE;
return function_obj_p;
} /* ecma_op_create_native_handler */
#endif /* ENABLED (JERRY_ESNEXT) */
/**
@@ -944,11 +945,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
uint32_t arguments_list_len) /**< length of arguments list */
{
JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION);
if (JERRY_UNLIKELY (ecma_get_object_is_builtin (func_obj_p)))
{
return ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
}
JERRY_ASSERT (!ecma_get_object_is_builtin (func_obj_p));
vm_frame_ctx_shared_args_t shared_args;
shared_args.header.status_flags = VM_FRAME_CTX_SHARED_HAS_ARG_LIST;
@@ -1093,13 +1090,10 @@ ecma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */
JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;
#if ENABLED (JERRY_ESNEXT)
if (ecma_get_object_is_builtin (func_obj_p))
{
ecma_native_handler_t handler = ecma_builtin_handler_get (ext_func_obj_p->u.native_handler.id);
return handler (ecma_make_object_value (func_obj_p), this_arg_value, arguments_list_p, arguments_list_len);
return ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
}
#endif /* ENABLED (JERRY_ESNEXT) */
JERRY_ASSERT (ext_func_obj_p->u.external_handler_cb != NULL);
ecma_value_t ret_value = ext_func_obj_p->u.external_handler_cb (ecma_make_object_value (func_obj_p),
@@ -1381,15 +1375,16 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
if (JERRY_UNLIKELY (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION))
{
if (JERRY_UNLIKELY (ecma_get_object_is_builtin (func_obj_p)))
{
return ecma_builtin_dispatch_construct (func_obj_p, new_target_p, arguments_list_p, arguments_list_len);
}
return ecma_op_function_construct_native (func_obj_p, new_target_p, arguments_list_p, arguments_list_len);
}
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_FUNCTION);
if (JERRY_UNLIKELY (ecma_get_object_is_builtin (func_obj_p)))
{
return ecma_builtin_dispatch_construct (func_obj_p, new_target_p, arguments_list_p, arguments_list_len);
}
JERRY_ASSERT (!ecma_get_object_is_builtin (func_obj_p));
ecma_object_t *new_this_obj_p = NULL;
ecma_value_t this_arg;
@@ -1688,57 +1683,6 @@ ecma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *objec
return NULL;
} /* ecma_op_external_function_try_to_lazy_instantiate_property */
#if ENABLED (JERRY_ESNEXT)
/**
* Create specification defined properties for built-in native handlers.
*
* @return pointer property, if one was instantiated,
* NULL - otherwise.
*/
ecma_property_t *
ecma_op_native_handler_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< object */
ecma_string_t *property_name_p) /**< property's name */
{
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION
&& ecma_get_object_is_builtin (object_p));
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
ecma_property_t *prop_p = NULL;
if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_NAME))
{
if ((ext_obj_p->u.native_handler.flags & ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED) == 0)
{
ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
property_name_p,
ECMA_PROPERTY_FLAG_CONFIGURABLE,
&prop_p);
value_p->value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
ext_obj_p->u.native_handler.flags |= ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED;
}
}
else if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH))
{
if ((ext_obj_p->u.native_handler.flags & ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED) == 0)
{
ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
property_name_p,
ECMA_PROPERTY_FLAG_CONFIGURABLE,
&prop_p);
const uint8_t length = ecma_builtin_handler_get_length (ext_obj_p->u.native_handler.id);
value_p->value = ecma_make_integer_value (length);
ext_obj_p->u.native_handler.flags |= ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED;
}
}
return prop_p;
} /* ecma_op_native_handler_try_to_lazy_instantiate_property */
#endif /* ENABLED (JERRY_ESNEXT) */
/**
* Create specification defined non-configurable properties for bound functions.
*
@@ -1915,37 +1859,6 @@ ecma_op_external_function_list_lazy_property_names (ecma_object_t *object_p, /**
}
} /* ecma_op_external_function_list_lazy_property_names */
#if ENABLED (JERRY_ESNEXT)
/**
* List names of an Built-in native handler object's lazy instantiated properties,
* adding them to corresponding string collections
*
* See also:
* ecma_op_native_handler_try_to_lazy_instantiate_property
*/
void
ecma_op_native_handler_list_lazy_property_names (ecma_object_t *object_p, /**< function object */
ecma_collection_t *prop_names_p, /**< prop name collection */
ecma_property_counter_t *prop_counter_p) /**< prop counter */
{
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION
&& ecma_get_object_is_builtin (object_p));
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
if ((ext_obj_p->u.native_handler.flags & ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED) == 0)
{
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_NAME));
prop_counter_p->string_named_props++;
}
if ((ext_obj_p->u.native_handler.flags & ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED) == 0)
{
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
prop_counter_p->string_named_props++;
}
} /* ecma_op_native_handler_list_lazy_property_names */
#endif /* ENABLED (JERRY_ESNEXT) */
/**
* List names of a Bound Function object's lazy instantiated properties,
* adding them to corresponding string collections
@@ -75,13 +75,6 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, const ecma_compile
ecma_object_t *
ecma_op_create_native_handler (ecma_native_handler_id_t id, size_t object_size);
ecma_property_t *
ecma_op_native_handler_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
void
ecma_op_native_handler_list_lazy_property_names (ecma_object_t *object_p,
ecma_collection_t *prop_names_p,
ecma_property_counter_t *prop_counter_p);
#endif /* ENABLED (JERRY_ESNEXT) */
ecma_object_t *
+4 -28
View File
@@ -241,16 +241,10 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
{
if (ecma_get_object_is_builtin (object_p))
{
if (type == ECMA_OBJECT_TYPE_FUNCTION && ecma_builtin_function_is_routine (object_p))
if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION && ecma_builtin_function_is_routine (object_p))
{
property_p = ecma_builtin_routine_try_to_instantiate_property (object_p, property_name_p);
}
#if ENABLED (JERRY_ESNEXT)
else if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION)
{
property_p = ecma_op_native_handler_try_to_lazy_instantiate_property (object_p, property_name_p);
}
#endif /* !ENABLED (JERRY_ESNEXT) */
else
{
property_p = ecma_builtin_try_to_instantiate_property (object_p, property_name_p);
@@ -586,16 +580,10 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
{
if (ecma_get_object_is_builtin (object_p))
{
if (type == ECMA_OBJECT_TYPE_FUNCTION && ecma_builtin_function_is_routine (object_p))
if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION && ecma_builtin_function_is_routine (object_p))
{
property_p = ecma_builtin_routine_try_to_instantiate_property (object_p, property_name_p);
}
#if ENABLED (JERRY_ESNEXT)
else if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION)
{
property_p = ecma_op_native_handler_try_to_lazy_instantiate_property (object_p, property_name_p);
}
#endif /* !ENABLED (JERRY_ESNEXT) */
else
{
property_p = ecma_builtin_try_to_instantiate_property (object_p, property_name_p);
@@ -1330,16 +1318,10 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
{
if (ecma_get_object_is_builtin (object_p))
{
if (type == ECMA_OBJECT_TYPE_FUNCTION && ecma_builtin_function_is_routine (object_p))
if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION && ecma_builtin_function_is_routine (object_p))
{
property_p = ecma_builtin_routine_try_to_instantiate_property (object_p, property_name_p);
}
#if ENABLED (JERRY_ESNEXT)
else if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION)
{
property_p = ecma_op_native_handler_try_to_lazy_instantiate_property (object_p, property_name_p);
}
#endif /* !ENABLED (JERRY_ESNEXT) */
else
{
property_p = ecma_builtin_try_to_instantiate_property (object_p, property_name_p);
@@ -2111,16 +2093,10 @@ ecma_object_list_lazy_property_names (ecma_object_t *obj_p, /**< object */
if (obj_is_builtin)
{
if (type == ECMA_OBJECT_TYPE_FUNCTION && ecma_builtin_function_is_routine (obj_p))
if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION && ecma_builtin_function_is_routine (obj_p))
{
ecma_builtin_routine_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
}
#if ENABLED (JERRY_ESNEXT)
else if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION)
{
ecma_op_native_handler_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
}
#endif /* !ENABLED (JERRY_ESNEXT) */
else
{
ecma_builtin_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);