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:
@@ -802,41 +802,42 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
|||||||
}
|
}
|
||||||
case ECMA_OBJECT_TYPE_FUNCTION:
|
case ECMA_OBJECT_TYPE_FUNCTION:
|
||||||
{
|
{
|
||||||
if (!ecma_get_object_is_builtin (object_p))
|
JERRY_ASSERT (!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;
|
||||||
ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
|
ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
|
||||||
ext_func_p->u.function.scope_cp));
|
ext_func_p->u.function.scope_cp));
|
||||||
|
|
||||||
#if ENABLED (JERRY_ESNEXT)
|
#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;
|
ecma_gc_set_object_visited (ecma_get_object_from_value (arrow_func_p->this_binding));
|
||||||
|
}
|
||||||
if (ecma_is_value_object (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->this_binding));
|
{
|
||||||
}
|
ecma_gc_set_object_visited (ecma_get_object_from_value (arrow_func_p->new_target));
|
||||||
|
|
||||||
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;
|
break;
|
||||||
}
|
}
|
||||||
#if ENABLED (JERRY_ESNEXT)
|
#if ENABLED (JERRY_ESNEXT)
|
||||||
case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:
|
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_RESOLVE:
|
||||||
case ECMA_NATIVE_HANDLER_PROMISE_REJECT:
|
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;
|
uint8_t length_and_bitset_size;
|
||||||
|
|
||||||
if (object_type == ECMA_OBJECT_TYPE_CLASS
|
if (object_type == ECMA_OBJECT_TYPE_CLASS || object_type == ECMA_OBJECT_TYPE_ARRAY)
|
||||||
|| object_type == ECMA_OBJECT_TYPE_ARRAY)
|
|
||||||
{
|
{
|
||||||
ext_object_size = sizeof (ecma_extended_built_in_object_t);
|
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;
|
length_and_bitset_size = ((ecma_extended_built_in_object_t *) object_p)->built_in.u.length_and_bitset_size;
|
||||||
ext_object_size += (2 * sizeof (uint32_t)) * (length_and_bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);
|
ext_object_size += sizeof (uint64_t) * (length_and_bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);
|
||||||
}
|
}
|
||||||
else
|
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;
|
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:
|
switch (ext_obj_p->u.built_in.routine_id)
|
||||||
case ECMA_NATIVE_HANDLER_PROMISE_REJECT:
|
|
||||||
{
|
{
|
||||||
ext_object_size = sizeof (ecma_promise_resolver_t);
|
case ECMA_NATIVE_HANDLER_PROMISE_RESOLVE:
|
||||||
break;
|
case ECMA_NATIVE_HANDLER_PROMISE_REJECT:
|
||||||
}
|
{
|
||||||
case ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY:
|
ext_object_size = sizeof (ecma_promise_resolver_t);
|
||||||
case ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY:
|
break;
|
||||||
{
|
}
|
||||||
ext_object_size = sizeof (ecma_promise_finally_function_t);
|
case ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY:
|
||||||
break;
|
case ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY:
|
||||||
}
|
{
|
||||||
case ECMA_NATIVE_HANDLER_PROMISE_CAPABILITY_EXECUTOR:
|
ext_object_size = sizeof (ecma_promise_finally_function_t);
|
||||||
{
|
break;
|
||||||
ext_object_size = sizeof (ecma_promise_capability_executor_t);
|
}
|
||||||
break;
|
case ECMA_NATIVE_HANDLER_PROMISE_CAPABILITY_EXECUTOR:
|
||||||
}
|
{
|
||||||
case ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER:
|
ext_object_size = sizeof (ecma_promise_capability_executor_t);
|
||||||
{
|
break;
|
||||||
ext_object_size = sizeof (ecma_promise_all_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)
|
#if ENABLED (JERRY_BUILTIN_PROXY)
|
||||||
case ECMA_NATIVE_HANDLER_PROXY_REVOKE:
|
case ECMA_NATIVE_HANDLER_PROXY_REVOKE:
|
||||||
{
|
{
|
||||||
ext_object_size = sizeof (ecma_revocable_proxy_object_t);
|
ext_object_size = sizeof (ecma_revocable_proxy_object_t);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
|
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
|
||||||
case ECMA_NATIVE_HANDLER_VALUE_THUNK:
|
case ECMA_NATIVE_HANDLER_VALUE_THUNK:
|
||||||
case ECMA_NATIVE_HANDLER_VALUE_THROWER:
|
case ECMA_NATIVE_HANDLER_VALUE_THROWER:
|
||||||
{
|
{
|
||||||
ecma_free_value_if_not_object (((ecma_promise_value_thunk_t *) object_p)->value);
|
ecma_free_value_if_not_object (((ecma_promise_value_thunk_t *) object_p)->value);
|
||||||
ext_object_size = sizeof (ecma_promise_value_thunk_t);
|
ext_object_size = sizeof (ecma_promise_value_thunk_t);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
JERRY_UNREACHABLE ();
|
JERRY_UNREACHABLE ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
|
||||||
{
|
{
|
||||||
length_and_bitset_size = ((ecma_extended_object_t *) object_p)->u.built_in.length_and_bitset_size;
|
length_and_bitset_size = ((ecma_extended_object_t *) object_p)->u.built_in.u.length_and_bitset_size;
|
||||||
ext_object_size += (2 * sizeof (uint32_t)) * (length_and_bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);
|
ext_object_size += sizeof (uint64_t) * (length_and_bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
ecma_gc_free_properties (object_p);
|
ecma_gc_free_properties (object_p);
|
||||||
|
|||||||
@@ -851,20 +851,27 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t id; /**< built-in id */
|
uint8_t id; /**< built-in id */
|
||||||
uint8_t length_and_bitset_size; /**< length for built-in functions and
|
uint8_t routine_id; /**< routine id for built-in functions */
|
||||||
* bit set size for all built-ins */
|
/** built-in specific field */
|
||||||
uint16_t routine_id; /**< routine id for built-in functions */
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
uint32_t instantiated_bitset[1]; /**< bit set for instantiated properties */
|
uint8_t length_and_bitset_size; /**< length and bit set size for generic built-ins */
|
||||||
struct
|
uint8_t routine_index; /**< property descriptor index for built-in routines */
|
||||||
{
|
|
||||||
uint16_t name; /**< name of the built-in functions */
|
|
||||||
uint16_t bitset; /**< bit set for instantiated properties of builtin functions */
|
|
||||||
} builtin_routine;
|
|
||||||
} u;
|
} 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;
|
} 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
|
* 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 */
|
ecma_value_t args_len_or_this; /**< length of arguments or this value */
|
||||||
} bound_function;
|
} 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 */
|
ecma_native_handler_t external_handler_cb; /**< external function */
|
||||||
} u;
|
} u;
|
||||||
} ecma_extended_object_t;
|
} ecma_extended_object_t;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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 */
|
/* Note: these 2 routine ids must be in this order */
|
||||||
#if !ENABLED (JERRY_ESNEXT)
|
#if !ENABLED (JERRY_ESNEXT)
|
||||||
ECMA_ARRAY_PROTOTYPE_TO_STRING,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_array_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
uint32_t arguments_number) /**< length of arguments' list */
|
uint32_t arguments_number) /**< length of arguments' list */
|
||||||
{
|
{
|
||||||
ecma_value_t obj_this = ecma_op_to_object (this_arg);
|
ecma_value_t obj_this = ecma_op_to_object (this_arg);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ECMA_ARRAY_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
|
ECMA_ARRAY_ROUTINE_START = 0,
|
||||||
ECMA_ARRAY_ROUTINE_IS_ARRAY,
|
ECMA_ARRAY_ROUTINE_IS_ARRAY,
|
||||||
#if ENABLED (JERRY_ESNEXT)
|
#if ENABLED (JERRY_ESNEXT)
|
||||||
ECMA_ARRAY_ROUTINE_FROM,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_array_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_array_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_NEXT,
|
||||||
ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_THROW,
|
ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_THROW,
|
||||||
ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_RETURN
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_async_generator_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_async_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||||
* identifier */
|
* identifier */
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to
|
* passed to
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_TO_STRING,
|
||||||
ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_boolean_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_boolean_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||||
* identifier */
|
* identifier */
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_BUFFER_GETTER,
|
||||||
ECMA_DATAVIEW_PROTOTYPE_BYTE_LENGTH_GETTER,
|
ECMA_DATAVIEW_PROTOTYPE_BYTE_LENGTH_GETTER,
|
||||||
ECMA_DATAVIEW_PROTOTYPE_BYTE_OFFSET_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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
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 */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_FULL_YEAR, /* ECMA-262 v5 15.9.5.10 */
|
||||||
ECMA_DATE_PROTOTYPE_GET_UTC_FULL_YEAR, /* ECMA-262 v5 15.9.5.11 */
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_date_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||||
* identifier */
|
* identifier */
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list[], /**< list of arguments
|
const ecma_value_t arguments_list[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_TO_STRING,
|
||||||
ECMA_FUNCTION_PROTOTYPE_CALL,
|
ECMA_FUNCTION_PROTOTYPE_CALL,
|
||||||
ECMA_FUNCTION_PROTOTYPE_APPLY,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_function_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_function_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
uint32_t arguments_number) /**< length of arguments' list */
|
uint32_t arguments_number) /**< length of arguments' list */
|
||||||
{
|
{
|
||||||
if (!ecma_op_is_callable (this_arg))
|
if (!ecma_op_is_callable (this_arg))
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_NEXT,
|
||||||
ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW,
|
ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW,
|
||||||
ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_generator_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||||
* identifier */
|
* identifier */
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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 */
|
/* Note: these 5 routine ids must be in this order */
|
||||||
ECMA_GLOBAL_IS_NAN,
|
ECMA_GLOBAL_IS_NAN,
|
||||||
ECMA_GLOBAL_IS_FINITE,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
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 */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ static const uint8_t ecma_native_handler_lengths[] =
|
|||||||
ecma_native_handler_t
|
ecma_native_handler_t
|
||||||
ecma_builtin_handler_get (ecma_native_handler_id_t id) /**< handler id */
|
ecma_builtin_handler_get (ecma_native_handler_id_t id) /**< handler id */
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (id < ECMA_NATIVE_HANDLER__COUNT);
|
JERRY_ASSERT (id != ECMA_NATIVE_HANDLER_START && id < ECMA_NATIVE_HANDLER__COUNT);
|
||||||
return ecma_native_handlers[id];
|
return ecma_native_handlers[id - 1];
|
||||||
} /* ecma_builtin_handler_get */
|
} /* ecma_builtin_handler_get */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,8 +54,8 @@ ecma_builtin_handler_get (ecma_native_handler_id_t id) /**< handler id */
|
|||||||
uint8_t
|
uint8_t
|
||||||
ecma_builtin_handler_get_length (ecma_native_handler_id_t id) /**< handler id */
|
ecma_builtin_handler_get_length (ecma_native_handler_id_t id) /**< handler id */
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (id < ECMA_NATIVE_HANDLER__COUNT);
|
JERRY_ASSERT (id != ECMA_NATIVE_HANDLER_START && id < ECMA_NATIVE_HANDLER__COUNT);
|
||||||
return ecma_native_handler_lengths[id];
|
return ecma_native_handler_lengths[id - 1];
|
||||||
} /* ecma_builtin_handler_get_length */
|
} /* ecma_builtin_handler_get_length */
|
||||||
|
|
||||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
ECMA_NATIVE_HANDLER_START = 0,
|
||||||
#define ECMA_NATIVE_HANDLER(id, handler, length) id,
|
#define ECMA_NATIVE_HANDLER(id, handler, length) id,
|
||||||
#include "ecma-builtin-handlers.inc.h"
|
#include "ecma-builtin-handlers.inc.h"
|
||||||
#undef ECMA_NATIVE_HANDLER
|
#undef ECMA_NATIVE_HANDLER
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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) \
|
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
|
||||||
ECMA_ROUTINE_ ## name ## c_function_name,
|
ECMA_ROUTINE_ ## name ## c_function_name,
|
||||||
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
|
#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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
DISPATCH_ROUTINE_ROUTINE_NAME (uint16_t builtin_routine_id, /**< built-in wide routine
|
DISPATCH_ROUTINE_ROUTINE_NAME (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||||
identifier */
|
identifier */
|
||||||
ecma_value_t this_arg_value, /**< 'this' argument
|
ecma_value_t this_arg_value, /**< 'this' argument
|
||||||
value */
|
value */
|
||||||
const ecma_value_t arguments_list[], /**< list of arguments
|
const ecma_value_t arguments_list[], /**< list of arguments
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ECMA_INTRINSIC_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
|
ECMA_INTRINSIC_ROUTINE_START = 0,
|
||||||
ECMA_INTRINSIC_ARRAY_PROTOTYPE_VALUES,
|
ECMA_INTRINSIC_ARRAY_PROTOTYPE_VALUES,
|
||||||
ECMA_INTRINSIC_TYPEDARRAY_PROTOTYPE_VALUES,
|
ECMA_INTRINSIC_TYPEDARRAY_PROTOTYPE_VALUES,
|
||||||
ECMA_INTRINSIC_MAP_PROTOTYPE_ENTRIES,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
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 */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -45,8 +45,7 @@
|
|||||||
* Returned value must be freed with ecma_free_value.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_map_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_map_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_ABS, /* ECMA-262 v5, 15.8.2.1 */
|
||||||
ECMA_MATH_OBJECT_ACOS, /* ECMA-262 v5, 15.8.2.2 */
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_math_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list[], /**< list of arguments
|
const ecma_value_t arguments_list[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_VALUE_OF,
|
||||||
ECMA_NUMBER_PROTOTYPE_TO_STRING,
|
ECMA_NUMBER_PROTOTYPE_TO_STRING,
|
||||||
ECMA_NUMBER_PROTOTYPE_TO_LOCALE_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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_number_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_number_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
uint32_t arguments_number) /**< length of arguments' list */
|
uint32_t arguments_number) /**< length of arguments' list */
|
||||||
{
|
{
|
||||||
ecma_value_t this_value = ecma_builtin_number_prototype_object_value_of (this_arg);
|
ecma_value_t this_value = ecma_builtin_number_prototype_object_value_of (this_arg);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_FINITE,
|
||||||
ECMA_NUMBER_OBJECT_ROUTINE_IS_NAN,
|
ECMA_NUMBER_OBJECT_ROUTINE_IS_NAN,
|
||||||
ECMA_NUMBER_OBJECT_ROUTINE_IS_INTEGER,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_number_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_number_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
/* Note: these 6 routines must be in this order */
|
/* 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_TO_STRING,
|
||||||
ECMA_OBJECT_PROTOTYPE_VALUE_OF,
|
ECMA_OBJECT_PROTOTYPE_VALUE_OF,
|
||||||
ECMA_OBJECT_PROTOTYPE_TO_LOCALE_STRING,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_object_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_object_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||||
* identifier */
|
* identifier */
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
uint32_t arguments_number) /**< length of arguments' list */
|
uint32_t arguments_number) /**< length of arguments' list */
|
||||||
{
|
{
|
||||||
JERRY_UNUSED (arguments_number);
|
JERRY_UNUSED (arguments_number);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ECMA_OBJECT_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
|
ECMA_OBJECT_ROUTINE_START = 0,
|
||||||
|
|
||||||
ECMA_OBJECT_ROUTINE_CREATE,
|
ECMA_OBJECT_ROUTINE_CREATE,
|
||||||
ECMA_OBJECT_ROUTINE_IS,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_object_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_THEN,
|
||||||
ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH,
|
ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH,
|
||||||
ECMA_PROMISE_PROTOTYPE_ROUTINE_FINALLY
|
ECMA_PROMISE_PROTOTYPE_ROUTINE_FINALLY
|
||||||
@@ -58,8 +58,7 @@ enum
|
|||||||
* Returned value must be freed with ecma_free_value.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_promise_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_promise_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ECMA_PROMISE_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
|
ECMA_PROMISE_ROUTINE_START = 0,
|
||||||
ECMA_PROMISE_ROUTINE_REJECT,
|
ECMA_PROMISE_ROUTINE_REJECT,
|
||||||
ECMA_PROMISE_ROUTINE_RESOLVE,
|
ECMA_PROMISE_ROUTINE_RESOLVE,
|
||||||
ECMA_PROMISE_ROUTINE_RACE,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_promise_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_promise_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||||
* identifier */
|
* identifier */
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
uint32_t arguments_number) /**< length of arguments' list */
|
uint32_t arguments_number) /**< length of arguments' list */
|
||||||
{
|
{
|
||||||
ecma_value_t argument = (arguments_number > 0) ? arguments_list_p[0] : ECMA_VALUE_UNDEFINED;
|
ecma_value_t argument = (arguments_number > 0) ? arguments_list_p[0] : ECMA_VALUE_UNDEFINED;
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_GET, /* ECMA-262 v6, 26.1.6 */
|
||||||
ECMA_REFLECT_OBJECT_SET, /* ECMA-262 v6, 26.1.13 */
|
ECMA_REFLECT_OBJECT_SET, /* ECMA-262 v6, 26.1.13 */
|
||||||
ECMA_REFLECT_OBJECT_HAS, /* ECMA-262 v6, 26.1.9 */
|
ECMA_REFLECT_OBJECT_HAS, /* ECMA-262 v6, 26.1.9 */
|
||||||
@@ -77,8 +77,7 @@ enum
|
|||||||
* Returned value must be freed with ecma_free_value.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_reflect_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list[], /**< list of arguments
|
const ecma_value_t arguments_list[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
/** These routines must be in this order */
|
/** 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,
|
ECMA_REGEXP_PROTOTYPE_ROUTINE_EXEC,
|
||||||
#if ENABLED (JERRY_BUILTIN_ANNEXB)
|
#if ENABLED (JERRY_BUILTIN_ANNEXB)
|
||||||
ECMA_REGEXP_PROTOTYPE_ROUTINE_COMPILE,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_regexp_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -44,8 +44,7 @@
|
|||||||
* Returned value must be freed with ecma_free_value.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_set_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_set_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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 */
|
/* Note: These 4 routines MUST be in this order */
|
||||||
ECMA_STRING_PROTOTYPE_TO_STRING,
|
ECMA_STRING_PROTOTYPE_TO_STRING,
|
||||||
ECMA_STRING_PROTOTYPE_VALUE_OF,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_string_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_string_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||||
* identifier */
|
* identifier */
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
uint32_t arguments_number) /**< length of arguments' list */
|
uint32_t arguments_number) /**< length of arguments' list */
|
||||||
{
|
{
|
||||||
if (builtin_routine_id <= ECMA_STRING_PROTOTYPE_VALUE_OF)
|
if (builtin_routine_id <= ECMA_STRING_PROTOTYPE_VALUE_OF)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
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_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_PRIMITIVE, /**< ECMA-262 v11, 19.4.3.5 */
|
||||||
ECMA_SYMBOL_PROTOTYPE_TO_STRING, /**< ECMA-262 v11, 19.4.3.3 */
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_symbol_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_symbol_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list[], /**< list of arguments
|
const ecma_value_t arguments_list[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
uint32_t arguments_number) /**< length of arguments' list */
|
uint32_t arguments_number) /**< length of arguments' list */
|
||||||
{
|
{
|
||||||
JERRY_UNUSED_2 (arguments_list, arguments_number);
|
JERRY_UNUSED_2 (arguments_list, arguments_number);
|
||||||
|
|||||||
@@ -44,8 +44,7 @@
|
|||||||
* Returned value must be freed with ecma_free_value.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_weakmap_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_weakmap_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||||
* identifier */
|
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -45,8 +45,8 @@
|
|||||||
* Returned value must be freed with ecma_free_value.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
ecma_value_t
|
||||||
ecma_builtin_weakset_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
|
ecma_builtin_weakset_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||||
* identifier */
|
* identifier */
|
||||||
ecma_value_t this_arg, /**< 'this' argument value */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ ecma_value_t \
|
|||||||
ecma_builtin_ ## lowercase_name ## _dispatch_construct (const ecma_value_t *, \
|
ecma_builtin_ ## lowercase_name ## _dispatch_construct (const ecma_value_t *, \
|
||||||
uint32_t); \
|
uint32_t); \
|
||||||
ecma_value_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, \
|
ecma_value_t this_arg_value, \
|
||||||
const ecma_value_t [], \
|
const ecma_value_t [], \
|
||||||
uint32_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 \
|
extern const ecma_builtin_property_descriptor_t \
|
||||||
ecma_builtin_ ## lowercase_name ## _property_descriptor_list[]; \
|
ecma_builtin_ ## lowercase_name ## _property_descriptor_list[]; \
|
||||||
ecma_value_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, \
|
ecma_value_t this_arg_value, \
|
||||||
const ecma_value_t [], \
|
const ecma_value_t [], \
|
||||||
uint32_t);
|
uint32_t);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ typedef const ecma_builtin_property_descriptor_t *ecma_builtin_property_list_ref
|
|||||||
/**
|
/**
|
||||||
* Definition of built-in dispatch routine function pointer.
|
* 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,
|
ecma_value_t this_arg,
|
||||||
const ecma_value_t arguments_list[],
|
const ecma_value_t arguments_list[],
|
||||||
uint32_t arguments_number);
|
uint32_t arguments_number);
|
||||||
@@ -329,11 +329,11 @@ ecma_builtin_get_global (void)
|
|||||||
inline bool JERRY_ATTR_ALWAYS_INLINE
|
inline bool JERRY_ATTR_ALWAYS_INLINE
|
||||||
ecma_builtin_function_is_routine (ecma_object_t *func_obj_p) /**< function object */
|
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));
|
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;
|
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 */
|
} /* 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);
|
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.
|
/* Only 64 extra properties supported at the moment.
|
||||||
* This can be extended to 256 later. */
|
* 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);
|
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->id = (uint8_t) obj_builtin_id;
|
||||||
built_in_props_p->routine_id = (uint16_t) obj_builtin_id;
|
built_in_props_p->routine_id = 0;
|
||||||
built_in_props_p->u.instantiated_bitset[0] = 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[1] = 0;
|
||||||
instantiated_bitset_p[2] = 0;
|
instantiated_bitset_p[2] = 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
built_in_props_p->length_and_bitset_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Initializing [[PrimitiveValue]] properties of built-in prototype objects */
|
/** Initializing [[PrimitiveValue]] properties of built-in prototype objects */
|
||||||
switch (obj_builtin_id)
|
switch (obj_builtin_id)
|
||||||
@@ -569,33 +567,29 @@ ecma_finalize_builtins (void)
|
|||||||
*/
|
*/
|
||||||
static ecma_object_t *
|
static ecma_object_t *
|
||||||
ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**< identifier of built-in object */
|
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
|
uint8_t routine_id, /**< builtin-wide identifier of the built-in
|
||||||
* object's routine property */
|
* object's routine property */
|
||||||
uint16_t name_id, /**< magic string id of 'name' property */
|
uint32_t routine_index, /**< property descriptor index of routine */
|
||||||
uint16_t flags, /**< see also: ecma_builtin_routine_flags */
|
uint8_t flags) /**< see also: ecma_builtin_routine_flags */
|
||||||
uint8_t length_prop_value) /**< value of 'length' property */
|
|
||||||
{
|
{
|
||||||
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);
|
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
|
||||||
|
|
||||||
size_t ext_object_size = sizeof (ecma_extended_object_t);
|
size_t ext_object_size = sizeof (ecma_extended_object_t);
|
||||||
|
|
||||||
ecma_object_t *func_obj_p = ecma_create_object (prototype_obj_p,
|
ecma_object_t *func_obj_p = ecma_create_object (prototype_obj_p,
|
||||||
ext_object_size,
|
ext_object_size,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION);
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
|
||||||
|
|
||||||
ecma_set_object_is_builtin (func_obj_p);
|
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;
|
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.id = (uint8_t) builtin_id;
|
||||||
ext_func_obj_p->u.built_in.routine_id = routine_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.routine_index = (uint8_t) routine_index;
|
||||||
ext_func_obj_p->u.built_in.u.builtin_routine.bitset = flags;
|
ext_func_obj_p->u.built_in.u2.routine_flags = flags;
|
||||||
|
|
||||||
ext_func_obj_p->u.built_in.length_and_bitset_size = length_prop_value;
|
|
||||||
|
|
||||||
return func_obj_p;
|
return func_obj_p;
|
||||||
} /* ecma_builtin_make_function_object_for_routine */
|
} /* 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 *
|
static ecma_object_t *
|
||||||
ecma_builtin_make_function_object_for_getter_accessor (ecma_builtin_id_t builtin_id, /**< id of built-in object */
|
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 */
|
* 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,
|
return ecma_builtin_make_function_object_for_routine (builtin_id,
|
||||||
routine_id,
|
routine_id,
|
||||||
name_id,
|
routine_index,
|
||||||
ECMA_BUILTIN_ROUTINE_GETTER,
|
ECMA_BUILTIN_ROUTINE_GETTER);
|
||||||
0);
|
|
||||||
} /* ecma_builtin_make_function_object_for_getter_accessor */
|
} /* 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 *
|
static ecma_object_t *
|
||||||
ecma_builtin_make_function_object_for_setter_accessor (ecma_builtin_id_t builtin_id, /**< id of built-in object */
|
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 */
|
* 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,
|
return ecma_builtin_make_function_object_for_routine (builtin_id,
|
||||||
routine_id,
|
routine_id,
|
||||||
name_id,
|
routine_index,
|
||||||
ECMA_BUILTIN_ROUTINE_SETTER,
|
ECMA_BUILTIN_ROUTINE_SETTER);
|
||||||
1);
|
|
||||||
} /* ecma_builtin_make_function_object_for_setter_accessor */
|
} /* 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
|
* 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 */
|
ecma_string_t *string_p) /**< property's name */
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (ecma_get_object_is_builtin (object_p));
|
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));
|
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))
|
if (ecma_string_is_length (string_p))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Lazy instantiation of 'length' property
|
* Lazy instantiation of 'length' property
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ecma_property_t *len_prop_p;
|
ecma_property_t *len_prop_p;
|
||||||
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
|
|
||||||
#if ENABLED (JERRY_ESNEXT)
|
#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)
|
if (*bitset_p & ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED)
|
||||||
{
|
{
|
||||||
/* length property was already instantiated */
|
/* length property was already instantiated */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We mark that the property was lazily instantiated,
|
/* We mark that the property was lazily instantiated,
|
||||||
* as it is configurable and so can be deleted (ECMA-262 v6, 19.2.4.1) */
|
* as it is configurable and so can be deleted (ECMA-262 v6, 19.2.4.1) */
|
||||||
*bitset_p |= ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED;
|
*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);
|
&len_prop_p);
|
||||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||||
|
|
||||||
uint8_t length = ext_func_p->u.built_in.length_and_bitset_size;
|
uint8_t length = 0;
|
||||||
JERRY_ASSERT (length < (1 << ECMA_BUILT_IN_BITSET_SHIFT));
|
|
||||||
|
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);
|
len_prop_value_p->value = ecma_make_integer_value (length);
|
||||||
|
|
||||||
return len_prop_p;
|
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))
|
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;
|
uint8_t *bitset_p = &ext_func_p->u.built_in.u2.routine_flags;
|
||||||
uint16_t *bitset_p = &ext_func_p->u.built_in.u.builtin_routine.bitset;
|
|
||||||
|
|
||||||
if (*bitset_p & ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED)
|
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,
|
ECMA_PROPERTY_FLAG_CONFIGURABLE,
|
||||||
&name_prop_p);
|
&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;
|
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))
|
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 index = (uint32_t) (curr_property_p - property_list_p);
|
||||||
|
uint8_t *bitset_p = built_in_props_p->u2.instantiated_bitset + (index >> 3);
|
||||||
uint32_t *bitset_p = built_in_props_p->u.instantiated_bitset + (index >> 5);
|
uint8_t bit_for_index = (uint8_t) (1u << (index & 0x7));
|
||||||
|
|
||||||
uint32_t bit_for_index = (uint32_t) (1u << (index & 0x1f));
|
|
||||||
|
|
||||||
if (*bitset_p & bit_for_index)
|
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;
|
ecma_object_t *func_obj_p;
|
||||||
func_obj_p = ecma_builtin_make_function_object_for_routine (builtin_id,
|
func_obj_p = ecma_builtin_make_function_object_for_routine (builtin_id,
|
||||||
ECMA_GET_ROUTINE_ID (curr_property_p->value),
|
ECMA_GET_ROUTINE_ID (curr_property_p->value),
|
||||||
curr_property_p->magic_string_id,
|
index,
|
||||||
ECMA_BUILTIN_ROUTINE_NO_OPTS,
|
ECMA_BUILTIN_ROUTINE_NO_OPTS);
|
||||||
ECMA_GET_ROUTINE_LENGTH (curr_property_p->value));
|
|
||||||
value = ecma_make_object_value (func_obj_p);
|
value = ecma_make_object_value (func_obj_p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE:
|
case ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE:
|
||||||
{
|
{
|
||||||
is_accessor = true;
|
is_accessor = true;
|
||||||
uint16_t getter_id = ECMA_ACCESSOR_READ_WRITE_GET_GETTER_ID (curr_property_p->value);
|
uint8_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);
|
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_p = ecma_builtin_make_function_object_for_getter_accessor (builtin_id, getter_id, index);
|
||||||
getter_id,
|
setter_p = ecma_builtin_make_function_object_for_setter_accessor (builtin_id, setter_id, index);
|
||||||
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);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
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);
|
JERRY_ASSERT (curr_property_p->type == ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY);
|
||||||
|
|
||||||
is_accessor = true;
|
is_accessor = true;
|
||||||
getter_p = ecma_builtin_make_function_object_for_getter_accessor (builtin_id,
|
uint8_t getter_id = (uint8_t) curr_property_p->value;
|
||||||
curr_property_p->value,
|
getter_p = ecma_builtin_make_function_object_for_getter_accessor (builtin_id, getter_id, index);
|
||||||
curr_property_p->magic_string_id);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1035,6 +1106,36 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
|
|||||||
return prop_p;
|
return prop_p;
|
||||||
} /* ecma_builtin_try_to_instantiate_property */
|
} /* 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
|
* 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 */
|
ecma_property_counter_t *prop_counter_p) /**< prop counter */
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (ecma_get_object_is_builtin (object_p));
|
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));
|
JERRY_ASSERT (ecma_builtin_function_is_routine (object_p));
|
||||||
|
|
||||||
#if ENABLED (JERRY_ESNEXT)
|
#if ENABLED (JERRY_ESNEXT)
|
||||||
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;
|
||||||
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) */
|
/* 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));
|
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
|
||||||
prop_counter_p->string_named_props++;
|
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) */
|
/* 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));
|
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];
|
const ecma_builtin_property_descriptor_t *curr_property_p = ecma_builtin_property_list_references[builtin_id];
|
||||||
|
|
||||||
uint32_t index = 0;
|
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)
|
while (curr_property_p->magic_string_id != LIT_MAGIC_STRING__COUNT)
|
||||||
{
|
{
|
||||||
if (index == 32)
|
if (index == 8)
|
||||||
{
|
{
|
||||||
bitset_p++;
|
bitset_p++;
|
||||||
index = 0;
|
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 */
|
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||||
uint32_t arguments_list_len) /**< arguments list length */
|
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));
|
JERRY_ASSERT (ecma_get_object_is_builtin (obj_p));
|
||||||
|
|
||||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||||
|
|
||||||
if (ecma_builtin_function_is_routine (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,
|
return ecma_builtin_dispatch_routine (ext_obj_p,
|
||||||
this_arg_value,
|
this_arg_value,
|
||||||
arguments_list_p,
|
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 */
|
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||||
uint32_t arguments_list_len) /**< arguments list length */
|
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));
|
JERRY_ASSERT (ecma_get_object_is_builtin (obj_p));
|
||||||
|
|
||||||
if (ecma_builtin_function_is_routine (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__COUNT /**< number of built-in objects */
|
||||||
} ecma_builtin_id_t;
|
} 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
|
* Construct a routine value
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +71,7 @@ typedef enum
|
|||||||
/**
|
/**
|
||||||
* Get routine ID
|
* 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
|
* Construct a fully accessor value
|
||||||
@@ -71,12 +81,12 @@ typedef enum
|
|||||||
/**
|
/**
|
||||||
* Get accessor setter ID
|
* 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
|
* 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 */
|
/* ecma-builtins.c */
|
||||||
void ecma_finalize_builtins (void);
|
void ecma_finalize_builtins (void);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ BUILTIN (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
|
|||||||
|
|
||||||
/* The Object object (15.2.1) */
|
/* The Object object (15.2.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_OBJECT,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_OBJECT,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
object)
|
object)
|
||||||
@@ -40,7 +40,7 @@ BUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE,
|
|||||||
|
|
||||||
/* The Array object (15.4.1) */
|
/* The Array object (15.4.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
array)
|
array)
|
||||||
@@ -94,7 +94,7 @@ BUILTIN (ECMA_BUILTIN_ID_STRING_PROTOTYPE,
|
|||||||
|
|
||||||
/* The String object (15.5.1) */
|
/* The String object (15.5.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_STRING,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_STRING,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
string)
|
string)
|
||||||
@@ -110,7 +110,7 @@ BUILTIN (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE,
|
|||||||
|
|
||||||
/* The Boolean object (15.6.1) */
|
/* The Boolean object (15.6.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BOOLEAN,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BOOLEAN,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
boolean)
|
boolean)
|
||||||
@@ -126,7 +126,7 @@ BUILTIN (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE,
|
|||||||
|
|
||||||
/* The Number object (15.7.1) */
|
/* The Number object (15.7.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_NUMBER,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_NUMBER,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
number)
|
number)
|
||||||
@@ -134,14 +134,14 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_NUMBER,
|
|||||||
|
|
||||||
/* The Function.prototype object (15.3.4) */
|
/* The Function.prototype object (15.3.4) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
|
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
function_prototype)
|
function_prototype)
|
||||||
|
|
||||||
/* The Function object (15.3.1) */
|
/* The Function object (15.3.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
function)
|
function)
|
||||||
@@ -177,7 +177,7 @@ BUILTIN (ECMA_BUILTIN_ID_JSON,
|
|||||||
#if ENABLED (JERRY_BUILTIN_DATE)
|
#if ENABLED (JERRY_BUILTIN_DATE)
|
||||||
/* The Date object (15.9.3) */
|
/* The Date object (15.9.3) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATE,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATE,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
date)
|
date)
|
||||||
@@ -186,7 +186,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATE,
|
|||||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||||
/* The RegExp object (15.10) */
|
/* The RegExp object (15.10) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REGEXP,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REGEXP,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
regexp)
|
regexp)
|
||||||
@@ -200,7 +200,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REGEXP,
|
|||||||
|
|
||||||
/* The Error object (15.11.1) */
|
/* The Error object (15.11.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ERROR,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ERROR,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
error)
|
error)
|
||||||
@@ -222,7 +222,7 @@ BUILTIN (ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE,
|
|||||||
|
|
||||||
/* The EvalError object (15.11.6.1) */
|
/* The EvalError object (15.11.6.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_EVAL_ERROR,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_EVAL_ERROR,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
||||||
true,
|
true,
|
||||||
eval_error)
|
eval_error)
|
||||||
@@ -236,7 +236,7 @@ BUILTIN (ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE,
|
|||||||
|
|
||||||
/* The RangeError object (15.11.6.2) */
|
/* The RangeError object (15.11.6.2) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_RANGE_ERROR,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_RANGE_ERROR,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
||||||
true,
|
true,
|
||||||
range_error)
|
range_error)
|
||||||
@@ -250,7 +250,7 @@ BUILTIN (ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE,
|
|||||||
|
|
||||||
/* The ReferenceError object (15.11.6.3) */
|
/* The ReferenceError object (15.11.6.3) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REFERENCE_ERROR,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REFERENCE_ERROR,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
||||||
true,
|
true,
|
||||||
reference_error)
|
reference_error)
|
||||||
@@ -264,7 +264,7 @@ BUILTIN (ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE,
|
|||||||
|
|
||||||
/* The SyntaxError object (15.11.6.4) */
|
/* The SyntaxError object (15.11.6.4) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYNTAX_ERROR,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYNTAX_ERROR,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
||||||
true,
|
true,
|
||||||
syntax_error)
|
syntax_error)
|
||||||
@@ -278,7 +278,7 @@ BUILTIN (ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE,
|
|||||||
|
|
||||||
/* The TypeError object (15.11.6.5) */
|
/* The TypeError object (15.11.6.5) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
||||||
true,
|
true,
|
||||||
type_error)
|
type_error)
|
||||||
@@ -292,7 +292,7 @@ BUILTIN (ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE,
|
|||||||
|
|
||||||
/* The URIError object (15.11.6.6) */
|
/* The URIError object (15.11.6.6) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_URI_ERROR,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_URI_ERROR,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,
|
||||||
true,
|
true,
|
||||||
uri_error)
|
uri_error)
|
||||||
@@ -300,7 +300,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_URI_ERROR,
|
|||||||
|
|
||||||
/**< The [[ThrowTypeError]] object (13.2.3) */
|
/**< The [[ThrowTypeError]] object (13.2.3) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
false,
|
false,
|
||||||
type_error_thrower)
|
type_error_thrower)
|
||||||
@@ -316,7 +316,7 @@ BUILTIN (ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE,
|
|||||||
|
|
||||||
/* The ArrayBuffer object (ES2015 24.1.2) */
|
/* The ArrayBuffer object (ES2015 24.1.2) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAYBUFFER,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAYBUFFER,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
arraybuffer)
|
arraybuffer)
|
||||||
@@ -331,62 +331,62 @@ BUILTIN (ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,
|
|||||||
/* The %TypedArray% intrinsic object (ES2015 22.2.1)
|
/* The %TypedArray% intrinsic object (ES2015 22.2.1)
|
||||||
Note: The routines must be in this order. */
|
Note: The routines must be in this order. */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPEDARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
typedarray)
|
typedarray)
|
||||||
|
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT8ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT8ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
int8array)
|
int8array)
|
||||||
|
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
uint8array)
|
uint8array)
|
||||||
|
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
uint8clampedarray)
|
uint8clampedarray)
|
||||||
|
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT16ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT16ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
int16array)
|
int16array)
|
||||||
|
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT16ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT16ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
uint16array)
|
uint16array)
|
||||||
|
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT32ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT32ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
int32array)
|
int32array)
|
||||||
|
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT32ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT32ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
uint32array)
|
uint32array)
|
||||||
|
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT32ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT32ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
float32array)
|
float32array)
|
||||||
|
|
||||||
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
|
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT64ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT64ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
float64array)
|
float64array)
|
||||||
@@ -394,13 +394,13 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT64ARRAY,
|
|||||||
|
|
||||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGINT64ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGINT64ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
bigint64array)
|
bigint64array)
|
||||||
|
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGUINT64ARRAY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGUINT64ARRAY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_TYPEDARRAY,
|
ECMA_BUILTIN_ID_TYPEDARRAY,
|
||||||
true,
|
true,
|
||||||
biguint64array)
|
biguint64array)
|
||||||
@@ -486,7 +486,7 @@ BUILTIN (ECMA_BUILTIN_ID_PROMISE_PROTOTYPE,
|
|||||||
promise_prototype)
|
promise_prototype)
|
||||||
|
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROMISE,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROMISE,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
promise)
|
promise)
|
||||||
@@ -504,7 +504,7 @@ BUILTIN (ECMA_BUILTIN_ID_MAP_PROTOTYPE,
|
|||||||
|
|
||||||
/* The Map routine (ECMA-262 v6, 23.1.1.1) */
|
/* The Map routine (ECMA-262 v6, 23.1.1.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
map)
|
map)
|
||||||
@@ -522,7 +522,7 @@ BUILTIN (ECMA_BUILTIN_ID_SET_PROTOTYPE,
|
|||||||
|
|
||||||
/* The Set routine (ECMA-262 v6, 23.1.1.1) */
|
/* The Set routine (ECMA-262 v6, 23.1.1.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SET,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SET,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
set)
|
set)
|
||||||
@@ -540,7 +540,7 @@ BUILTIN (ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE,
|
|||||||
|
|
||||||
/* The WeakMap routine (ECMA-262 v6, 23.1.1.1) */
|
/* The WeakMap routine (ECMA-262 v6, 23.1.1.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKMAP,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKMAP,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
weakmap)
|
weakmap)
|
||||||
@@ -558,7 +558,7 @@ BUILTIN (ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE,
|
|||||||
|
|
||||||
/* The WeakSet routine (ECMA-262 v6, 23.1.1.1) */
|
/* The WeakSet routine (ECMA-262 v6, 23.1.1.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKSET,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKSET,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
weakset)
|
weakset)
|
||||||
@@ -568,7 +568,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKSET,
|
|||||||
#if ENABLED (JERRY_BUILTIN_PROXY)
|
#if ENABLED (JERRY_BUILTIN_PROXY)
|
||||||
/* The Proxy routine (ECMA-262 v6, 26.2.1) */
|
/* The Proxy routine (ECMA-262 v6, 26.2.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROXY,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROXY,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
proxy)
|
proxy)
|
||||||
@@ -579,14 +579,14 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROXY,
|
|||||||
/* Intrinsic hidden builtin object */
|
/* Intrinsic hidden builtin object */
|
||||||
BUILTIN (ECMA_BUILTIN_ID_INTRINSIC_OBJECT,
|
BUILTIN (ECMA_BUILTIN_ID_INTRINSIC_OBJECT,
|
||||||
ECMA_OBJECT_TYPE_GENERAL,
|
ECMA_OBJECT_TYPE_GENERAL,
|
||||||
ECMA_BUILTIN_ID__COUNT,
|
ECMA_BUILTIN_ID__COUNT /* no prototype */,
|
||||||
true,
|
true,
|
||||||
intrinsic)
|
intrinsic)
|
||||||
|
|
||||||
/* The Array.prototype[@@unscopables] object */
|
/* The Array.prototype[@@unscopables] object */
|
||||||
BUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE_UNSCOPABLES,
|
BUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE_UNSCOPABLES,
|
||||||
ECMA_OBJECT_TYPE_GENERAL,
|
ECMA_OBJECT_TYPE_GENERAL,
|
||||||
ECMA_BUILTIN_ID__COUNT,
|
ECMA_BUILTIN_ID__COUNT /* no prototype */,
|
||||||
true,
|
true,
|
||||||
array_prototype_unscopables)
|
array_prototype_unscopables)
|
||||||
|
|
||||||
@@ -599,14 +599,14 @@ BUILTIN (ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE,
|
|||||||
|
|
||||||
/* The Symbol routine (ECMA-262 v6, 19.4.2.1) */
|
/* The Symbol routine (ECMA-262 v6, 19.4.2.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYMBOL,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYMBOL,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
symbol)
|
symbol)
|
||||||
|
|
||||||
/* The %AsyncFunction% object (ECMA-262 v11, 25.7.2) */
|
/* The %AsyncFunction% object (ECMA-262 v11, 25.7.2) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ASYNC_FUNCTION,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ASYNC_FUNCTION,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION,
|
ECMA_BUILTIN_ID_FUNCTION,
|
||||||
true,
|
true,
|
||||||
async_function)
|
async_function)
|
||||||
@@ -648,7 +648,7 @@ BUILTIN (ECMA_BUILTIN_ID_ASYNC_ITERATOR_PROTOTYPE,
|
|||||||
|
|
||||||
/* The %(GeneratorFunction)% object */
|
/* The %(GeneratorFunction)% object */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_GENERATOR_FUNCTION,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_GENERATOR_FUNCTION,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION,
|
ECMA_BUILTIN_ID_FUNCTION,
|
||||||
true,
|
true,
|
||||||
generator_function)
|
generator_function)
|
||||||
@@ -669,7 +669,7 @@ BUILTIN (ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE,
|
|||||||
|
|
||||||
/* The %(AsyncGeneratorFunction)% object */
|
/* The %(AsyncGeneratorFunction)% object */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION,
|
ECMA_BUILTIN_ID_FUNCTION,
|
||||||
true,
|
true,
|
||||||
async_generator_function)
|
async_generator_function)
|
||||||
@@ -718,7 +718,7 @@ BUILTIN (ECMA_BUILTIN_ID_BIGINT_PROTOTYPE,
|
|||||||
|
|
||||||
/* The %BigInt% object */
|
/* The %BigInt% object */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGINT,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGINT,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
bigint)
|
bigint)
|
||||||
@@ -734,7 +734,7 @@ BUILTIN (ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE,
|
|||||||
|
|
||||||
/* The DataView routine (ECMA-262 v6, 24.2.2.1) */
|
/* The DataView routine (ECMA-262 v6, 24.2.2.1) */
|
||||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATAVIEW,
|
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATAVIEW,
|
||||||
ECMA_OBJECT_TYPE_FUNCTION,
|
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||||
true,
|
true,
|
||||||
dataview)
|
dataview)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
/* These routines must be in this order */
|
/* 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_MAP,
|
||||||
ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE,
|
ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE,
|
||||||
ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT,
|
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.
|
* Returned value must be freed with ecma_free_value.
|
||||||
*/
|
*/
|
||||||
ecma_value_t
|
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 */
|
ecma_value_t this_arg, /**< 'this' argument value */
|
||||||
const ecma_value_t arguments_list_p[], /**< list of arguments
|
const ecma_value_t arguments_list_p[], /**< list of arguments
|
||||||
* passed to routine */
|
* passed to routine */
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
*/
|
*/
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ECMA_CONTAINER_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
|
ECMA_CONTAINER_ROUTINE_START = 0,
|
||||||
ECMA_CONTAINER_ROUTINE_ADD,
|
ECMA_CONTAINER_ROUTINE_ADD,
|
||||||
ECMA_CONTAINER_ROUTINE_CLEAR,
|
ECMA_CONTAINER_ROUTINE_CLEAR,
|
||||||
ECMA_CONTAINER_ROUTINE_DELETE_WEAK,
|
ECMA_CONTAINER_ROUTINE_DELETE_WEAK,
|
||||||
|
|||||||
@@ -159,17 +159,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
|
|||||||
|
|
||||||
if (JERRY_LIKELY (type == ECMA_OBJECT_TYPE_FUNCTION))
|
if (JERRY_LIKELY (type == ECMA_OBJECT_TYPE_FUNCTION))
|
||||||
{
|
{
|
||||||
bool is_builtin = ecma_get_object_is_builtin (obj_p);
|
JERRY_ASSERT (!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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ENABLED (JERRY_ESNEXT)
|
#if ENABLED (JERRY_ESNEXT)
|
||||||
const ecma_compiled_code_t *byte_code_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) obj_p);
|
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) */
|
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
|
||||||
|
|
||||||
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
|
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
|
||||||
|
|
||||||
if (ecma_get_object_is_builtin (obj_p))
|
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;
|
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 */
|
} /* ecma_op_create_external_function_object */
|
||||||
|
|
||||||
#if ENABLED (JERRY_ESNEXT)
|
#if ENABLED (JERRY_ESNEXT)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create built-in native handler object.
|
* 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_set_object_is_builtin (function_obj_p);
|
||||||
|
|
||||||
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) 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.built_in.id = ECMA_BUILTIN_ID_HANDLER;
|
||||||
ext_func_obj_p->u.native_handler.flags = ECMA_NATIVE_HANDLER_FLAGS_NONE;
|
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;
|
return function_obj_p;
|
||||||
} /* ecma_op_create_native_handler */
|
} /* ecma_op_create_native_handler */
|
||||||
|
|
||||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
#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 */
|
uint32_t arguments_list_len) /**< length of arguments list */
|
||||||
{
|
{
|
||||||
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_FUNCTION);
|
||||||
|
JERRY_ASSERT (!ecma_get_object_is_builtin (func_obj_p));
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
vm_frame_ctx_shared_args_t shared_args;
|
vm_frame_ctx_shared_args_t shared_args;
|
||||||
shared_args.header.status_flags = VM_FRAME_CTX_SHARED_HAS_ARG_LIST;
|
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);
|
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;
|
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))
|
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 ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
|
||||||
return handler (ecma_make_object_value (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);
|
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),
|
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 (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);
|
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);
|
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_FUNCTION);
|
||||||
|
JERRY_ASSERT (!ecma_get_object_is_builtin (func_obj_p));
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
ecma_object_t *new_this_obj_p = NULL;
|
ecma_object_t *new_this_obj_p = NULL;
|
||||||
ecma_value_t this_arg;
|
ecma_value_t this_arg;
|
||||||
@@ -1688,57 +1683,6 @@ ecma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *objec
|
|||||||
return NULL;
|
return NULL;
|
||||||
} /* ecma_op_external_function_try_to_lazy_instantiate_property */
|
} /* 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.
|
* 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 */
|
} /* 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,
|
* List names of a Bound Function object's lazy instantiated properties,
|
||||||
* adding them to corresponding string collections
|
* 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_object_t *
|
||||||
ecma_op_create_native_handler (ecma_native_handler_id_t id, size_t object_size);
|
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) */
|
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||||
|
|
||||||
ecma_object_t *
|
ecma_object_t *
|
||||||
|
|||||||
@@ -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 (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);
|
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
|
else
|
||||||
{
|
{
|
||||||
property_p = ecma_builtin_try_to_instantiate_property (object_p, property_name_p);
|
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 (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);
|
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
|
else
|
||||||
{
|
{
|
||||||
property_p = ecma_builtin_try_to_instantiate_property (object_p, property_name_p);
|
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 (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);
|
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
|
else
|
||||||
{
|
{
|
||||||
property_p = ecma_builtin_try_to_instantiate_property (object_p, property_name_p);
|
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 (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);
|
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
|
else
|
||||||
{
|
{
|
||||||
ecma_builtin_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
|
ecma_builtin_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
|
||||||
|
|||||||
Reference in New Issue
Block a user