Remove pseudo array object type from the project (#4643)
A new class type enum is introduced to describe the class of objects. This enum is organized to improve property resolve and GC performance. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
+91
-107
@@ -560,8 +560,9 @@ jerry_parse (const jerry_char_t *source_p, /**< script source */
|
||||
ecma_object_t *object_p = ecma_create_object (NULL, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_SCRIPT_UL;
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p->u.class_prop.u.value, bytecode_data_p);
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_SCRIPT;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_SCRIPT_UL;
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p->u.cls.u3.value, bytecode_data_p);
|
||||
|
||||
return ecma_make_object_value (object_p);
|
||||
#else /* !JERRY_PARSER */
|
||||
@@ -689,13 +690,13 @@ jerry_run (const jerry_value_t func_val) /**< function to run */
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.class_prop.class_id != LIT_MAGIC_STRING_SCRIPT_UL)
|
||||
if (ext_object_p->u.cls.type != ECMA_OBJECT_CLASS_SCRIPT)
|
||||
{
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
|
||||
}
|
||||
|
||||
const ecma_compiled_code_t *bytecode_data_p;
|
||||
bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.class_prop.u.value);
|
||||
bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);
|
||||
|
||||
JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_SCRIPT);
|
||||
|
||||
@@ -790,7 +791,7 @@ jerry_module_evaluate (const jerry_value_t module_val) /**< root module */
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_not_module_p)));
|
||||
}
|
||||
|
||||
if (module_p->header.u.class_prop.extra_info != JERRY_MODULE_STATE_LINKED)
|
||||
if (module_p->header.u.cls.u1.module_state != JERRY_MODULE_STATE_LINKED)
|
||||
{
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Module must be in linked state")));
|
||||
}
|
||||
@@ -822,7 +823,7 @@ jerry_module_get_state (const jerry_value_t module_val) /**< module object */
|
||||
return JERRY_MODULE_STATE_INVALID;
|
||||
}
|
||||
|
||||
return (jerry_module_state_t) module_p->header.u.class_prop.extra_info;
|
||||
return (jerry_module_state_t) module_p->header.u.cls.u1.module_state;
|
||||
#else /* !JERRY_MODULE_SYSTEM */
|
||||
JERRY_UNUSED (module_val);
|
||||
|
||||
@@ -936,7 +937,7 @@ jerry_module_get_namespace (const jerry_value_t module_val) /**< module */
|
||||
|
||||
if (module_p->namespace_object_p == NULL)
|
||||
{
|
||||
if (module_p->header.u.class_prop.extra_info != JERRY_MODULE_STATE_EVALUATED)
|
||||
if (module_p->header.u.cls.u1.module_state != JERRY_MODULE_STATE_EVALUATED)
|
||||
{
|
||||
return jerry_throw (ecma_raise_range_error (ECMA_ERR_MSG ("Namespace object has not been created yet")));
|
||||
}
|
||||
@@ -1365,110 +1366,93 @@ jerry_object_get_type (const jerry_value_t value) /**< input value to check */
|
||||
return JERRY_OBJECT_TYPE_PROXY;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
case ECMA_OBJECT_TYPE_CLASS:
|
||||
{
|
||||
switch (ext_obj_p->u.pseudo_array.type)
|
||||
switch (ext_obj_p->u.cls.type)
|
||||
{
|
||||
case ECMA_PSEUDO_ARRAY_ARGUMENTS:
|
||||
case ECMA_OBJECT_CLASS_ARGUMENTS:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_ARGUMENTS;
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY:
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO:
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY:
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_TYPEDARRAY;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_PARSER
|
||||
case ECMA_OBJECT_CLASS_SCRIPT:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_SCRIPT;
|
||||
}
|
||||
#endif /* JERRY_PARSER */
|
||||
case ECMA_OBJECT_CLASS_BOOLEAN:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_BOOLEAN;
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_STRING:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_STRING;
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_NUMBER:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_NUMBER;
|
||||
}
|
||||
#if JERRY_BUILTIN_DATE
|
||||
case ECMA_OBJECT_CLASS_DATE:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_DATE;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_DATE */
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
case ECMA_OBJECT_CLASS_REGEXP:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_REGEXP;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
#if JERRY_ESNEXT
|
||||
case ECMA_PSEUDO_STRING_ITERATOR:
|
||||
case ECMA_PSEUDO_ARRAY_ITERATOR:
|
||||
#if JERRY_BUILTIN_MAP
|
||||
case ECMA_PSEUDO_MAP_ITERATOR:
|
||||
#endif /* JERRY_BUILTIN_MAP */
|
||||
case ECMA_OBJECT_CLASS_SYMBOL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_SYMBOL;
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_GENERATOR:
|
||||
case ECMA_OBJECT_CLASS_ASYNC_GENERATOR:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_GENERATOR;
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_ARRAY_ITERATOR:
|
||||
#if JERRY_BUILTIN_SET
|
||||
case ECMA_PSEUDO_SET_ITERATOR:
|
||||
case ECMA_OBJECT_CLASS_SET_ITERATOR:
|
||||
#endif /* JERRY_BUILTIN_SET */
|
||||
#if JERRY_BUILTIN_MAP
|
||||
case ECMA_OBJECT_CLASS_MAP_ITERATOR:
|
||||
#endif /* JERRY_BUILTIN_MAP */
|
||||
case ECMA_OBJECT_CLASS_STRING_ITERATOR:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_ITERATOR;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_CLASS:
|
||||
{
|
||||
switch (ext_obj_p->u.class_prop.class_id)
|
||||
{
|
||||
case LIT_MAGIC_STRING_SCRIPT_UL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_SCRIPT;
|
||||
}
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
case LIT_MAGIC_STRING_MODULE_UL:
|
||||
case ECMA_OBJECT_CLASS_MODULE:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_MODULE;
|
||||
}
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
case LIT_MAGIC_STRING_ARGUMENTS_UL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_ARGUMENTS;
|
||||
}
|
||||
case LIT_MAGIC_STRING_BOOLEAN_UL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_BOOLEAN;
|
||||
}
|
||||
case LIT_MAGIC_STRING_DATE_UL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_DATE;
|
||||
}
|
||||
case LIT_MAGIC_STRING_NUMBER_UL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_NUMBER;
|
||||
}
|
||||
case LIT_MAGIC_STRING_REGEXP_UL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_REGEXP;
|
||||
}
|
||||
case LIT_MAGIC_STRING_STRING_UL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_STRING;
|
||||
}
|
||||
#if JERRY_ESNEXT
|
||||
case LIT_MAGIC_STRING_SYMBOL_UL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_SYMBOL;
|
||||
}
|
||||
case LIT_MAGIC_STRING_GENERATOR_UL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_GENERATOR;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
case LIT_MAGIC_STRING_BIGINT_UL:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_BIGINT;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
#if JERRY_BUILTIN_CONTAINER
|
||||
#if JERRY_BUILTIN_MAP
|
||||
case LIT_MAGIC_STRING_MAP_UL:
|
||||
#endif /* JERRY_BUILTIN_MAP */
|
||||
#if JERRY_BUILTIN_SET
|
||||
case LIT_MAGIC_STRING_SET_UL:
|
||||
#endif /* JERRY_BUILTIN_SET */
|
||||
#if JERRY_BUILTIN_WEAKMAP
|
||||
case LIT_MAGIC_STRING_WEAKMAP_UL:
|
||||
#endif /* JERRY_BUILTIN_WEAKMAP */
|
||||
#if JERRY_BUILTIN_WEAKSET
|
||||
case LIT_MAGIC_STRING_WEAKSET_UL:
|
||||
#endif /* JERRY_BUILTIN_WEAKSET */
|
||||
case ECMA_OBJECT_CLASS_CONTAINER:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_CONTAINER;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_CONTAINER */
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
case ECMA_OBJECT_CLASS_BIGINT:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_BIGINT;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
#if JERRY_BUILTIN_WEAKREF
|
||||
case LIT_MAGIC_STRING_WEAKREF_UL:
|
||||
case ECMA_OBJECT_CLASS_WEAKREF:
|
||||
{
|
||||
return JERRY_OBJECT_TYPE_WEAKREF;
|
||||
}
|
||||
@@ -1574,30 +1558,30 @@ jerry_iterator_get_type (const jerry_value_t value) /**< input value to check */
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (value);
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_PSEUDO_ARRAY)
|
||||
if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_CLASS)
|
||||
{
|
||||
switch (ext_obj_p->u.pseudo_array.type)
|
||||
switch (ext_obj_p->u.cls.type)
|
||||
{
|
||||
case ECMA_PSEUDO_ARRAY_ITERATOR:
|
||||
case ECMA_OBJECT_CLASS_ARRAY_ITERATOR:
|
||||
{
|
||||
return JERRY_ITERATOR_TYPE_ARRAY;
|
||||
}
|
||||
case ECMA_PSEUDO_STRING_ITERATOR:
|
||||
{
|
||||
return JERRY_ITERATOR_TYPE_STRING;
|
||||
}
|
||||
#if JERRY_BUILTIN_MAP
|
||||
case ECMA_PSEUDO_MAP_ITERATOR:
|
||||
{
|
||||
return JERRY_ITERATOR_TYPE_MAP;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_MAP */
|
||||
#if JERRY_BUILTIN_SET
|
||||
case ECMA_PSEUDO_SET_ITERATOR:
|
||||
case ECMA_OBJECT_CLASS_SET_ITERATOR:
|
||||
{
|
||||
return JERRY_ITERATOR_TYPE_SET;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_SET */
|
||||
#if JERRY_BUILTIN_MAP
|
||||
case ECMA_OBJECT_CLASS_MAP_ITERATOR:
|
||||
{
|
||||
return JERRY_ITERATOR_TYPE_MAP;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_MAP */
|
||||
case ECMA_OBJECT_CLASS_STRING_ITERATOR:
|
||||
{
|
||||
return JERRY_ITERATOR_TYPE_STRING;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -3476,9 +3460,8 @@ jerry_set_internal_property (const jerry_value_t obj_val, /**< object value */
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
{
|
||||
ecma_extended_object_t *container_p = (ecma_extended_object_t *) internal_object_p;
|
||||
container_p->u.class_prop.class_id = LIT_INTERNAL_MAGIC_STRING_INTERNAL_OBJECT;
|
||||
container_p->u.class_prop.extra_info = 0;
|
||||
container_p->u.class_prop.u.length = 0;
|
||||
container_p->u.cls.type = ECMA_OBJECT_CLASS_INTERNAL_OBJECT;
|
||||
container_p->u.cls.u2.id = LIT_MAGIC_STRING_OBJECT_UL;
|
||||
}
|
||||
|
||||
value_p->value = ecma_make_object_value (internal_object_p);
|
||||
@@ -4061,10 +4044,13 @@ bool jerry_object_is_valid_foreach (ecma_object_t *object_p) /**< object to test
|
||||
if (object_type == ECMA_OBJECT_TYPE_CLASS)
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
switch (ext_object_p->u.class_prop.class_id)
|
||||
switch (ext_object_p->u.cls.type)
|
||||
{
|
||||
/* An object's internal property object should not be iterable by foreach. */
|
||||
case LIT_INTERNAL_MAGIC_STRING_INTERNAL_OBJECT: return false;
|
||||
case ECMA_OBJECT_CLASS_INTERNAL_OBJECT:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5667,7 +5653,7 @@ jerry_get_dataview_buffer (const jerry_value_t value, /**< DataView to get the a
|
||||
|
||||
if (byte_length != NULL)
|
||||
{
|
||||
*byte_length = dataview_p->header.u.class_prop.u.length;
|
||||
*byte_length = dataview_p->header.u.cls.u3.length;
|
||||
}
|
||||
|
||||
ecma_object_t *arraybuffer_p = dataview_p->buffer_p;
|
||||
@@ -6195,11 +6181,9 @@ jerry_get_container_type (const jerry_value_t value) /**< the container object *
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (value);
|
||||
|
||||
if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_CLASS)
|
||||
if (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_CONTAINER))
|
||||
{
|
||||
uint16_t type = ((ecma_extended_object_t *) obj_p)->u.class_prop.class_id;
|
||||
|
||||
switch (type)
|
||||
switch (((ecma_extended_object_t *) obj_p)->u.cls.u2.id)
|
||||
{
|
||||
#if JERRY_BUILTIN_MAP
|
||||
case LIT_MAGIC_STRING_MAP_UL:
|
||||
|
||||
+160
-201
@@ -197,14 +197,14 @@ ecma_gc_mark_global_object (ecma_global_object_t *global_object_p) /**< global o
|
||||
static void
|
||||
ecma_gc_mark_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments object */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_object_type ((ecma_object_t *) ext_object_p) == ECMA_OBJECT_TYPE_PSEUDO_ARRAY);
|
||||
JERRY_ASSERT (ecma_get_object_type ((ecma_object_t *) ext_object_p) == ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) ext_object_p;
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (arguments_p->callee));
|
||||
|
||||
ecma_value_t *argv_p = (ecma_value_t *) (arguments_p + 1);
|
||||
|
||||
if (ext_object_p->u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
if (ext_object_p->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
{
|
||||
ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;
|
||||
argv_p = (ecma_value_t *) (mapped_arguments_p + 1);
|
||||
@@ -212,7 +212,7 @@ ecma_gc_mark_arguments_object (ecma_extended_object_t *ext_object_p) /**< argume
|
||||
ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env));
|
||||
}
|
||||
|
||||
uint32_t arguments_number = arguments_p->header.u.pseudo_array.u2.arguments_number;
|
||||
uint32_t arguments_number = arguments_p->header.u.cls.u3.arguments_number;
|
||||
|
||||
for (uint32_t i = 0; i < arguments_number; i++)
|
||||
{
|
||||
@@ -343,7 +343,7 @@ static void
|
||||
ecma_gc_mark_promise_object (ecma_extended_object_t *ext_object_p) /**< extended object */
|
||||
{
|
||||
/* Mark promise result. */
|
||||
ecma_value_t result = ext_object_p->u.class_prop.u.value;
|
||||
ecma_value_t result = ext_object_p->u.cls.u3.value;
|
||||
|
||||
if (ecma_is_value_object (result))
|
||||
{
|
||||
@@ -392,7 +392,7 @@ ecma_gc_mark_map_object (ecma_object_t *object_p) /**< object */
|
||||
|
||||
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);
|
||||
uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);
|
||||
|
||||
@@ -429,7 +429,7 @@ ecma_gc_mark_weakmap_object (ecma_object_t *object_p) /**< object */
|
||||
|
||||
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);
|
||||
uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);
|
||||
|
||||
@@ -461,7 +461,7 @@ ecma_gc_mark_set_object (ecma_object_t *object_p) /**< object */
|
||||
|
||||
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);
|
||||
uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);
|
||||
|
||||
@@ -491,9 +491,9 @@ ecma_gc_mark_executable_object (ecma_object_t *object_p) /**< object */
|
||||
{
|
||||
vm_executable_object_t *executable_object_p = (vm_executable_object_t *) object_p;
|
||||
|
||||
if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_ASYNC_GENERATOR_CALLED)
|
||||
if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_ASYNC_GENERATOR_CALLED)
|
||||
{
|
||||
ecma_value_t task = executable_object_p->extended_object.u.class_prop.u.head;
|
||||
ecma_value_t task = executable_object_p->extended_object.u.cls.u3.head;
|
||||
|
||||
while (!ECMA_IS_INTERNAL_VALUE_NULL (task))
|
||||
{
|
||||
@@ -514,7 +514,7 @@ ecma_gc_mark_executable_object (ecma_object_t *object_p) /**< object */
|
||||
|
||||
ecma_gc_set_object_visited (executable_object_p->frame_ctx.lex_env_p);
|
||||
|
||||
if (!ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED (executable_object_p->extended_object.u.class_prop.extra_info))
|
||||
if (!ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED (executable_object_p))
|
||||
{
|
||||
/* All objects referenced by running executable objects are strong roots,
|
||||
* and a finished executable object cannot refer to other values. */
|
||||
@@ -719,10 +719,23 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
switch (ext_object_p->u.class_prop.class_id)
|
||||
switch (ext_object_p->u.cls.type)
|
||||
{
|
||||
case ECMA_OBJECT_CLASS_ARGUMENTS:
|
||||
{
|
||||
ecma_gc_mark_arguments_object (ext_object_p);
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY:
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_typedarray_get_arraybuffer (object_p));
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
case LIT_MAGIC_STRING_MODULE_UL:
|
||||
case ECMA_OBJECT_CLASS_MODULE:
|
||||
{
|
||||
ecma_module_node_t *node_p = ((ecma_module_t *) ext_object_p)->imports_p;
|
||||
|
||||
@@ -738,16 +751,15 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
|
||||
#if JERRY_BUILTIN_PROMISE
|
||||
case LIT_MAGIC_STRING_PROMISE_UL:
|
||||
case ECMA_OBJECT_CLASS_PROMISE:
|
||||
{
|
||||
ecma_gc_mark_promise_object (ext_object_p);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_PROMISE */
|
||||
#if JERRY_BUILTIN_DATAVIEW
|
||||
case LIT_MAGIC_STRING_DATAVIEW_UL:
|
||||
case ECMA_OBJECT_CLASS_DATAVIEW:
|
||||
{
|
||||
ecma_dataview_object_t *dataview_p = (ecma_dataview_object_t *) object_p;
|
||||
ecma_gc_set_object_visited (dataview_p->buffer_p);
|
||||
@@ -755,48 +767,49 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_DATAVIEW */
|
||||
#if JERRY_BUILTIN_CONTAINER
|
||||
#if JERRY_BUILTIN_WEAKSET
|
||||
case LIT_MAGIC_STRING_WEAKSET_UL:
|
||||
case ECMA_OBJECT_CLASS_CONTAINER:
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_WEAKSET */
|
||||
#if JERRY_BUILTIN_SET
|
||||
case LIT_MAGIC_STRING_SET_UL:
|
||||
{
|
||||
ecma_gc_mark_set_object (object_p);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_SET */
|
||||
#if JERRY_BUILTIN_WEAKMAP
|
||||
case LIT_MAGIC_STRING_WEAKMAP_UL:
|
||||
{
|
||||
ecma_gc_mark_weakmap_object (object_p);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_WEAKMAP */
|
||||
#if JERRY_BUILTIN_MAP
|
||||
case LIT_MAGIC_STRING_MAP_UL:
|
||||
{
|
||||
ecma_gc_mark_map_object (object_p);
|
||||
if (ext_object_p->u.cls.u2.id == LIT_MAGIC_STRING_MAP_UL)
|
||||
{
|
||||
ecma_gc_mark_map_object (object_p);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_MAP */
|
||||
#if JERRY_BUILTIN_WEAKMAP
|
||||
if (ext_object_p->u.cls.u2.id == LIT_MAGIC_STRING_WEAKMAP_UL)
|
||||
{
|
||||
ecma_gc_mark_weakmap_object (object_p);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_WEAKMAP */
|
||||
#if JERRY_BUILTIN_SET
|
||||
if (ext_object_p->u.cls.u2.id == LIT_MAGIC_STRING_SET_UL)
|
||||
{
|
||||
ecma_gc_mark_set_object (object_p);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_SET */
|
||||
#if JERRY_BUILTIN_WEAKSET
|
||||
JERRY_ASSERT (ext_object_p->u.cls.u2.id == LIT_MAGIC_STRING_WEAKSET_UL);
|
||||
#endif /* JERRY_BUILTIN_WEAKSET */
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_MAP */
|
||||
#endif /* JERRY_BUILTIN_CONTAINER */
|
||||
#if JERRY_ESNEXT
|
||||
case LIT_MAGIC_STRING_GENERATOR_UL:
|
||||
case LIT_MAGIC_STRING_ASYNC_GENERATOR_UL:
|
||||
case ECMA_OBJECT_CLASS_GENERATOR:
|
||||
case ECMA_OBJECT_CLASS_ASYNC_GENERATOR:
|
||||
{
|
||||
ecma_gc_mark_executable_object (object_p);
|
||||
break;
|
||||
}
|
||||
case LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY:
|
||||
case ECMA_OBJECT_CLASS_PROMISE_CAPABILITY:
|
||||
{
|
||||
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) object_p;
|
||||
|
||||
if (ecma_is_value_object (capability_p->header.u.class_prop.u.promise))
|
||||
if (ecma_is_value_object (capability_p->header.u.cls.u3.promise))
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (capability_p->header.u.class_prop.u.promise));
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (capability_p->header.u.cls.u3.promise));
|
||||
}
|
||||
if (ecma_is_value_object (capability_p->resolve))
|
||||
{
|
||||
@@ -808,58 +821,31 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
default:
|
||||
case ECMA_OBJECT_CLASS_ARRAY_ITERATOR:
|
||||
case ECMA_OBJECT_CLASS_SET_ITERATOR:
|
||||
case ECMA_OBJECT_CLASS_MAP_ITERATOR:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
switch (ext_object_p->u.pseudo_array.type)
|
||||
{
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY:
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_typedarray_get_arraybuffer (object_p));
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_ESNEXT
|
||||
case ECMA_PSEUDO_ARRAY_ITERATOR:
|
||||
case ECMA_PSEUDO_SET_ITERATOR:
|
||||
case ECMA_PSEUDO_MAP_ITERATOR:
|
||||
{
|
||||
ecma_value_t iterated_value = ext_object_p->u.pseudo_array.u2.iterated_value;
|
||||
ecma_value_t iterated_value = ext_object_p->u.cls.u3.iterated_value;
|
||||
if (!ecma_is_value_empty (iterated_value))
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (iterated_value));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECMA_PSEUDO_STRING_ITERATOR:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ECMA_PSEUDO_REGEXP_STRING_ITERATOR:
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
case ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR:
|
||||
{
|
||||
ecma_regexp_string_iterator_t *regexp_string_iterator_obj = (ecma_regexp_string_iterator_t *) object_p;
|
||||
ecma_value_t regexp = regexp_string_iterator_obj->iterating_regexp;
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (regexp));
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS);
|
||||
|
||||
ecma_gc_mark_arguments_object (ext_object_p);
|
||||
/* The ECMA_OBJECT_CLASS__MAX type represents an uninitialized class. */
|
||||
JERRY_ASSERT (ext_object_p->u.cls.type <= ECMA_OBJECT_CLASS__MAX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1144,17 +1130,17 @@ ecma_gc_free_native_pointer (ecma_property_t *property_p) /**< property */
|
||||
static size_t
|
||||
ecma_free_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments object */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_object_type ((ecma_object_t *) ext_object_p) == ECMA_OBJECT_TYPE_PSEUDO_ARRAY);
|
||||
JERRY_ASSERT (ecma_get_object_type ((ecma_object_t *) ext_object_p) == ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
size_t object_size = sizeof (ecma_unmapped_arguments_t);
|
||||
|
||||
if (ext_object_p->u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
if (ext_object_p->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
{
|
||||
ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;
|
||||
object_size = sizeof (ecma_mapped_arguments_t);
|
||||
|
||||
#if JERRY_SNAPSHOT_EXEC
|
||||
if (!(mapped_arguments_p->unmapped.header.u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE))
|
||||
if (!(mapped_arguments_p->unmapped.header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE))
|
||||
#endif /* JERRY_SNAPSHOT_EXEC */
|
||||
{
|
||||
ecma_compiled_code_t *byte_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
|
||||
@@ -1166,7 +1152,7 @@ ecma_free_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments
|
||||
|
||||
ecma_value_t *argv_p = (ecma_value_t *) (((uint8_t *) ext_object_p) + object_size);
|
||||
ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) ext_object_p;
|
||||
uint32_t arguments_number = arguments_p->header.u.pseudo_array.u2.arguments_number;
|
||||
uint32_t arguments_number = arguments_p->header.u.cls.u3.arguments_number;
|
||||
|
||||
for (uint32_t i = 0; i < arguments_number; i++)
|
||||
{
|
||||
@@ -1174,7 +1160,7 @@ ecma_free_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments
|
||||
}
|
||||
|
||||
uint32_t saved_argument_count = JERRY_MAX (arguments_number,
|
||||
arguments_p->header.u.pseudo_array.u1.formal_params_number);
|
||||
arguments_p->header.u.cls.u2.formal_params_number);
|
||||
|
||||
return object_size + (saved_argument_count * sizeof (ecma_value_t));
|
||||
} /* ecma_free_arguments_object */
|
||||
@@ -1236,14 +1222,15 @@ ecma_gc_free_executable_object (ecma_object_t *object_p) /**< object */
|
||||
}
|
||||
|
||||
size = JERRY_ALIGNUP (sizeof (vm_executable_object_t) + size, sizeof (uintptr_t));
|
||||
|
||||
JERRY_ASSERT (!(executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_RUNNING));
|
||||
|
||||
ecma_bytecode_deref ((ecma_compiled_code_t *) bytecode_header_p);
|
||||
|
||||
if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_ASYNC_GENERATOR_CALLED)
|
||||
uint16_t executable_obj_flags = executable_object_p->extended_object.u.cls.u2.executable_obj_flags;
|
||||
|
||||
JERRY_ASSERT (!(executable_obj_flags & ECMA_EXECUTABLE_OBJECT_RUNNING));
|
||||
|
||||
if (executable_obj_flags & ECMA_ASYNC_GENERATOR_CALLED)
|
||||
{
|
||||
ecma_value_t task = executable_object_p->extended_object.u.class_prop.u.head;
|
||||
ecma_value_t task = executable_object_p->extended_object.u.cls.u3.head;
|
||||
|
||||
while (!ECMA_IS_INTERNAL_VALUE_NULL (task))
|
||||
{
|
||||
@@ -1258,7 +1245,7 @@ ecma_gc_free_executable_object (ecma_object_t *object_p) /**< object */
|
||||
}
|
||||
}
|
||||
|
||||
if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_COMPLETED)
|
||||
if (executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED)
|
||||
{
|
||||
return size;
|
||||
}
|
||||
@@ -1412,11 +1399,10 @@ ecma_gc_free_properties (ecma_object_t *object_p) /**< object */
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (value);
|
||||
|
||||
if (ecma_object_class_is (obj_p, LIT_MAGIC_STRING_WEAKREF_UL))
|
||||
if (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_WEAKREF))
|
||||
{
|
||||
JERRY_ASSERT (ecma_object_class_is (obj_p, LIT_MAGIC_STRING_WEAKREF_UL));
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
ext_obj_p->u.class_prop.u.target = ECMA_VALUE_UNDEFINED;
|
||||
ext_obj_p->u.cls.u3.target = ECMA_VALUE_UNDEFINED;
|
||||
continue;
|
||||
}
|
||||
ecma_op_container_remove_weak_entry (obj_p, ecma_make_object_value (object_p));
|
||||
@@ -1585,53 +1571,98 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
switch (ext_object_p->u.class_prop.class_id)
|
||||
switch (ext_object_p->u.cls.type)
|
||||
{
|
||||
case LIT_MAGIC_STRING_SCRIPT_UL:
|
||||
case ECMA_OBJECT_CLASS_STRING:
|
||||
case ECMA_OBJECT_CLASS_NUMBER:
|
||||
#if JERRY_ESNEXT
|
||||
case ECMA_OBJECT_CLASS_SYMBOL:
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
case ECMA_OBJECT_CLASS_BIGINT:
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
{
|
||||
ecma_free_value (ext_object_p->u.cls.u3.value);
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_ARGUMENTS:
|
||||
{
|
||||
ext_object_size = ecma_free_arguments_object (ext_object_p);
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
ext_object_size = sizeof (ecma_extended_typedarray_object_t);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_PARSER
|
||||
case ECMA_OBJECT_CLASS_SCRIPT:
|
||||
{
|
||||
ecma_compiled_code_t *compiled_code_p;
|
||||
compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
|
||||
ext_object_p->u.class_prop.u.value);
|
||||
ext_object_p->u.cls.u3.value);
|
||||
|
||||
ecma_bytecode_deref (compiled_code_p);
|
||||
break;
|
||||
}
|
||||
case LIT_MAGIC_STRING_STRING_UL:
|
||||
case LIT_MAGIC_STRING_NUMBER_UL:
|
||||
#if JERRY_ESNEXT
|
||||
case LIT_MAGIC_STRING_SYMBOL_UL:
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
case LIT_MAGIC_STRING_BIGINT_UL:
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
{
|
||||
ecma_free_value (ext_object_p->u.class_prop.u.value);
|
||||
break;
|
||||
}
|
||||
|
||||
case LIT_MAGIC_STRING_DATE_UL:
|
||||
#endif /* JERRY_PARSER */
|
||||
#if JERRY_BUILTIN_DATE
|
||||
case ECMA_OBJECT_CLASS_DATE:
|
||||
{
|
||||
#if JERRY_ESNEXT
|
||||
ext_object_size = sizeof (ecma_date_object_t);
|
||||
#else /* !JERRY_ESNEXT */
|
||||
ecma_number_t *num_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, ext_object_p->u.class_prop.u.date);
|
||||
ecma_number_t *num_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, ext_object_p->u.cls.u3.date);
|
||||
ecma_dealloc_number (num_p);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
break;
|
||||
}
|
||||
case LIT_MAGIC_STRING_REGEXP_UL:
|
||||
#endif /* JERRY_BUILTIN_DATE */
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
case ECMA_OBJECT_CLASS_REGEXP:
|
||||
{
|
||||
ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_ANY_POINTER (ecma_compiled_code_t,
|
||||
ext_object_p->u.class_prop.u.value);
|
||||
ext_object_p->u.cls.u3.value);
|
||||
|
||||
ecma_bytecode_deref (bytecode_p);
|
||||
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
case LIT_MAGIC_STRING_ARRAY_BUFFER_UL:
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
#if JERRY_ESNEXT
|
||||
case ECMA_OBJECT_CLASS_STRING_ITERATOR:
|
||||
{
|
||||
uint32_t arraybuffer_length = ext_object_p->u.class_prop.u.length;
|
||||
ecma_value_t iterated_value = ext_object_p->u.cls.u3.iterated_value;
|
||||
|
||||
if (!ecma_is_value_empty (iterated_value))
|
||||
{
|
||||
ecma_deref_ecma_string (ecma_get_string_from_value (iterated_value));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
case ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR:
|
||||
{
|
||||
ecma_regexp_string_iterator_t *regexp_string_iterator_obj = (ecma_regexp_string_iterator_t *) object_p;
|
||||
ecma_value_t iterated_string = regexp_string_iterator_obj->iterated_string;
|
||||
|
||||
if (!ecma_is_value_empty (iterated_string))
|
||||
{
|
||||
ecma_deref_ecma_string (ecma_get_string_from_value (iterated_string));
|
||||
}
|
||||
|
||||
ext_object_size = sizeof (ecma_regexp_string_iterator_t);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
case ECMA_OBJECT_CLASS_ARRAY_BUFFER:
|
||||
{
|
||||
uint32_t arraybuffer_length = ext_object_p->u.cls.u3.length;
|
||||
|
||||
if (ECMA_ARRAYBUFFER_HAS_EXTERNAL_MEMORY (ext_object_p))
|
||||
{
|
||||
@@ -1654,9 +1685,9 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_BUILTIN_PROMISE
|
||||
case LIT_MAGIC_STRING_PROMISE_UL:
|
||||
case ECMA_OBJECT_CLASS_PROMISE:
|
||||
{
|
||||
ecma_free_value_if_not_object (ext_object_p->u.class_prop.u.value);
|
||||
ecma_free_value_if_not_object (ext_object_p->u.cls.u3.value);
|
||||
|
||||
/* Reactions only contains objects. */
|
||||
ecma_collection_destroy (((ecma_promise_object_t *) object_p)->reactions);
|
||||
@@ -1666,9 +1697,9 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_PROMISE */
|
||||
#if JERRY_BUILTIN_WEAKREF
|
||||
case LIT_MAGIC_STRING_WEAKREF_UL:
|
||||
case ECMA_OBJECT_CLASS_WEAKREF:
|
||||
{
|
||||
ecma_value_t target = ext_object_p->u.class_prop.u.target;
|
||||
ecma_value_t target = ext_object_p->u.cls.u3.target;
|
||||
|
||||
if (!ecma_is_value_undefined (target))
|
||||
{
|
||||
@@ -1678,50 +1709,38 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_WEAKREF */
|
||||
#if JERRY_BUILTIN_CONTAINER
|
||||
#if JERRY_BUILTIN_MAP
|
||||
case LIT_MAGIC_STRING_MAP_UL:
|
||||
#endif /* JERRY_BUILTIN_MAP */
|
||||
#if JERRY_BUILTIN_SET
|
||||
case LIT_MAGIC_STRING_SET_UL:
|
||||
#endif /* JERRY_BUILTIN_SET */
|
||||
#if JERRY_BUILTIN_WEAKMAP
|
||||
case LIT_MAGIC_STRING_WEAKMAP_UL:
|
||||
#endif /* JERRY_BUILTIN_WEAKMAP */
|
||||
#if JERRY_BUILTIN_WEAKSET
|
||||
case LIT_MAGIC_STRING_WEAKSET_UL:
|
||||
#endif /* JERRY_BUILTIN_WEAKSET */
|
||||
case ECMA_OBJECT_CLASS_CONTAINER:
|
||||
{
|
||||
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
ecma_op_container_free_entries (object_p);
|
||||
ecma_collection_destroy (container_p);
|
||||
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_CONTAINER */
|
||||
#if JERRY_BUILTIN_DATAVIEW
|
||||
case LIT_MAGIC_STRING_DATAVIEW_UL:
|
||||
case ECMA_OBJECT_CLASS_DATAVIEW:
|
||||
{
|
||||
ext_object_size = sizeof (ecma_dataview_object_t);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_DATAVIEW */
|
||||
#if JERRY_ESNEXT
|
||||
case LIT_MAGIC_STRING_GENERATOR_UL:
|
||||
case LIT_MAGIC_STRING_ASYNC_GENERATOR_UL:
|
||||
case ECMA_OBJECT_CLASS_GENERATOR:
|
||||
case ECMA_OBJECT_CLASS_ASYNC_GENERATOR:
|
||||
{
|
||||
ext_object_size = ecma_gc_free_executable_object (object_p);
|
||||
break;
|
||||
}
|
||||
case LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY:
|
||||
case ECMA_OBJECT_CLASS_PROMISE_CAPABILITY:
|
||||
{
|
||||
ext_object_size = sizeof (ecma_promise_capabality_t);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
case LIT_MAGIC_STRING_MODULE_UL:
|
||||
case ECMA_OBJECT_CLASS_MODULE:
|
||||
{
|
||||
ecma_module_release_module ((ecma_module_t *) ext_object_p);
|
||||
ext_object_size = sizeof (ecma_module_t);
|
||||
@@ -1730,12 +1749,8 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
default:
|
||||
{
|
||||
/* The undefined id represents an uninitialized class. */
|
||||
JERRY_ASSERT (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_UNDEFINED
|
||||
|| ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_ARGUMENTS_UL
|
||||
|| ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_BOOLEAN_UL
|
||||
|| ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_ERROR_UL
|
||||
|| ext_object_p->u.class_prop.class_id == LIT_INTERNAL_MAGIC_STRING_INTERNAL_OBJECT);
|
||||
/* The ECMA_OBJECT_CLASS__MAX type represents an uninitialized class. */
|
||||
JERRY_ASSERT (ext_object_p->u.cls.type <= ECMA_OBJECT_CLASS__MAX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1780,62 +1795,6 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
#endif /* JERRY_SNAPSHOT_EXEC */
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
switch (ext_object_p->u.pseudo_array.type)
|
||||
{
|
||||
case ECMA_PSEUDO_ARRAY_ARGUMENTS:
|
||||
{
|
||||
ext_object_size = ecma_free_arguments_object (ext_object_p);
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
ext_object_size = sizeof (ecma_extended_typedarray_object_t);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_ESNEXT
|
||||
case ECMA_PSEUDO_STRING_ITERATOR:
|
||||
{
|
||||
ecma_value_t iterated_value = ext_object_p->u.pseudo_array.u2.iterated_value;
|
||||
|
||||
if (!ecma_is_value_empty (iterated_value))
|
||||
{
|
||||
ecma_deref_ecma_string (ecma_get_string_from_value (iterated_value));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ECMA_PSEUDO_REGEXP_STRING_ITERATOR:
|
||||
{
|
||||
ecma_regexp_string_iterator_t *regexp_string_iterator_obj = (ecma_regexp_string_iterator_t *) object_p;
|
||||
ecma_value_t iterated_string = regexp_string_iterator_obj->iterated_string;
|
||||
|
||||
if (!ecma_is_value_empty (iterated_string))
|
||||
{
|
||||
ecma_deref_ecma_string (ecma_get_string_from_value (iterated_string));
|
||||
}
|
||||
|
||||
ext_object_size = sizeof (ecma_regexp_string_iterator_t);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_TYPEDARRAY
|
||||
|| ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ITERATOR
|
||||
|| ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_SET_ITERATOR
|
||||
|| ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_MAP_ITERATOR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_BOUND_FUNCTION:
|
||||
{
|
||||
ext_object_size = sizeof (ecma_bound_function_t);
|
||||
|
||||
@@ -685,7 +685,6 @@ typedef enum
|
||||
ECMA_OBJECT_TYPE_GENERAL = 0, /**< all objects that are not belongs to the sub-types below. */
|
||||
ECMA_OBJECT_TYPE_CLASS = 1, /**< Objects with class property */
|
||||
ECMA_OBJECT_TYPE_ARRAY = 2, /**< Array object (15.4) */
|
||||
ECMA_OBJECT_TYPE_PSEUDO_ARRAY = 3, /**< Array-like object, such as Arguments object (10.6) */
|
||||
ECMA_OBJECT_TYPE_PROXY = 4, /**< Proxy object ECMAScript v6 26.2 */
|
||||
/* Note: these 4 types must be in this order. See IsCallable operation. */
|
||||
ECMA_OBJECT_TYPE_FUNCTION = 5, /**< Function objects (15.3), created through 13.2 routine */
|
||||
@@ -701,16 +700,69 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ECMA_PSEUDO_ARRAY_ARGUMENTS = 0, /**< Arguments object (10.6) */
|
||||
ECMA_PSEUDO_ARRAY_TYPEDARRAY = 1, /**< TypedArray which does NOT need extra space to store length and offset */
|
||||
ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO = 2, /**< TypedArray which NEEDS extra space to store length and offset */
|
||||
ECMA_PSEUDO_ARRAY_ITERATOR = 3, /**< Array iterator object (ECMAScript v6, 22.1.5.1) */
|
||||
ECMA_PSEUDO_SET_ITERATOR = 4, /**< Set iterator object (ECMAScript v6, 23.2.5.1) */
|
||||
ECMA_PSEUDO_MAP_ITERATOR = 5, /**< Map iterator object (ECMAScript v6, 23.1.5.1) */
|
||||
ECMA_PSEUDO_STRING_ITERATOR = 6, /**< String iterator object (ECMAScript v6, 22.1.5.1) */
|
||||
ECMA_PSEUDO_REGEXP_STRING_ITERATOR = 7, /** RegExp string iterator object (ECMAScript v11, 21.2.7) */
|
||||
ECMA_PSEUDO_ARRAY__MAX = ECMA_PSEUDO_STRING_ITERATOR /**< maximum value */
|
||||
} ecma_pseudo_array_type_t;
|
||||
/* These objects require custom property resolving. */
|
||||
ECMA_OBJECT_CLASS_STRING, /**< String Object (ECMAScript v5.1, 4.3.18) */
|
||||
ECMA_OBJECT_CLASS_ARGUMENTS, /**< Arguments object (10.6) */
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
ECMA_OBJECT_CLASS_TYPEDARRAY, /**< TypedArray which does NOT need extra space to store length and offset */
|
||||
ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO, /**< TypedArray which NEEDS extra space to store length and offset */
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
/* These objects are marked by Garbage Collector. */
|
||||
#if JERRY_ESNEXT
|
||||
ECMA_OBJECT_CLASS_GENERATOR, /**< Generator object (ECMAScript v6, 25.2) */
|
||||
ECMA_OBJECT_CLASS_ASYNC_GENERATOR, /**< Async generator object (ECMAScript v11, 25.3) */
|
||||
ECMA_OBJECT_CLASS_ARRAY_ITERATOR, /**< Array iterator object (ECMAScript v6, 22.1.5.1) */
|
||||
ECMA_OBJECT_CLASS_SET_ITERATOR, /**< Set iterator object (ECMAScript v6, 23.2.5.1) */
|
||||
ECMA_OBJECT_CLASS_MAP_ITERATOR, /**< Map iterator object (ECMAScript v6, 23.1.5.1) */
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR, /** RegExp string iterator object (ECMAScript v11, 21.2.7) */
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
ECMA_OBJECT_CLASS_MODULE, /**< Module (ECMAScript v6, 15.2) */
|
||||
#endif
|
||||
#if JERRY_BUILTIN_PROMISE
|
||||
ECMA_OBJECT_CLASS_PROMISE, /**< Promise (ECMAScript v6, 25.4) */
|
||||
ECMA_OBJECT_CLASS_PROMISE_CAPABILITY, /**< Promise capability (ECMAScript v6, 25.4.1.1) */
|
||||
#endif /* JERRY_BUILTIN_PROMISE */
|
||||
#if JERRY_BUILTIN_DATAVIEW
|
||||
ECMA_OBJECT_CLASS_DATAVIEW, /**< DataView (ECMAScript v6, 24.2) */
|
||||
#endif /* JERRY_BUILTIN_DATAVIEW */
|
||||
#if JERRY_BUILTIN_CONTAINER
|
||||
ECMA_OBJECT_CLASS_CONTAINER, /**< Container (Map, WeakMap, Set, WeakSet) */
|
||||
#endif /* JERRY_BUILTIN_CONTAINER */
|
||||
|
||||
/* Normal objects. */
|
||||
ECMA_OBJECT_CLASS_BOOLEAN, /**< Boolean Object (ECMAScript v5.1, 4.3.15) */
|
||||
ECMA_OBJECT_CLASS_NUMBER, /**< Number Object (ECMAScript v5.1, 4.3.21) */
|
||||
ECMA_OBJECT_CLASS_ERROR, /**< Error Object (ECMAScript v5.1, 15.11) */
|
||||
ECMA_OBJECT_CLASS_INTERNAL_OBJECT, /**< object for internal properties */
|
||||
#if JERRY_PARSER
|
||||
ECMA_OBJECT_CLASS_SCRIPT, /**< Compiled ECMAScript byte code */
|
||||
#endif /* JERRY_PARSER */
|
||||
#if JERRY_BUILTIN_DATE
|
||||
ECMA_OBJECT_CLASS_DATE, /**< Date Object (ECMAScript v5.1, 15.9) */
|
||||
#endif /* JERRY_BUILTIN_DATE */
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
ECMA_OBJECT_CLASS_REGEXP, /**< RegExp Object (ECMAScript v5.1, 15.10) */
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
#if JERRY_ESNEXT
|
||||
ECMA_OBJECT_CLASS_SYMBOL, /**< Symbol object (ECMAScript v6, 4.3.27) */
|
||||
ECMA_OBJECT_CLASS_STRING_ITERATOR, /**< String iterator object (ECMAScript v6, 22.1.5.1) */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
ECMA_OBJECT_CLASS_ARRAY_BUFFER, /**< Array Buffer (ECMAScript v6, 24.1) */
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
ECMA_OBJECT_CLASS_BIGINT, /**< Bigint (ECMAScript v11, 4.3.27) */
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
#if JERRY_BUILTIN_WEAKREF
|
||||
ECMA_OBJECT_CLASS_WEAKREF, /**< WeakRef (Not standardized yet) */
|
||||
#endif /* JERRY_BUILTIN_WEAKREF */
|
||||
|
||||
ECMA_OBJECT_CLASS__MAX /**< maximum value */
|
||||
} ecma_object_class_type_t;
|
||||
|
||||
/**
|
||||
* Types of lexical environments.
|
||||
@@ -960,30 +1012,72 @@ typedef struct
|
||||
|
||||
/**
|
||||
* Description of objects with class.
|
||||
*
|
||||
* Note:
|
||||
* class is a reserved word in c++, so cls is used instead
|
||||
*/
|
||||
struct
|
||||
{
|
||||
uint16_t class_id; /**< class id of the object */
|
||||
uint16_t extra_info; /**< extra information for the object
|
||||
* e.g. array buffer type info (external/internal) */
|
||||
|
||||
uint8_t type; /**< class type of the object */
|
||||
/**
|
||||
* Description of extra fields. These extra fields depend on the class_id.
|
||||
* Description of 8 bit extra fields. These extra fields depend on the type.
|
||||
*/
|
||||
union
|
||||
{
|
||||
uint8_t arguments_flags; /**< arguments object flags */
|
||||
#if JERRY_BUILTIN_DATE
|
||||
uint8_t date_flags; /**< flags for date objects */
|
||||
#endif /* JERRY_BUILTIN_DATE */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
uint8_t module_state; /**< Module state */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
#if JERRY_ESNEXT
|
||||
uint8_t iterator_kind; /**< type of iterator */
|
||||
uint8_t regexp_string_iterator_flags; /**< flags for RegExp string iterator */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_PROMISE
|
||||
uint8_t promise_flags; /**< flags for Promise objects */
|
||||
#endif /* JERRY_BUILTIN_PROMISE */
|
||||
#if JERRY_BUILTIN_CONTAINER
|
||||
uint8_t container_flags; /**< flags for container objects */
|
||||
#endif /* JERRY_BUILTIN_CONTAINER */
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
uint8_t array_buffer_flags; /**< ArrayBuffer flags */
|
||||
uint8_t typedarray_type; /**< type of typed array */
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
} u1;
|
||||
/**
|
||||
* Description of 16 bit extra fields. These extra fields depend on the type.
|
||||
*/
|
||||
union
|
||||
{
|
||||
/* The ecma_object_get_class_name must handle those types which does not use id. */
|
||||
uint16_t id; /**< magic string id of the class */
|
||||
uint16_t formal_params_number; /**< for arguments: formal parameters number */
|
||||
uint16_t iterator_index; /**< for %Iterator%: [[%Iterator%NextIndex]] property */
|
||||
uint16_t executable_obj_flags; /**< executable object flags */
|
||||
} u2;
|
||||
/**
|
||||
* Description of 32 bit / value. These extra fields depend on the type.
|
||||
*/
|
||||
union
|
||||
{
|
||||
ecma_value_t value; /**< value of the object (e.g. boolean, number, string, etc.) */
|
||||
ecma_value_t date; /**< Date object [[DateValue]] internal property */
|
||||
int32_t tza; /**< TimeZone adjustment for date objects */
|
||||
uint32_t length; /**< length related property (e.g. length of ArrayBuffer) */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
uint32_t dfs_ancestor_index; /**< module dfs ancestor index (ES2020 15.2.1.16) */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
ecma_value_t target; /**< [[ProxyTarget]] or [[WeakRefTarget]] internal property */
|
||||
ecma_value_t head; /**< points to the async generator task queue head item */
|
||||
ecma_value_t promise; /**< PromiseCapability[[Promise]] internal slot */
|
||||
} u;
|
||||
} class_prop;
|
||||
ecma_value_t arraybuffer; /**< for typedarray: internal arraybuffer */
|
||||
ecma_value_t iterated_value; /**< for %Iterator%: [[IteratedObject]] property */
|
||||
ecma_value_t spread_value; /**< for spread object: spreaded element */
|
||||
int32_t tza; /**< TimeZone adjustment for date objects */
|
||||
uint32_t length; /**< length related property (e.g. length of ArrayBuffer) */
|
||||
uint32_t arguments_number; /**< for arguments: arguments number */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
uint32_t dfs_ancestor_index; /**< module dfs ancestor index (ES2020 15.2.1.16) */
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
} u3;
|
||||
} cls;
|
||||
|
||||
/**
|
||||
* Description of function objects.
|
||||
@@ -1004,30 +1098,6 @@ typedef struct
|
||||
* a fast access mode array multiplied ECMA_FAST_ACCESS_HOLE_ONE */
|
||||
} array;
|
||||
|
||||
/**
|
||||
* Description of pseudo array objects.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
uint8_t type; /**< pseudo array type, e.g. Arguments, TypedArray, ArrayIterator */
|
||||
uint8_t extra_info; /**< extra information about the object.
|
||||
* e.g. the specific builtin id for typed arrays,
|
||||
* [[IterationKind]] property for %Iterator% */
|
||||
union
|
||||
{
|
||||
uint16_t formal_params_number; /**< for arguments: formal parameters number */
|
||||
uint16_t class_id; /**< for typedarray: the specific class name id */
|
||||
uint16_t iterator_index; /**< for %Iterator%: [[%Iterator%NextIndex]] property */
|
||||
} u1;
|
||||
union
|
||||
{
|
||||
uint32_t arguments_number; /**< for arguments: arguments number */
|
||||
ecma_value_t arraybuffer; /**< for typedarray: internal arraybuffer */
|
||||
ecma_value_t iterated_value; /**< for %Iterator%: [[IteratedObject]] property */
|
||||
ecma_value_t spread_value; /**< for spread object: spreaded element */
|
||||
} u2;
|
||||
} pseudo_array;
|
||||
|
||||
/**
|
||||
* Description of bound function object.
|
||||
*/
|
||||
@@ -1973,7 +2043,7 @@ typedef enum
|
||||
* Check whether the ArrayBuffer has external underlying buffer
|
||||
*/
|
||||
#define ECMA_ARRAYBUFFER_HAS_EXTERNAL_MEMORY(object_p) \
|
||||
((((ecma_extended_object_t *) object_p)->u.class_prop.extra_info & ECMA_ARRAYBUFFER_EXTERNAL_MEMORY) != 0)
|
||||
((((ecma_extended_object_t *) object_p)->u.cls.u1.array_buffer_flags & ECMA_ARRAYBUFFER_EXTERNAL_MEMORY) != 0)
|
||||
|
||||
/**
|
||||
* Struct to store information for ArrayBuffers with external memory.
|
||||
@@ -2065,8 +2135,9 @@ typedef enum
|
||||
/**
|
||||
* Checks whether the executable object is waiting for resuming.
|
||||
*/
|
||||
#define ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED(extra_info) \
|
||||
(!((extra_info) & (ECMA_EXECUTABLE_OBJECT_COMPLETED | ECMA_EXECUTABLE_OBJECT_RUNNING)))
|
||||
#define ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED(executable_object_p) \
|
||||
(!((executable_object_p)->extended_object.u.cls.u2.executable_obj_flags \
|
||||
& (ECMA_EXECUTABLE_OBJECT_COMPLETED | ECMA_EXECUTABLE_OBJECT_RUNNING)))
|
||||
|
||||
/**
|
||||
* Last item of yield* related await states.
|
||||
@@ -2082,7 +2153,7 @@ typedef enum
|
||||
* Resume execution of the byte code.
|
||||
*/
|
||||
#define ECMA_EXECUTABLE_OBJECT_RESUME_EXEC(executable_object_p) \
|
||||
((executable_object_p)->extended_object.u.class_prop.extra_info &= ECMA_EXECUTABLE_OBJECT_RESUME_EXEC_MASK)
|
||||
((executable_object_p)->extended_object.u.cls.u2.executable_obj_flags &= ECMA_EXECUTABLE_OBJECT_RESUME_EXEC_MASK)
|
||||
|
||||
/**
|
||||
* Enqueued task of an AsyncGenerator.
|
||||
@@ -2143,7 +2214,7 @@ typedef enum
|
||||
ECMA_PROMISE_ALLSETTLED_RESOLVE, /**< promise.allSettled resolve */
|
||||
ECMA_PROMISE_ALLSETTLED_REJECT, /**< promise.allSettled reject */
|
||||
ECMA_PROMISE_ANY_REJECT, /**< promise.any reject */
|
||||
} ecma_promise_all_exector_type_t;
|
||||
} ecma_promise_executor_type_t;
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ ecma_module_initialize_context (void)
|
||||
ecma_object_t *obj_p = ecma_create_object (NULL, sizeof (ecma_module_t), ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_MODULE_UL;
|
||||
ext_object_p->u.class_prop.extra_info = JERRY_MODULE_STATE_UNLINKED;
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_MODULE;
|
||||
ext_object_p->u.cls.u1.module_state = JERRY_MODULE_STATE_UNLINKED;
|
||||
|
||||
ecma_module_t *module_p = (ecma_module_t *) obj_p;
|
||||
|
||||
@@ -80,7 +80,7 @@ ecma_module_get_from_object (ecma_value_t module_val) /**< module */
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (module_val);
|
||||
|
||||
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_CLASS);
|
||||
JERRY_ASSERT (((ecma_extended_object_t *) object_p)->u.class_prop.class_id == LIT_MAGIC_STRING_MODULE_UL);
|
||||
JERRY_ASSERT (((ecma_extended_object_t *) object_p)->u.cls.type == ECMA_OBJECT_CLASS_MODULE);
|
||||
|
||||
return (ecma_module_t *) object_p;
|
||||
} /* ecma_module_get_from_object */
|
||||
@@ -219,7 +219,7 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (current_module_p->header.u.class_prop.extra_info == JERRY_MODULE_STATE_NATIVE)
|
||||
if (current_module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_NATIVE)
|
||||
{
|
||||
ecma_object_t *object_p = current_module_p->namespace_object_p;
|
||||
ecma_value_t prop_value = ecma_op_object_find_own (ecma_make_object_value (object_p),
|
||||
@@ -382,17 +382,17 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */
|
||||
ecma_value_t
|
||||
ecma_module_evaluate (ecma_module_t *module_p) /**< module */
|
||||
{
|
||||
if (module_p->header.u.class_prop.extra_info == JERRY_MODULE_STATE_ERROR)
|
||||
if (module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_ERROR)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Module is in error state"));
|
||||
}
|
||||
|
||||
if (module_p->header.u.class_prop.extra_info >= JERRY_MODULE_STATE_EVALUATING)
|
||||
if (module_p->header.u.cls.u1.module_state >= JERRY_MODULE_STATE_EVALUATING)
|
||||
{
|
||||
return ECMA_VALUE_EMPTY;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (module_p->header.u.class_prop.extra_info == JERRY_MODULE_STATE_LINKED);
|
||||
JERRY_ASSERT (module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKED);
|
||||
|
||||
#if JERRY_BUILTIN_REALMS
|
||||
ecma_object_t *global_object_p = (ecma_object_t *) ecma_op_function_get_realm (module_p->compiled_code_p);
|
||||
@@ -400,18 +400,18 @@ ecma_module_evaluate (ecma_module_t *module_p) /**< module */
|
||||
ecma_object_t *global_object_p = ecma_builtin_get_global ();
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
|
||||
module_p->header.u.class_prop.extra_info = JERRY_MODULE_STATE_EVALUATING;
|
||||
module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_EVALUATING;
|
||||
module_p->scope_p = ecma_create_decl_lex_env (ecma_get_global_environment (global_object_p));
|
||||
|
||||
ecma_value_t ret_value;
|
||||
ret_value = vm_run_module (module_p);
|
||||
|
||||
module_p->header.u.class_prop.extra_info = JERRY_MODULE_STATE_ERROR;
|
||||
module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_ERROR;
|
||||
|
||||
if (!ECMA_IS_VALUE_ERROR (ret_value))
|
||||
{
|
||||
ecma_free_value (ret_value);
|
||||
module_p->header.u.class_prop.extra_info = JERRY_MODULE_STATE_EVALUATED;
|
||||
module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_EVALUATED;
|
||||
ret_value = ECMA_VALUE_EMPTY;
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */
|
||||
return result;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (module_p->header.u.class_prop.extra_info == JERRY_MODULE_STATE_EVALUATED);
|
||||
JERRY_ASSERT (module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_EVALUATED);
|
||||
ecma_module_resolve_set_t *resolve_set_p = NULL;
|
||||
ecma_module_resolve_stack_t *stack_p = NULL;
|
||||
|
||||
@@ -688,7 +688,7 @@ ecma_module_connect_imports (ecma_module_t *module_p)
|
||||
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Ambiguous import request"));
|
||||
}
|
||||
|
||||
if (record.module_p->header.u.class_prop.extra_info == JERRY_MODULE_STATE_NATIVE)
|
||||
if (record.module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_NATIVE)
|
||||
{
|
||||
ecma_object_t *object_p = record.module_p->namespace_object_p;
|
||||
prop_value = ecma_op_object_find_own (ecma_make_object_value (object_p), object_p, record.name_p);
|
||||
@@ -827,7 +827,7 @@ ecma_module_get_resolved_module (ecma_value_t module_val) /**< module */
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.class_prop.class_id != LIT_MAGIC_STRING_MODULE_UL)
|
||||
if (ext_object_p->u.cls.type != ECMA_OBJECT_CLASS_MODULE)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -858,12 +858,12 @@ ecma_module_link (ecma_module_t *module_p, /**< root module */
|
||||
jerry_module_resolve_callback_t callback, /**< resolve module callback */
|
||||
void *user_p) /**< pointer passed to the resolve callback */
|
||||
{
|
||||
if (module_p->header.u.class_prop.extra_info != JERRY_MODULE_STATE_UNLINKED)
|
||||
if (module_p->header.u.cls.u1.module_state != JERRY_MODULE_STATE_UNLINKED)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Module must be in unlinked state"));
|
||||
}
|
||||
|
||||
module_p->header.u.class_prop.extra_info = JERRY_MODULE_STATE_LINKING;
|
||||
module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_LINKING;
|
||||
|
||||
uint32_t dfs_index = 0;
|
||||
ecma_module_stack_item_t *last_p;
|
||||
@@ -876,7 +876,7 @@ ecma_module_link (ecma_module_t *module_p, /**< root module */
|
||||
last_p->node_p = module_p->imports_p;
|
||||
last_p->dfs_index = dfs_index;
|
||||
|
||||
module_p->header.u.class_prop.u.dfs_ancestor_index = dfs_index;
|
||||
module_p->header.u.cls.u3.dfs_ancestor_index = dfs_index;
|
||||
|
||||
ecma_value_t module_val = ecma_make_object_value (&module_p->header.object);
|
||||
ecma_module_stack_item_t *current_p = last_p;
|
||||
@@ -919,7 +919,7 @@ restart:
|
||||
node_p->u.path_or_module = resolve_result;
|
||||
ecma_deref_object (ecma_get_object_from_value (resolve_result));
|
||||
|
||||
if (resolved_module_p->header.u.class_prop.extra_info == JERRY_MODULE_STATE_ERROR)
|
||||
if (resolved_module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_ERROR)
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Cannot link to a module which is in error state"));
|
||||
goto error;
|
||||
@@ -938,10 +938,10 @@ restart:
|
||||
{
|
||||
module_p = ecma_module_get_from_object (node_p->u.path_or_module);
|
||||
|
||||
if (module_p->header.u.class_prop.extra_info == JERRY_MODULE_STATE_UNLINKED)
|
||||
if (module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_UNLINKED)
|
||||
{
|
||||
current_p->node_p = node_p->next_p;
|
||||
module_p->header.u.class_prop.extra_info = JERRY_MODULE_STATE_LINKING;
|
||||
module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_LINKING;
|
||||
|
||||
ecma_module_stack_item_t *item_p;
|
||||
item_p = (ecma_module_stack_item_t *) jmem_heap_alloc_block (sizeof (ecma_module_stack_item_t));
|
||||
@@ -954,7 +954,7 @@ restart:
|
||||
item_p->node_p = module_p->imports_p;
|
||||
item_p->dfs_index = dfs_index;
|
||||
|
||||
module_p->header.u.class_prop.u.dfs_ancestor_index = dfs_index;
|
||||
module_p->header.u.cls.u3.dfs_ancestor_index = dfs_index;
|
||||
|
||||
last_p = item_p;
|
||||
current_p = item_p;
|
||||
@@ -962,29 +962,29 @@ restart:
|
||||
goto restart;
|
||||
}
|
||||
|
||||
if (module_p->header.u.class_prop.extra_info == JERRY_MODULE_STATE_LINKING)
|
||||
if (module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKING)
|
||||
{
|
||||
uint32_t dfs_ancestor_index = module_p->header.u.class_prop.u.dfs_ancestor_index;
|
||||
uint32_t dfs_ancestor_index = module_p->header.u.cls.u3.dfs_ancestor_index;
|
||||
|
||||
if (dfs_ancestor_index < current_module_p->header.u.class_prop.u.dfs_ancestor_index)
|
||||
if (dfs_ancestor_index < current_module_p->header.u.cls.u3.dfs_ancestor_index)
|
||||
{
|
||||
current_module_p->header.u.class_prop.u.dfs_ancestor_index = dfs_ancestor_index;
|
||||
current_module_p->header.u.cls.u3.dfs_ancestor_index = dfs_ancestor_index;
|
||||
}
|
||||
}
|
||||
|
||||
node_p = node_p->next_p;
|
||||
}
|
||||
|
||||
if (current_module_p->header.u.class_prop.u.dfs_ancestor_index != current_p->dfs_index)
|
||||
if (current_module_p->header.u.cls.u3.dfs_ancestor_index != current_p->dfs_index)
|
||||
{
|
||||
current_p = current_p->parent_p;
|
||||
JERRY_ASSERT (current_p != NULL);
|
||||
|
||||
uint32_t dfs_ancestor_index = current_module_p->header.u.class_prop.u.dfs_ancestor_index;
|
||||
uint32_t dfs_ancestor_index = current_module_p->header.u.cls.u3.dfs_ancestor_index;
|
||||
|
||||
if (dfs_ancestor_index < current_p->module_p->header.u.class_prop.u.dfs_ancestor_index)
|
||||
if (dfs_ancestor_index < current_p->module_p->header.u.cls.u3.dfs_ancestor_index)
|
||||
{
|
||||
current_p->module_p->header.u.class_prop.u.dfs_ancestor_index = dfs_ancestor_index;
|
||||
current_p->module_p->header.u.cls.u3.dfs_ancestor_index = dfs_ancestor_index;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -996,8 +996,8 @@ restart:
|
||||
{
|
||||
ecma_module_stack_item_t *prev_p = last_p->prev_p;
|
||||
|
||||
JERRY_ASSERT (last_p->module_p->header.u.class_prop.extra_info == JERRY_MODULE_STATE_LINKING);
|
||||
last_p->module_p->header.u.class_prop.extra_info = JERRY_MODULE_STATE_LINKED;
|
||||
JERRY_ASSERT (last_p->module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKING);
|
||||
last_p->module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_LINKED;
|
||||
|
||||
jmem_heap_free_block (last_p, sizeof (ecma_module_stack_item_t));
|
||||
last_p = prev_p;
|
||||
@@ -1017,8 +1017,8 @@ error:
|
||||
{
|
||||
ecma_module_stack_item_t *prev_p = last_p->prev_p;
|
||||
|
||||
JERRY_ASSERT (last_p->module_p->header.u.class_prop.extra_info == JERRY_MODULE_STATE_LINKING);
|
||||
last_p->module_p->header.u.class_prop.extra_info = JERRY_MODULE_STATE_UNLINKED;
|
||||
JERRY_ASSERT (last_p->module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKING);
|
||||
last_p->module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_UNLINKED;
|
||||
|
||||
jmem_heap_free_block (last_p, sizeof (ecma_module_stack_item_t));
|
||||
last_p = prev_p;
|
||||
@@ -1075,7 +1075,7 @@ ecma_module_release_module_nodes (ecma_module_node_t *module_node_p, /**< first
|
||||
void
|
||||
ecma_module_release_module (ecma_module_t *module_p) /**< module */
|
||||
{
|
||||
jerry_module_state_t state = (jerry_module_state_t) module_p->header.u.class_prop.extra_info;
|
||||
jerry_module_state_t state = (jerry_module_state_t) module_p->header.u.cls.u1.module_state;
|
||||
|
||||
JERRY_ASSERT (state != JERRY_MODULE_STATE_INVALID);
|
||||
|
||||
|
||||
@@ -63,13 +63,13 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
/* 3. */
|
||||
if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_PSEUDO_ARRAY
|
||||
|| ext_obj_p->u.pseudo_array.type != ECMA_PSEUDO_ARRAY_ITERATOR)
|
||||
if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_CLASS
|
||||
|| ext_obj_p->u.cls.type != ECMA_OBJECT_CLASS_ARRAY_ITERATOR)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator"));
|
||||
}
|
||||
|
||||
ecma_value_t iterated_value = ext_obj_p->u.pseudo_array.u2.iterated_value;
|
||||
ecma_value_t iterated_value = ext_obj_p->u.cls.u3.iterated_value;
|
||||
|
||||
/* 4 - 5 */
|
||||
if (ecma_is_value_empty (iterated_value))
|
||||
@@ -103,7 +103,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
|
||||
}
|
||||
}
|
||||
|
||||
ecma_length_t index = ext_obj_p->u.pseudo_array.u1.iterator_index;
|
||||
ecma_length_t index = ext_obj_p->u.cls.u2.iterator_index;
|
||||
|
||||
if (JERRY_UNLIKELY (index == ECMA_ITERATOR_INDEX_LIMIT))
|
||||
{
|
||||
@@ -129,17 +129,17 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
|
||||
else
|
||||
{
|
||||
/* 11. */
|
||||
ext_obj_p->u.pseudo_array.u1.iterator_index++;
|
||||
ext_obj_p->u.cls.u2.iterator_index++;
|
||||
}
|
||||
|
||||
if (index >= length)
|
||||
{
|
||||
ext_obj_p->u.pseudo_array.u2.iterated_value = ECMA_VALUE_EMPTY;
|
||||
ext_obj_p->u.cls.u3.iterated_value = ECMA_VALUE_EMPTY;
|
||||
return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);
|
||||
}
|
||||
|
||||
/* 7. */
|
||||
uint8_t iterator_kind = ext_obj_p->u.pseudo_array.extra_info;
|
||||
uint8_t iterator_kind = ext_obj_p->u.cls.u1.iterator_kind;
|
||||
|
||||
if (iterator_kind == ECMA_ITERATOR_KEYS)
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ ecma_builtin_arraybuffer_prototype_bytelength_getter (ecma_value_t this_arg) /**
|
||||
{
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
if (ecma_object_class_is (object_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL))
|
||||
if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))
|
||||
{
|
||||
if (ecma_arraybuffer_is_detached (object_p))
|
||||
{
|
||||
@@ -98,7 +98,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
/* 2. */
|
||||
if (!ecma_object_class_is (object_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL))
|
||||
if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an ArrayBuffer object"));
|
||||
}
|
||||
@@ -168,7 +168,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
|
||||
/* 13. */
|
||||
if (!ecma_object_class_is (new_arraybuffer_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL))
|
||||
if (!ecma_object_class_is (new_arraybuffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Return value is not an ArrayBuffer object"));
|
||||
goto free_new_arraybuffer;
|
||||
|
||||
@@ -106,7 +106,7 @@ ecma_builtin_async_generator_prototype_dispatch_routine (uint8_t builtin_routine
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_ASYNC_GENERATOR_UL)
|
||||
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_ASYNC_GENERATOR)
|
||||
{
|
||||
executable_object_p = (vm_executable_object_t *) ext_object_p;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ ecma_builtin_async_generator_prototype_dispatch_routine (uint8_t builtin_routine
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an async generator object"));
|
||||
}
|
||||
|
||||
if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_COMPLETED)
|
||||
if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED)
|
||||
{
|
||||
ecma_value_t promise = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE));
|
||||
|
||||
|
||||
@@ -72,13 +72,13 @@ ecma_builtin_bigint_prototype_object_value_of (ecma_value_t this_arg) /**< this
|
||||
{
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
if (ecma_object_class_is (object_p, LIT_MAGIC_STRING_BIGINT_UL))
|
||||
if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_BIGINT))
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_bigint (ext_object_p->u.class_prop.u.value));
|
||||
JERRY_ASSERT (ecma_is_value_bigint (ext_object_p->u.cls.u3.value));
|
||||
|
||||
return ecma_copy_value (ext_object_p->u.class_prop.u.value);
|
||||
return ecma_copy_value (ext_object_p->u.cls.u3.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,13 +78,13 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_value_t this_arg) /**< this
|
||||
{
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
if (ecma_object_class_is (object_p, LIT_MAGIC_STRING_BOOLEAN_UL))
|
||||
if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_BOOLEAN))
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_boolean (ext_object_p->u.class_prop.u.value));
|
||||
JERRY_ASSERT (ecma_is_value_boolean (ext_object_p->u.cls.u3.value));
|
||||
|
||||
return ext_object_p->u.class_prop.u.value;
|
||||
return ext_object_p->u.cls.u3.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ ecma_builtin_dataview_prototype_object_getters (ecma_value_t this_arg, /**< this
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached"));
|
||||
}
|
||||
return ecma_make_uint32_value (obj_p->header.u.class_prop.u.length);
|
||||
return ecma_make_uint32_value (obj_p->header.u.cls.u3.length);
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
||||
@@ -405,7 +405,7 @@ ecma_builtin_date_prototype_dispatch_set (uint16_t builtin_routine_id, /**< buil
|
||||
ecma_number_t *date_value_p = &date_object_p->date_value;
|
||||
#else /* !JERRY_ESNEXT */
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ecma_number_t *date_value_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, ext_object_p->u.class_prop.u.date);
|
||||
ecma_number_t *date_value_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, ext_object_p->u.cls.u3.date);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ecma_number_t date_value = *date_value_p;
|
||||
@@ -415,9 +415,9 @@ ecma_builtin_date_prototype_dispatch_set (uint16_t builtin_routine_id, /**< buil
|
||||
ecma_number_t local_tza;
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
if (date_object_p->header.u.class_prop.extra_info & ECMA_DATE_TZA_SET)
|
||||
if (date_object_p->header.u.cls.u1.date_flags & ECMA_DATE_TZA_SET)
|
||||
{
|
||||
local_tza = date_object_p->header.u.class_prop.u.tza;
|
||||
local_tza = date_object_p->header.u.cls.u3.tza;
|
||||
JERRY_ASSERT (local_tza == ecma_date_local_time_zone_adjustment (date_value));
|
||||
}
|
||||
else
|
||||
@@ -601,7 +601,7 @@ ecma_builtin_date_prototype_dispatch_set (uint16_t builtin_routine_id, /**< buil
|
||||
*date_value_p = full_date;
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
date_object_p->header.u.class_prop.extra_info &= (uint16_t) ~ECMA_DATE_TZA_SET;
|
||||
date_object_p->header.u.cls.u1.date_flags &= (uint8_t) ~ECMA_DATE_TZA_SET;
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
return ecma_make_number_value (full_date);
|
||||
@@ -637,7 +637,7 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
if (!ecma_is_value_object (this_arg)
|
||||
|| !ecma_object_class_is (ecma_get_object_from_value (this_arg), LIT_MAGIC_STRING_DATE_UL))
|
||||
|| !ecma_object_class_is (ecma_get_object_from_value (this_arg), ECMA_OBJECT_CLASS_DATE))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Date object"));
|
||||
}
|
||||
@@ -647,11 +647,10 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b
|
||||
#if JERRY_ESNEXT
|
||||
ecma_date_object_t *date_object_p = (ecma_date_object_t *) this_obj_p;
|
||||
ecma_number_t *date_value_p = &date_object_p->date_value;
|
||||
#else
|
||||
#else /* JERRY_ESNEXT */
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) this_obj_p;
|
||||
ecma_number_t *date_value_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t,
|
||||
ext_object_p->u.class_prop.u.date);
|
||||
#endif
|
||||
ecma_number_t *date_value_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, ext_object_p->u.cls.u3.date);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ecma_number_t date_value = *date_value_p;
|
||||
|
||||
@@ -683,9 +682,9 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b
|
||||
{
|
||||
ecma_number_t local_tza;
|
||||
#if JERRY_ESNEXT
|
||||
if (date_object_p->header.u.class_prop.extra_info & ECMA_DATE_TZA_SET)
|
||||
if (date_object_p->header.u.cls.u1.date_flags & ECMA_DATE_TZA_SET)
|
||||
{
|
||||
local_tza = date_object_p->header.u.class_prop.u.tza;
|
||||
local_tza = date_object_p->header.u.cls.u3.tza;
|
||||
JERRY_ASSERT (local_tza == ecma_date_local_time_zone_adjustment (date_value));
|
||||
}
|
||||
else
|
||||
@@ -694,8 +693,8 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b
|
||||
local_tza = ecma_date_local_time_zone_adjustment (date_value);
|
||||
#if JERRY_ESNEXT
|
||||
JERRY_ASSERT (local_tza <= INT32_MAX && local_tza >= INT32_MIN);
|
||||
date_object_p->header.u.class_prop.u.tza = (int32_t) local_tza;
|
||||
date_object_p->header.u.class_prop.extra_info |= ECMA_DATE_TZA_SET;
|
||||
date_object_p->header.u.cls.u3.tza = (int32_t) local_tza;
|
||||
date_object_p->header.u.cls.u1.date_flags |= ECMA_DATE_TZA_SET;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -737,9 +737,10 @@ ecma_builtin_date_create (ecma_number_t tv)
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
ecma_date_object_t *date_object_p = (ecma_date_object_t *) obj_p;
|
||||
date_object_p->header.u.class_prop.class_id = LIT_MAGIC_STRING_DATE_UL;
|
||||
date_object_p->header.u.class_prop.u.tza = 0;
|
||||
date_object_p->header.u.class_prop.extra_info = ECMA_DATE_TZA_NONE;
|
||||
date_object_p->header.u.cls.type = ECMA_OBJECT_CLASS_DATE;
|
||||
date_object_p->header.u.cls.u1.date_flags = ECMA_DATE_TZA_NONE;
|
||||
date_object_p->header.u.cls.u2.id = LIT_MAGIC_STRING_DATE_UL;
|
||||
date_object_p->header.u.cls.u3.tza = 0;
|
||||
date_object_p->date_value = tv;
|
||||
#else /* !JERRY_ESNEXT */
|
||||
ecma_number_t *date_value_p = ecma_alloc_number ();
|
||||
@@ -749,8 +750,9 @@ ecma_builtin_date_create (ecma_number_t tv)
|
||||
ecma_object_t *obj_p = ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_DATE_UL;
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p->u.class_prop.u.date, date_value_p);
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_DATE;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_DATE_UL;
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p->u.cls.u3.date, date_value_p);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
return ecma_make_object_value (obj_p);
|
||||
@@ -802,14 +804,14 @@ ecma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**<
|
||||
|
||||
/* 4.a */
|
||||
if (ecma_is_value_object (argument)
|
||||
&& ecma_object_class_is (ecma_get_object_from_value (argument), LIT_MAGIC_STRING_DATE_UL))
|
||||
&& ecma_object_class_is (ecma_get_object_from_value (argument), ECMA_OBJECT_CLASS_DATE))
|
||||
{
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
tv = ((ecma_date_object_t *) ecma_get_object_from_value (argument))->date_value;
|
||||
#else /* !JERRY_ESNEXT */
|
||||
ecma_extended_object_t *arg_ext_object_p = (ecma_extended_object_t *) ecma_get_object_from_value (argument);
|
||||
tv = *ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, arg_ext_object_p->u.class_prop.u.date);
|
||||
tv = *ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, arg_ext_object_p->u.cls.u3.date);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
return ecma_builtin_date_create (tv);
|
||||
|
||||
@@ -91,7 +91,7 @@ ecma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_ob
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (generator_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)
|
||||
if (generator_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)
|
||||
{
|
||||
ecma_value_t iterator = generator_object_p->frame_ctx.block_result;
|
||||
ecma_value_t next_method = generator_object_p->frame_ctx.stack_top_p[-1];
|
||||
@@ -149,7 +149,8 @@ ecma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_ob
|
||||
return value;
|
||||
}
|
||||
|
||||
bool done = (generator_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_COMPLETED);
|
||||
bool done;
|
||||
done = (generator_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED);
|
||||
|
||||
if (!done)
|
||||
{
|
||||
@@ -173,7 +174,7 @@ ecma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_ob
|
||||
}
|
||||
|
||||
ecma_deref_object (ecma_get_object_from_value (iterator));
|
||||
generator_object_p->extended_object.u.class_prop.extra_info |= ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD;
|
||||
generator_object_p->extended_object.u.cls.u2.executable_obj_flags |= ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD;
|
||||
generator_object_p->frame_ctx.block_result = iterator;
|
||||
|
||||
if (generator_object_p->frame_ctx.stack_top_p[0] != ECMA_VALUE_UNDEFINED)
|
||||
@@ -219,7 +220,7 @@ ecma_builtin_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_GENERATOR_UL)
|
||||
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_GENERATOR)
|
||||
{
|
||||
executable_object_p = (vm_executable_object_t *) ext_object_p;
|
||||
}
|
||||
@@ -231,12 +232,12 @@ ecma_builtin_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a generator object"));
|
||||
}
|
||||
|
||||
if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_RUNNING)
|
||||
if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_RUNNING)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Generator is currently under execution"));
|
||||
}
|
||||
|
||||
if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_COMPLETED)
|
||||
if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED)
|
||||
{
|
||||
if (builtin_routine_id != ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW)
|
||||
{
|
||||
|
||||
@@ -39,9 +39,13 @@ typedef enum
|
||||
ECMA_NATIVE_HANDLER_FLAGS_NONE = 0,
|
||||
ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED = (1 << 0),
|
||||
ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED = (1 << 1),
|
||||
ECMA_NATIVE_HANDLER_FLAGS_PROMISE_ALREADY_RESOLVED = (1 << 2),
|
||||
} ecma_native_handler_flags_t;
|
||||
|
||||
/**
|
||||
* Shift for Promise helper handler function.
|
||||
*/
|
||||
#define ECMA_NATIVE_HANDLER_FLAGS_PROMISE_HELPER_SHIFT 2
|
||||
|
||||
ecma_builtin_handler_t
|
||||
ecma_builtin_handler_get (ecma_native_handler_id_t id);
|
||||
uint8_t
|
||||
|
||||
@@ -116,7 +116,7 @@ ecma_builtin_intrinsic_map_prototype_entries (ecma_value_t this_value)
|
||||
|
||||
return ecma_op_container_create_iterator (this_value,
|
||||
ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE,
|
||||
ECMA_PSEUDO_MAP_ITERATOR,
|
||||
ECMA_OBJECT_CLASS_MAP_ITERATOR,
|
||||
ECMA_ITERATOR_ENTRIES);
|
||||
} /* ecma_builtin_intrinsic_map_prototype_entries */
|
||||
|
||||
@@ -142,7 +142,7 @@ ecma_builtin_intrinsic_set_prototype_values (ecma_value_t this_value)
|
||||
|
||||
return ecma_op_container_create_iterator (this_value,
|
||||
ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE,
|
||||
ECMA_PSEUDO_SET_ITERATOR,
|
||||
ECMA_OBJECT_CLASS_SET_ITERATOR,
|
||||
ECMA_ITERATOR_VALUES);
|
||||
} /* ecma_builtin_intrinsic_set_prototype_values */
|
||||
|
||||
@@ -205,7 +205,7 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
|
||||
case ECMA_INTRINSIC_DATE_TO_UTC_STRING:
|
||||
{
|
||||
if (!ecma_is_value_object (this_arg)
|
||||
|| !ecma_object_class_is (ecma_get_object_from_value (this_arg), LIT_MAGIC_STRING_DATE_UL))
|
||||
|| !ecma_object_class_is (ecma_get_object_from_value (this_arg), ECMA_OBJECT_CLASS_DATE))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Date object"));
|
||||
}
|
||||
|
||||
@@ -1314,51 +1314,60 @@ ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
|
||||
if (ecma_is_value_object (value))
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (value);
|
||||
lit_magic_string_id_t class_name = ecma_object_get_class_name (obj_p);
|
||||
|
||||
/* 5.a */
|
||||
if (class_name == LIT_MAGIC_STRING_NUMBER_UL)
|
||||
if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_CLASS)
|
||||
{
|
||||
ecma_number_t num;
|
||||
value = ecma_op_to_number (value, &num);
|
||||
ecma_deref_object (obj_p);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (value))
|
||||
switch (((ecma_extended_object_t *) obj_p)->u.cls.type)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
/* 5.a */
|
||||
case ECMA_OBJECT_CLASS_NUMBER:
|
||||
{
|
||||
ecma_number_t num;
|
||||
value = ecma_op_to_number (value, &num);
|
||||
ecma_deref_object (obj_p);
|
||||
|
||||
value = ecma_make_number_value (num);
|
||||
}
|
||||
/* 5.b */
|
||||
else if (class_name == LIT_MAGIC_STRING_STRING_UL)
|
||||
{
|
||||
ecma_string_t *str_p = ecma_op_to_string (value);
|
||||
ecma_deref_object (obj_p);
|
||||
if (ECMA_IS_VALUE_ERROR (value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
if (JERRY_UNLIKELY (str_p == NULL))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
value = ecma_make_number_value (num);
|
||||
break;
|
||||
}
|
||||
/* 5.b */
|
||||
case ECMA_OBJECT_CLASS_STRING:
|
||||
{
|
||||
ecma_string_t *str_p = ecma_op_to_string (value);
|
||||
ecma_deref_object (obj_p);
|
||||
|
||||
value = ecma_make_string_value (str_p);
|
||||
}
|
||||
/* 5.c */
|
||||
else if (class_name == LIT_MAGIC_STRING_BOOLEAN_UL)
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
value = ext_object_p->u.class_prop.u.value;
|
||||
ecma_deref_object (obj_p);
|
||||
}
|
||||
if (JERRY_UNLIKELY (str_p == NULL))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
value = ecma_make_string_value (str_p);
|
||||
break;
|
||||
}
|
||||
/* 5.c */
|
||||
case ECMA_OBJECT_CLASS_BOOLEAN:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
value = ext_object_p->u.cls.u3.value;
|
||||
ecma_deref_object (obj_p);
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
/* 5.d */
|
||||
else if (class_name == LIT_MAGIC_STRING_BIGINT_UL)
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
value = ecma_copy_value (ext_object_p->u.class_prop.u.value);
|
||||
ecma_deref_object (obj_p);
|
||||
}
|
||||
/* 5.d */
|
||||
case ECMA_OBJECT_CLASS_BIGINT:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
value = ecma_copy_value (ext_object_p->u.cls.u3.value);
|
||||
ecma_deref_object (obj_p);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 6. - 8. */
|
||||
@@ -1616,20 +1625,24 @@ ecma_builtin_json_stringify (ecma_value_t this_arg, /**< 'this' argument */
|
||||
else if (ecma_is_value_object (value))
|
||||
{
|
||||
ecma_object_t *value_obj_p = ecma_get_object_from_value (value);
|
||||
lit_magic_string_id_t class_id = ecma_object_get_class_name (value_obj_p);
|
||||
|
||||
if (class_id == LIT_MAGIC_STRING_NUMBER_UL || class_id == LIT_MAGIC_STRING_STRING_UL)
|
||||
if (ecma_get_object_type (value_obj_p) == ECMA_OBJECT_TYPE_CLASS)
|
||||
{
|
||||
ecma_string_t *str_p = ecma_op_to_string (value);
|
||||
uint8_t class_type = ((ecma_extended_object_t *) value_obj_p)->u.cls.type;
|
||||
|
||||
if (JERRY_UNLIKELY (str_p == NULL))
|
||||
if (class_type == ECMA_OBJECT_CLASS_NUMBER || class_type == ECMA_OBJECT_CLASS_STRING)
|
||||
{
|
||||
ecma_collection_free (context.property_list_p);
|
||||
ecma_free_value (value);
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
ecma_string_t *str_p = ecma_op_to_string (value);
|
||||
|
||||
item = ecma_make_string_value (str_p);
|
||||
if (JERRY_UNLIKELY (str_p == NULL))
|
||||
{
|
||||
ecma_collection_free (context.property_list_p);
|
||||
ecma_free_value (value);
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
item = ecma_make_string_value (str_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1657,52 +1670,54 @@ ecma_builtin_json_stringify (ecma_value_t this_arg, /**< 'this' argument */
|
||||
}
|
||||
}
|
||||
|
||||
ecma_value_t space;
|
||||
ecma_value_t space = ECMA_VALUE_EMPTY;
|
||||
|
||||
/* 5. */
|
||||
if (ecma_is_value_object (arg3))
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (arg3);
|
||||
lit_magic_string_id_t class_name = ecma_object_get_class_name (obj_p);
|
||||
|
||||
/* 5.a */
|
||||
if (class_name == LIT_MAGIC_STRING_NUMBER_UL)
|
||||
if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_CLASS)
|
||||
{
|
||||
ecma_number_t num;
|
||||
ecma_value_t value = ecma_op_to_number (arg3, &num);
|
||||
uint8_t class_type = ((ecma_extended_object_t *) obj_p)->u.cls.type;
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (value))
|
||||
/* 5.a */
|
||||
if (class_type == ECMA_OBJECT_CLASS_NUMBER)
|
||||
{
|
||||
if (context.property_list_p != NULL)
|
||||
{
|
||||
ecma_collection_free (context.property_list_p);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
space = ecma_make_number_value (num);
|
||||
}
|
||||
/* 5.b */
|
||||
else if (class_name == LIT_MAGIC_STRING_STRING_UL)
|
||||
{
|
||||
ecma_string_t *value_str_p = ecma_op_to_string (arg3);
|
||||
ecma_number_t num;
|
||||
ecma_value_t value = ecma_op_to_number (arg3, &num);
|
||||
|
||||
if (JERRY_UNLIKELY (value_str_p == NULL))
|
||||
if (ECMA_IS_VALUE_ERROR (value))
|
||||
{
|
||||
if (context.property_list_p != NULL)
|
||||
{
|
||||
ecma_collection_free (context.property_list_p);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
space = ecma_make_number_value (num);
|
||||
}
|
||||
/* 5.b */
|
||||
else if (class_type == ECMA_OBJECT_CLASS_STRING)
|
||||
{
|
||||
if (context.property_list_p != NULL)
|
||||
{
|
||||
ecma_collection_free (context.property_list_p);
|
||||
}
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
ecma_string_t *value_str_p = ecma_op_to_string (arg3);
|
||||
|
||||
space = ecma_make_string_value (value_str_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
space = ecma_copy_value (arg3);
|
||||
if (JERRY_UNLIKELY (value_str_p == NULL))
|
||||
{
|
||||
if (context.property_list_p != NULL)
|
||||
{
|
||||
ecma_collection_free (context.property_list_p);
|
||||
}
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
space = ecma_make_string_value (value_str_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (space == ECMA_VALUE_EMPTY)
|
||||
{
|
||||
space = ecma_copy_value (arg3);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
static ecma_value_t
|
||||
ecma_builtin_map_iterator_prototype_object_next (ecma_value_t this_val) /**< this argument */
|
||||
{
|
||||
return ecma_op_container_iterator_next (this_val, ECMA_PSEUDO_MAP_ITERATOR);
|
||||
return ecma_op_container_iterator_next (this_val, ECMA_OBJECT_CLASS_MAP_ITERATOR);
|
||||
} /* ecma_builtin_map_iterator_prototype_object_next */
|
||||
|
||||
/**
|
||||
|
||||
@@ -446,13 +446,13 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this_arg) /**< this
|
||||
{
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
if (ecma_object_class_is (object_p, LIT_MAGIC_STRING_NUMBER_UL))
|
||||
if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_NUMBER))
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_number (ext_object_p->u.class_prop.u.value));
|
||||
JERRY_ASSERT (ecma_is_value_number (ext_object_p->u.cls.u3.value));
|
||||
|
||||
return ext_object_p->u.class_prop.u.value;
|
||||
return ext_object_p->u.cls.u3.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ static inline ecma_value_t
|
||||
ecma_builtin_promise_reject_abrupt (ecma_value_t value, /**< value */
|
||||
ecma_object_t *capability_obj_p) /**< capability */
|
||||
{
|
||||
JERRY_ASSERT (ecma_object_class_is (capability_obj_p, LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY));
|
||||
JERRY_ASSERT (ecma_object_class_is (capability_obj_p, ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));
|
||||
|
||||
if (!ECMA_IS_VALUE_ERROR (value))
|
||||
{
|
||||
@@ -101,7 +101,7 @@ ecma_builtin_promise_reject_abrupt (ecma_value_t value, /**< value */
|
||||
|
||||
ecma_free_value (call_ret);
|
||||
|
||||
return ecma_copy_value (capability_p->header.u.class_prop.u.promise);
|
||||
return ecma_copy_value (capability_p->header.u.cls.u3.promise);
|
||||
} /* ecma_builtin_promise_reject_abrupt */
|
||||
|
||||
/**
|
||||
@@ -122,7 +122,7 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for
|
||||
bool *done_p) /**< [out] iteratorRecord[[done]] */
|
||||
{
|
||||
JERRY_ASSERT (ecma_is_value_object (iterator));
|
||||
JERRY_ASSERT (ecma_object_class_is (capability_obj_p, LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY));
|
||||
JERRY_ASSERT (ecma_object_class_is (capability_obj_p, ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));
|
||||
JERRY_ASSERT (ecma_is_constructor (ctor));
|
||||
|
||||
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;
|
||||
@@ -145,7 +145,7 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for
|
||||
if (ecma_is_value_false (next))
|
||||
{
|
||||
/* ii. */
|
||||
ret_value = ecma_copy_value (capability_p->header.u.class_prop.u.promise);
|
||||
ret_value = ecma_copy_value (capability_p->header.u.cls.u3.promise);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
|
||||
bool *done_p) /**< [out] iteratorRecord[[done]] */
|
||||
{
|
||||
/* 1. - 2. */
|
||||
JERRY_ASSERT (ecma_object_class_is (capability_obj_p, LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY));
|
||||
JERRY_ASSERT (ecma_object_class_is (capability_obj_p, ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));
|
||||
JERRY_ASSERT (ecma_is_constructor (ctor));
|
||||
|
||||
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;
|
||||
@@ -261,7 +261,7 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
|
||||
}
|
||||
|
||||
/* iv. */
|
||||
ret_value = ecma_copy_value (capability_p->header.u.class_prop.u.promise);
|
||||
ret_value = ecma_copy_value (capability_p->header.u.cls.u3.promise);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -320,13 +320,16 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
|
||||
|
||||
/* p. */
|
||||
executor_p->remaining_elements = remaining;
|
||||
executor_p->header.u.class_prop.extra_info = ECMA_PROMISE_ALL_RESOLVE;
|
||||
|
||||
uint8_t executor_type = ECMA_PROMISE_ALL_RESOLVE << ECMA_NATIVE_HANDLER_FLAGS_PROMISE_HELPER_SHIFT;
|
||||
|
||||
if (builtin_routine_id == ECMA_PROMISE_ROUTINE_ALLSETTLED)
|
||||
{
|
||||
executor_p->header.u.class_prop.extra_info = ECMA_PROMISE_ALLSETTLED_RESOLVE;
|
||||
executor_type = ECMA_PROMISE_ALLSETTLED_RESOLVE << ECMA_NATIVE_HANDLER_FLAGS_PROMISE_HELPER_SHIFT;
|
||||
}
|
||||
|
||||
executor_p->header.u.built_in.u2.routine_flags |= executor_type;
|
||||
|
||||
args[0] = ecma_make_object_value (executor_func_p);
|
||||
}
|
||||
else
|
||||
@@ -340,22 +343,22 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
|
||||
|
||||
if (builtin_routine_id != ECMA_PROMISE_ROUTINE_ALL)
|
||||
{
|
||||
ecma_promise_all_exector_type_t type = ECMA_PROMISE_ALLSETTLED_REJECT;
|
||||
uint8_t executor_type = ECMA_PROMISE_ALLSETTLED_REJECT << ECMA_NATIVE_HANDLER_FLAGS_PROMISE_HELPER_SHIFT;
|
||||
|
||||
if (builtin_routine_id == ECMA_PROMISE_ROUTINE_ANY)
|
||||
{
|
||||
type = ECMA_PROMISE_ANY_REJECT;
|
||||
executor_type = ECMA_PROMISE_ANY_REJECT << ECMA_NATIVE_HANDLER_FLAGS_PROMISE_HELPER_SHIFT;
|
||||
}
|
||||
|
||||
ecma_object_t *reject_func_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER,
|
||||
sizeof (ecma_promise_all_executor_t));
|
||||
sizeof (ecma_promise_all_executor_t));
|
||||
|
||||
ecma_promise_all_executor_t *reject_p = (ecma_promise_all_executor_t *) reject_func_p;
|
||||
reject_p->index = idx;
|
||||
reject_p->values = values_array;
|
||||
reject_p->capability = ecma_make_object_value (capability_obj_p);
|
||||
reject_p->remaining_elements = remaining;
|
||||
reject_p->header.u.class_prop.extra_info = (uint16_t) type;
|
||||
reject_p->header.u.built_in.u2.routine_flags |= executor_type;
|
||||
args[1] = ecma_make_object_value (reject_func_p);
|
||||
result = ecma_op_invoke_by_magic_id (next_promise, LIT_MAGIC_STRING_THEN, args, 2);
|
||||
ecma_deref_object (reject_func_p);
|
||||
|
||||
@@ -96,8 +96,7 @@ static ecma_value_t
|
||||
ecma_builtin_regexp_prototype_flags_helper (ecma_extended_object_t *re_obj_p, /**< this object */
|
||||
uint16_t builtin_routine_id) /**< id of the flag */
|
||||
{
|
||||
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
|
||||
re_obj_p->u.class_prop.u.value);
|
||||
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, re_obj_p->u.cls.u3.value);
|
||||
|
||||
uint16_t flags = bc_p->header.status_flags;
|
||||
|
||||
@@ -253,8 +252,7 @@ ecma_op_escape_regexp_pattern (ecma_string_t *pattern_str_p) /**< RegExp pattern
|
||||
static ecma_value_t
|
||||
ecma_builtin_regexp_prototype_get_source (ecma_extended_object_t *re_obj_p) /**< this argument */
|
||||
{
|
||||
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
|
||||
re_obj_p->u.class_prop.u.value);
|
||||
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, re_obj_p->u.cls.u3.value);
|
||||
|
||||
return ecma_op_escape_regexp_pattern (ecma_get_string_from_value (bc_p->source));
|
||||
} /* ecma_builtin_regexp_prototype_get_source */
|
||||
@@ -286,8 +284,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this */
|
||||
|
||||
ecma_object_t *this_obj_p = ecma_get_object_from_value (this_arg);
|
||||
ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) this_obj_p;
|
||||
re_compiled_code_t *old_bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
|
||||
re_obj_p->u.class_prop.u.value);
|
||||
re_compiled_code_t *old_bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, re_obj_p->u.cls.u3.value);
|
||||
|
||||
ecma_value_t ret_value;
|
||||
|
||||
@@ -299,8 +296,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this */
|
||||
}
|
||||
|
||||
ecma_extended_object_t *pattern_obj_p = (ecma_extended_object_t *) ecma_get_object_from_value (pattern_arg);
|
||||
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
|
||||
pattern_obj_p->u.class_prop.u.value);
|
||||
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, pattern_obj_p->u.cls.u3.value);
|
||||
|
||||
ret_value = ecma_op_create_regexp_from_bytecode (this_obj_p, bc_p);
|
||||
}
|
||||
@@ -471,7 +467,7 @@ ecma_builtin_regexp_prototype_to_string (ecma_object_t *object_p) /**< this obje
|
||||
ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
|
||||
re_obj_p->u.class_prop.u.value);
|
||||
re_obj_p->u.cls.u3.value);
|
||||
|
||||
ecma_string_t *source_p = ecma_get_string_from_value (bc_p->source);
|
||||
uint16_t flags = bc_p->header.status_flags;
|
||||
@@ -639,11 +635,11 @@ ecma_builtin_regexp_prototype_match_all (ecma_object_t *regexp_obj_p, /**< this
|
||||
ecma_object_t *proto_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_STRING_ITERATOR_PROTOTYPE);
|
||||
result_obj = ecma_create_object (proto_p,
|
||||
sizeof (ecma_regexp_string_iterator_t),
|
||||
ECMA_OBJECT_TYPE_PSEUDO_ARRAY);
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) result_obj;
|
||||
ext_obj_p->u.pseudo_array.type = (uint8_t) ECMA_PSEUDO_REGEXP_STRING_ITERATOR;
|
||||
ext_obj_p->u.pseudo_array.extra_info = (uint8_t) (parsed_flag & (RE_FLAG_GLOBAL | RE_FLAG_UNICODE));
|
||||
ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR;
|
||||
ext_obj_p->u.cls.u1.regexp_string_iterator_flags = (uint8_t) (parsed_flag & (RE_FLAG_GLOBAL | RE_FLAG_UNICODE));
|
||||
|
||||
ecma_regexp_string_iterator_t *regexp_string_iterator_obj = (ecma_regexp_string_iterator_t *) result_obj;
|
||||
|
||||
@@ -684,7 +680,7 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
{
|
||||
obj_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
if (require_regexp && !ecma_object_class_is (obj_p, LIT_MAGIC_STRING_REGEXP_UL))
|
||||
if (require_regexp && !ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_REGEXP))
|
||||
{
|
||||
obj_p = NULL;
|
||||
}
|
||||
@@ -742,7 +738,7 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
}
|
||||
case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_SOURCE:
|
||||
{
|
||||
if (!ecma_object_class_is (obj_p, LIT_MAGIC_STRING_REGEXP_UL))
|
||||
if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_REGEXP))
|
||||
{
|
||||
if (obj_p == ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE))
|
||||
{
|
||||
@@ -762,7 +758,7 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_UNICODE:
|
||||
case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_DOT_ALL:
|
||||
{
|
||||
if (!ecma_object_class_is (obj_p, LIT_MAGIC_STRING_REGEXP_UL))
|
||||
if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_REGEXP))
|
||||
{
|
||||
if (obj_p == ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE))
|
||||
{
|
||||
|
||||
@@ -61,11 +61,9 @@ ecma_builtin_regexp_string_iterator_prototype_object_next (ecma_value_t this_val
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_val);
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
/* 3. */
|
||||
if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_PSEUDO_ARRAY
|
||||
|| ext_obj_p->u.pseudo_array.type != ECMA_PSEUDO_REGEXP_STRING_ITERATOR)
|
||||
if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator"));
|
||||
}
|
||||
@@ -106,7 +104,7 @@ ecma_builtin_regexp_string_iterator_prototype_object_next (ecma_value_t this_val
|
||||
ecma_value_t result = ECMA_VALUE_ERROR;
|
||||
|
||||
/* 11. */
|
||||
if (regexp_string_iterator_obj->header.u.pseudo_array.extra_info & RE_FLAG_GLOBAL)
|
||||
if (regexp_string_iterator_obj->header.u.cls.u1.regexp_string_iterator_flags & RE_FLAG_GLOBAL)
|
||||
{
|
||||
ecma_value_t matched_str_value = ecma_op_object_get_by_index (match_result_array_p, 0);
|
||||
|
||||
@@ -145,10 +143,10 @@ ecma_builtin_regexp_string_iterator_prototype_object_next (ecma_value_t this_val
|
||||
goto free_variables;
|
||||
}
|
||||
|
||||
bool full_unciode = (regexp_string_iterator_obj->header.u.pseudo_array.extra_info & RE_FLAG_UNICODE) != 0;
|
||||
uint8_t flags = regexp_string_iterator_obj->header.u.cls.u1.regexp_string_iterator_flags;
|
||||
ecma_length_t next_index = ecma_op_advance_string_index (matcher_str_p,
|
||||
this_index,
|
||||
full_unciode);
|
||||
(flags & RE_FLAG_UNICODE) != 0);
|
||||
|
||||
ecma_value_t next_index_value = ecma_make_length_value (next_index);
|
||||
ecma_value_t set = ecma_op_object_put (regexp_obj_p,
|
||||
|
||||
@@ -106,8 +106,7 @@ ecma_builtin_regexp_dispatch_helper (const ecma_value_t *arguments_list_p, /**<
|
||||
if (ecma_object_is_regexp_object (pattern_value))
|
||||
{
|
||||
ecma_extended_object_t *pattern_obj_p = (ecma_extended_object_t *) ecma_get_object_from_value (pattern_value);
|
||||
bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
|
||||
pattern_obj_p->u.class_prop.u.value);
|
||||
bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, pattern_obj_p->u.cls.u3.value);
|
||||
|
||||
create_regexp_from_bc = ecma_is_value_undefined (flags_value);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
static ecma_value_t
|
||||
ecma_builtin_set_iterator_prototype_object_next (ecma_value_t this_val) /**< this argument */
|
||||
{
|
||||
return ecma_op_container_iterator_next (this_val, ECMA_PSEUDO_SET_ITERATOR);
|
||||
return ecma_op_container_iterator_next (this_val, ECMA_OBJECT_CLASS_SET_ITERATOR);
|
||||
} /* ecma_builtin_set_iterator_prototype_object_next */
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,13 +61,12 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**<
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
/* 3. */
|
||||
if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_PSEUDO_ARRAY
|
||||
|| ext_obj_p->u.pseudo_array.type != ECMA_PSEUDO_STRING_ITERATOR)
|
||||
if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_STRING_ITERATOR))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator"));
|
||||
}
|
||||
|
||||
ecma_value_t iterated_value = ext_obj_p->u.pseudo_array.u2.iterated_value;
|
||||
ecma_value_t iterated_value = ext_obj_p->u.cls.u3.iterated_value;
|
||||
|
||||
/* 4 - 5 */
|
||||
if (ecma_is_value_empty (iterated_value))
|
||||
@@ -80,7 +79,7 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**<
|
||||
ecma_string_t *string_p = ecma_get_string_from_value (iterated_value);
|
||||
|
||||
/* 6. */
|
||||
lit_utf8_size_t position = ext_obj_p->u.pseudo_array.u1.iterator_index;
|
||||
lit_utf8_size_t position = ext_obj_p->u.cls.u2.iterator_index;
|
||||
|
||||
if (JERRY_UNLIKELY (position == ECMA_ITERATOR_INDEX_LIMIT))
|
||||
{
|
||||
@@ -94,7 +93,7 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**<
|
||||
if (position >= len)
|
||||
{
|
||||
ecma_deref_ecma_string (string_p);
|
||||
ext_obj_p->u.pseudo_array.u2.iterated_value = ECMA_VALUE_EMPTY;
|
||||
ext_obj_p->u.cls.u3.iterated_value = ECMA_VALUE_EMPTY;
|
||||
return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);
|
||||
}
|
||||
|
||||
@@ -129,7 +128,7 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**<
|
||||
}
|
||||
|
||||
/* 13. */
|
||||
ext_obj_p->u.pseudo_array.u1.iterator_index = (uint16_t) (position + result_size);
|
||||
ext_obj_p->u.cls.u2.iterator_index = (uint16_t) (position + result_size);
|
||||
|
||||
/* 14. */
|
||||
ecma_value_t result = ecma_create_iter_result_object (ecma_make_string_value (result_str_p), ECMA_VALUE_FALSE);
|
||||
|
||||
@@ -130,13 +130,13 @@ ecma_builtin_string_prototype_object_to_string (ecma_value_t this_arg) /**< this
|
||||
{
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
if (ecma_object_class_is (object_p, LIT_MAGIC_STRING_STRING_UL))
|
||||
if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_STRING))
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_string (ext_object_p->u.class_prop.u.value));
|
||||
JERRY_ASSERT (ecma_is_value_string (ext_object_p->u.cls.u3.value));
|
||||
|
||||
return ecma_copy_value (ext_object_p->u.class_prop.u.value);
|
||||
return ecma_copy_value (ext_object_p->u.cls.u3.value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1447,7 +1447,7 @@ ecma_builtin_string_prototype_object_iterator (ecma_value_t to_string) /**< this
|
||||
{
|
||||
return ecma_op_create_iterator_object (ecma_copy_value (to_string),
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_STRING_ITERATOR_PROTOTYPE),
|
||||
ECMA_PSEUDO_STRING_ITERATOR,
|
||||
ECMA_OBJECT_CLASS_STRING_ITERATOR,
|
||||
ECMA_ITERATOR_VALUES);
|
||||
} /* ecma_builtin_string_prototype_object_iterator */
|
||||
|
||||
|
||||
@@ -55,12 +55,12 @@ ecma_builtin_weakref_prototype_object_deref (ecma_value_t this_arg) /**< this ar
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
ecma_extended_object_t *this_ext_obj = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (!ecma_object_class_is (object_p, LIT_MAGIC_STRING_WEAKREF_UL))
|
||||
if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_WEAKREF))
|
||||
{
|
||||
return ecma_raise_type_error ("Target is not weakRef");
|
||||
}
|
||||
|
||||
return ecma_copy_value (this_ext_obj->u.class_prop.u.target);
|
||||
return ecma_copy_value (this_ext_obj->u.cls.u3.target);
|
||||
} /* ecma_builtin_weakref_prototype_object_deref */
|
||||
|
||||
/**
|
||||
|
||||
@@ -81,8 +81,9 @@ ecma_builtin_weakref_dispatch_construct (const ecma_value_t *arguments_list_p, /
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_deref_object (proto_p);
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
|
||||
ext_obj_p->u.class_prop.class_id = (uint16_t) LIT_MAGIC_STRING_WEAKREF_UL;
|
||||
ext_obj_p->u.class_prop.u.target = arguments_list_p[0];
|
||||
ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_WEAKREF;
|
||||
ext_obj_p->u.cls.u2.id = LIT_MAGIC_STRING_WEAKREF_UL;
|
||||
ext_obj_p->u.cls.u3.target = arguments_list_p[0];
|
||||
ecma_op_object_set_weak (ecma_get_object_from_value (arguments_list_p[0]), object_p);
|
||||
|
||||
return ecma_make_object_value (object_p);
|
||||
|
||||
@@ -463,8 +463,9 @@ ecma_instantiate_builtin (ecma_global_object_t *global_object_p, /**< global obj
|
||||
JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_STRING_UL;
|
||||
ext_object_p->u.class_prop.u.value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_STRING;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_STRING_UL;
|
||||
ext_object_p->u.cls.u3.value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_STRING */
|
||||
@@ -475,8 +476,9 @@ ecma_instantiate_builtin (ecma_global_object_t *global_object_p, /**< global obj
|
||||
JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_NUMBER_UL;
|
||||
ext_object_p->u.class_prop.u.value = ecma_make_integer_value (0);
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_NUMBER;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_NUMBER_UL;
|
||||
ext_object_p->u.cls.u3.value = ecma_make_integer_value (0);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_NUMBER */
|
||||
@@ -487,8 +489,9 @@ ecma_instantiate_builtin (ecma_global_object_t *global_object_p, /**< global obj
|
||||
JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_BOOLEAN_UL;
|
||||
ext_object_p->u.class_prop.u.value = ECMA_VALUE_FALSE;
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BOOLEAN;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_BOOLEAN_UL;
|
||||
ext_object_p->u.cls.u3.value = ECMA_VALUE_FALSE;
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_BOOLEAN */
|
||||
@@ -500,11 +503,12 @@ ecma_instantiate_builtin (ecma_global_object_t *global_object_p, /**< global obj
|
||||
JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_DATE_UL;
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_DATE;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_DATE_UL;
|
||||
|
||||
ecma_number_t *prim_prop_num_value_p = ecma_alloc_number ();
|
||||
*prim_prop_num_value_p = ecma_number_make_nan ();
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p->u.class_prop.u.value, prim_prop_num_value_p);
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p->u.cls.u3.value, prim_prop_num_value_p);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_DATE */
|
||||
@@ -515,15 +519,15 @@ ecma_instantiate_builtin (ecma_global_object_t *global_object_p, /**< global obj
|
||||
JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_REGEXP_UL;
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_REGEXP;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_REGEXP_UL;
|
||||
|
||||
re_compiled_code_t *bc_p = re_compile_bytecode (ecma_get_magic_string (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP),
|
||||
RE_FLAG_EMPTY);
|
||||
|
||||
JERRY_ASSERT (bc_p != NULL);
|
||||
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p->u.class_prop.u.value, bc_p);
|
||||
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p->u.cls.u3.value, bc_p);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
|
||||
@@ -1864,7 +1864,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
|
||||
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_STRING_TAG_GETTER:
|
||||
{
|
||||
ecma_extended_object_t *obj_p = (ecma_extended_object_t *) typedarray_p;
|
||||
return ecma_make_magic_string_value (obj_p->u.pseudo_array.u1.class_id);
|
||||
return ecma_make_magic_string_value (obj_p->u.cls.u2.id);
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
||||
@@ -69,14 +69,14 @@ ecma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, /**< shar
|
||||
|
||||
ecma_object_t *obj_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE),
|
||||
object_size + (saved_arg_count * sizeof (ecma_value_t)),
|
||||
ECMA_OBJECT_TYPE_PSEUDO_ARRAY);
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) obj_p;
|
||||
|
||||
arguments_p->header.u.pseudo_array.type = ECMA_PSEUDO_ARRAY_ARGUMENTS;
|
||||
arguments_p->header.u.pseudo_array.extra_info = ECMA_ARGUMENTS_OBJECT_NO_FLAGS;
|
||||
arguments_p->header.u.pseudo_array.u1.formal_params_number = formal_params_number;
|
||||
arguments_p->header.u.pseudo_array.u2.arguments_number = 0;
|
||||
arguments_p->header.u.cls.type = ECMA_OBJECT_CLASS_ARGUMENTS;
|
||||
arguments_p->header.u.cls.u1.arguments_flags = ECMA_ARGUMENTS_OBJECT_NO_FLAGS;
|
||||
arguments_p->header.u.cls.u2.formal_params_number = formal_params_number;
|
||||
arguments_p->header.u.cls.u3.arguments_number = 0;
|
||||
arguments_p->callee = ecma_make_object_value (func_obj_p);
|
||||
|
||||
ecma_value_t *argv_p = (ecma_value_t *) (((uint8_t *) obj_p) + object_size);
|
||||
@@ -91,19 +91,19 @@ ecma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, /**< shar
|
||||
argv_p[i] = ECMA_VALUE_INITIALIZED;
|
||||
}
|
||||
|
||||
arguments_p->header.u.pseudo_array.u2.arguments_number = shared_p->arg_list_len;
|
||||
arguments_p->header.u.cls.u3.arguments_number = shared_p->arg_list_len;
|
||||
|
||||
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED)
|
||||
{
|
||||
ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) obj_p;
|
||||
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (mapped_arguments_p->lex_env, lex_env_p);
|
||||
arguments_p->header.u.pseudo_array.extra_info |= ECMA_ARGUMENTS_OBJECT_MAPPED;
|
||||
arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_MAPPED;
|
||||
|
||||
#if JERRY_SNAPSHOT_EXEC
|
||||
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)
|
||||
{
|
||||
arguments_p->header.u.pseudo_array.extra_info |= ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE;
|
||||
arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE;
|
||||
mapped_arguments_p->u.byte_code_p = (ecma_compiled_code_t *) bytecode_data_p;
|
||||
}
|
||||
else
|
||||
@@ -168,7 +168,7 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, /**< the
|
||||
property_desc_p);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ret_value)
|
||||
|| !(((ecma_extended_object_t *) object_p)->u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_MAPPED))
|
||||
|| !(((ecma_extended_object_t *) object_p)->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED))
|
||||
{
|
||||
return ret_value;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, /**< the
|
||||
ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) object_p;
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index >= mapped_arguments_p->unmapped.header.u.pseudo_array.u1.formal_params_number)
|
||||
if (index >= mapped_arguments_p->unmapped.header.u.cls.u2.formal_params_number)
|
||||
{
|
||||
return ret_value;
|
||||
}
|
||||
@@ -236,7 +236,7 @@ ecma_op_arguments_object_delete (ecma_object_t *object_p, /**< the object */
|
||||
ecma_value_t ret_value = ecma_op_general_object_delete (object_p, property_name_p, is_throw);
|
||||
|
||||
if (!ecma_is_value_true (ret_value)
|
||||
|| !(((ecma_extended_object_t *) object_p)->u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_MAPPED))
|
||||
|| !(((ecma_extended_object_t *) object_p)->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED))
|
||||
{
|
||||
return ret_value;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ ecma_op_arguments_object_delete (ecma_object_t *object_p, /**< the object */
|
||||
ecma_value_t *argv_p = (ecma_value_t *) (mapped_arguments_p + 1);
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index < mapped_arguments_p->unmapped.header.u.pseudo_array.u1.formal_params_number)
|
||||
if (index < mapped_arguments_p->unmapped.header.u.cls.u2.formal_params_number)
|
||||
{
|
||||
ecma_free_value_if_not_object (argv_p[index]);
|
||||
argv_p[index] = ECMA_VALUE_EMPTY;
|
||||
@@ -264,15 +264,14 @@ ecma_property_t *
|
||||
ecma_op_arguments_object_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_PSEUDO_ARRAY);
|
||||
JERRY_ASSERT (((ecma_extended_object_t *) object_p)->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS);
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARGUMENTS));
|
||||
|
||||
ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) object_p;
|
||||
ecma_value_t *argv_p = (ecma_value_t *) (arguments_p + 1);
|
||||
ecma_property_value_t *prop_value_p;
|
||||
ecma_property_t *prop_p = NULL;
|
||||
uint32_t arguments_number = arguments_p->header.u.pseudo_array.u2.arguments_number;
|
||||
uint8_t flags = arguments_p->header.u.pseudo_array.extra_info;
|
||||
uint32_t arguments_number = arguments_p->header.u.cls.u3.arguments_number;
|
||||
uint8_t flags = arguments_p->header.u.cls.u1.arguments_flags;
|
||||
|
||||
if (flags & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
{
|
||||
@@ -300,7 +299,7 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object
|
||||
|
||||
/* Pevent reinitialization */
|
||||
if ((flags & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
&& index < arguments_p->header.u.pseudo_array.u1.formal_params_number)
|
||||
&& index < arguments_p->header.u.cls.u2.formal_params_number)
|
||||
{
|
||||
argv_p[index] = ECMA_VALUE_INITIALIZED;
|
||||
}
|
||||
@@ -315,7 +314,7 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object
|
||||
if (property_name_p == ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH)
|
||||
&& !(flags & ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED))
|
||||
{
|
||||
arguments_p->header.u.pseudo_array.extra_info |= ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED;
|
||||
arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED;
|
||||
|
||||
prop_value_p = ecma_create_named_data_property (object_p,
|
||||
ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),
|
||||
@@ -328,7 +327,7 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object
|
||||
if (property_name_p == ecma_get_magic_string (LIT_MAGIC_STRING_CALLEE)
|
||||
&& !(flags & ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED))
|
||||
{
|
||||
arguments_p->header.u.pseudo_array.extra_info |= ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED;
|
||||
arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED;
|
||||
|
||||
if (flags & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
{
|
||||
@@ -355,14 +354,14 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object
|
||||
|
||||
#if !JERRY_ESNEXT
|
||||
if (property_name_p == ecma_get_magic_string (LIT_MAGIC_STRING_CALLER)
|
||||
&& !(arguments_p->header.u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_CALLER_INITIALIZED))
|
||||
&& !(arguments_p->header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_CALLER_INITIALIZED))
|
||||
{
|
||||
if (arguments_p->header.u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
if (arguments_p->header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
arguments_p->header.u.pseudo_array.extra_info |= ECMA_ARGUMENTS_OBJECT_CALLER_INITIALIZED;
|
||||
arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_CALLER_INITIALIZED;
|
||||
|
||||
ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);
|
||||
|
||||
@@ -380,7 +379,7 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object
|
||||
if (property_name_p == symbol_p
|
||||
&& !(flags & ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED))
|
||||
{
|
||||
arguments_p->header.u.pseudo_array.extra_info |= ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED;
|
||||
arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED;
|
||||
|
||||
prop_value_p = ecma_create_named_data_property (object_p,
|
||||
symbol_p,
|
||||
@@ -408,14 +407,13 @@ ecma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p, /**< ar
|
||||
ecma_collection_t *prop_names_p, /**< prop name collection */
|
||||
ecma_property_counter_t *prop_counter_p) /**< prop counter */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_PSEUDO_ARRAY);
|
||||
JERRY_ASSERT (((ecma_extended_object_t *) obj_p)->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS);
|
||||
JERRY_ASSERT (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARGUMENTS));
|
||||
|
||||
ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) obj_p;
|
||||
|
||||
ecma_value_t *argv_p = (ecma_value_t *) (arguments_p + 1);
|
||||
uint32_t arguments_number = arguments_p->header.u.pseudo_array.u2.arguments_number;
|
||||
uint8_t flags = arguments_p->header.u.pseudo_array.extra_info;
|
||||
uint32_t arguments_number = arguments_p->header.u.cls.u3.arguments_number;
|
||||
uint8_t flags = arguments_p->header.u.cls.u1.arguments_flags;
|
||||
|
||||
if (flags & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
{
|
||||
@@ -470,13 +468,13 @@ ecma_op_arguments_object_get_formal_parameter (ecma_mapped_arguments_t *mapped_a
|
||||
* object */
|
||||
uint32_t index) /**< formal parameter index */
|
||||
{
|
||||
JERRY_ASSERT (mapped_arguments_p->unmapped.header.u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_MAPPED);
|
||||
JERRY_ASSERT (index < mapped_arguments_p->unmapped.header.u.pseudo_array.u1.formal_params_number);
|
||||
JERRY_ASSERT (mapped_arguments_p->unmapped.header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED);
|
||||
JERRY_ASSERT (index < mapped_arguments_p->unmapped.header.u.cls.u2.formal_params_number);
|
||||
|
||||
ecma_compiled_code_t *byte_code_p;
|
||||
|
||||
#if JERRY_SNAPSHOT_EXEC
|
||||
if (mapped_arguments_p->unmapped.header.u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE)
|
||||
if (mapped_arguments_p->unmapped.header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE)
|
||||
{
|
||||
byte_code_p = mapped_arguments_p->u.byte_code_p;
|
||||
}
|
||||
|
||||
@@ -797,7 +797,7 @@ ecma_op_create_array_iterator (ecma_object_t *obj_p, /**< array object */
|
||||
|
||||
return ecma_op_create_iterator_object (ecma_make_object_value (obj_p),
|
||||
prototype_obj_p,
|
||||
ECMA_PSEUDO_ARRAY_ITERATOR,
|
||||
ECMA_OBJECT_CLASS_ARRAY_ITERATOR,
|
||||
kind);
|
||||
} /* ecma_op_create_array_iterator */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
@@ -53,9 +53,10 @@ ecma_arraybuffer_new_object (uint32_t length) /**< length of the arraybuffer */
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.extra_info = ECMA_ARRAYBUFFER_INTERNAL_MEMORY;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_ARRAY_BUFFER_UL;
|
||||
ext_object_p->u.class_prop.u.length = length;
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_ARRAY_BUFFER;
|
||||
ext_object_p->u.cls.u1.array_buffer_flags = ECMA_ARRAYBUFFER_INTERNAL_MEMORY;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_ARRAY_BUFFER_UL;
|
||||
ext_object_p->u.cls.u3.length = length;
|
||||
|
||||
lit_utf8_byte_t *buf = (lit_utf8_byte_t *) (ext_object_p + 1);
|
||||
memset (buf, 0, length);
|
||||
@@ -84,9 +85,10 @@ ecma_arraybuffer_new_object_external (uint32_t length, /**< length of the buffer
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_arraybuffer_external_info *array_object_p = (ecma_arraybuffer_external_info *) object_p;
|
||||
array_object_p->extended_object.u.class_prop.extra_info = ECMA_ARRAYBUFFER_EXTERNAL_MEMORY;
|
||||
array_object_p->extended_object.u.class_prop.class_id = LIT_MAGIC_STRING_ARRAY_BUFFER_UL;
|
||||
array_object_p->extended_object.u.class_prop.u.length = length;
|
||||
array_object_p->extended_object.u.cls.type = ECMA_OBJECT_CLASS_ARRAY_BUFFER;
|
||||
array_object_p->extended_object.u.cls.u1.array_buffer_flags = ECMA_ARRAYBUFFER_EXTERNAL_MEMORY;
|
||||
array_object_p->extended_object.u.cls.u2.id = LIT_MAGIC_STRING_ARRAY_BUFFER_UL;
|
||||
array_object_p->extended_object.u.cls.u3.length = length;
|
||||
|
||||
array_object_p->buffer_p = buffer_p;
|
||||
array_object_p->free_cb = free_cb;
|
||||
@@ -173,8 +175,7 @@ bool
|
||||
ecma_is_arraybuffer (ecma_value_t target) /**< the target value */
|
||||
{
|
||||
return (ecma_is_value_object (target)
|
||||
&& ecma_object_class_is (ecma_get_object_from_value (target),
|
||||
LIT_MAGIC_STRING_ARRAY_BUFFER_UL));
|
||||
&& ecma_object_class_is (ecma_get_object_from_value (target), ECMA_OBJECT_CLASS_ARRAY_BUFFER));
|
||||
} /* ecma_is_arraybuffer */
|
||||
|
||||
/**
|
||||
@@ -185,10 +186,10 @@ ecma_is_arraybuffer (ecma_value_t target) /**< the target value */
|
||||
uint32_t JERRY_ATTR_PURE
|
||||
ecma_arraybuffer_get_length (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */
|
||||
{
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL));
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER));
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
return ecma_arraybuffer_is_detached (object_p) ? 0 : ext_object_p->u.class_prop.u.length;
|
||||
return ecma_arraybuffer_is_detached (object_p) ? 0 : ext_object_p->u.cls.u3.length;
|
||||
} /* ecma_arraybuffer_get_length */
|
||||
|
||||
/**
|
||||
@@ -199,7 +200,7 @@ ecma_arraybuffer_get_length (ecma_object_t *object_p) /**< pointer to the ArrayB
|
||||
extern inline lit_utf8_byte_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_arraybuffer_get_buffer (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */
|
||||
{
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL));
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER));
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
@@ -209,7 +210,7 @@ ecma_arraybuffer_get_buffer (ecma_object_t *object_p) /**< pointer to the ArrayB
|
||||
JERRY_ASSERT (!ecma_arraybuffer_is_detached (object_p) || array_p->buffer_p == NULL);
|
||||
return (lit_utf8_byte_t *) array_p->buffer_p;
|
||||
}
|
||||
else if (ext_object_p->u.class_prop.extra_info & ECMA_ARRAYBUFFER_DETACHED)
|
||||
else if (ext_object_p->u.cls.u1.array_buffer_flags & ECMA_ARRAYBUFFER_DETACHED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -226,9 +227,9 @@ ecma_arraybuffer_get_buffer (ecma_object_t *object_p) /**< pointer to the ArrayB
|
||||
extern inline bool JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_arraybuffer_is_detached (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */
|
||||
{
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL));
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER));
|
||||
|
||||
return (((ecma_extended_object_t *) object_p)->u.class_prop.extra_info & ECMA_ARRAYBUFFER_DETACHED) != 0;
|
||||
return (((ecma_extended_object_t *) object_p)->u.cls.u1.array_buffer_flags & ECMA_ARRAYBUFFER_DETACHED) != 0;
|
||||
} /* ecma_arraybuffer_is_detached */
|
||||
|
||||
/**
|
||||
@@ -242,7 +243,7 @@ ecma_arraybuffer_is_detached (ecma_object_t *object_p) /**< pointer to the Array
|
||||
extern inline bool JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_arraybuffer_detach (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */
|
||||
{
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL));
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER));
|
||||
|
||||
if (ecma_arraybuffer_is_detached (object_p))
|
||||
{
|
||||
@@ -250,7 +251,7 @@ ecma_arraybuffer_detach (ecma_object_t *object_p) /**< pointer to the ArrayBuffe
|
||||
}
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.extra_info |= ECMA_ARRAYBUFFER_DETACHED;
|
||||
ext_object_p->u.cls.u1.array_buffer_flags |= ECMA_ARRAYBUFFER_DETACHED;
|
||||
|
||||
if (ECMA_ARRAYBUFFER_HAS_EXTERNAL_MEMORY (ext_object_p))
|
||||
{
|
||||
@@ -262,7 +263,7 @@ ecma_arraybuffer_detach (ecma_object_t *object_p) /**< pointer to the ArrayBuffe
|
||||
array_p->free_cb = NULL;
|
||||
}
|
||||
|
||||
ext_object_p->u.class_prop.u.length = 0;
|
||||
ext_object_p->u.cls.u3.length = 0;
|
||||
array_p->buffer_p = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,20 +58,20 @@ ecma_async_generator_enqueue (vm_executable_object_t *async_generator_object_p,
|
||||
ecma_value_t result = ecma_op_create_promise_object (ECMA_VALUE_EMPTY, ECMA_VALUE_UNDEFINED, NULL);
|
||||
task_p->promise = result;
|
||||
|
||||
ecma_value_t head = async_generator_object_p->extended_object.u.class_prop.u.head;
|
||||
ecma_value_t head = async_generator_object_p->extended_object.u.cls.u3.head;
|
||||
|
||||
if (ECMA_IS_INTERNAL_VALUE_NULL (head))
|
||||
{
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (async_generator_object_p->extended_object.u.class_prop.u.head, task_p);
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (async_generator_object_p->extended_object.u.cls.u3.head, task_p);
|
||||
|
||||
if (async_generator_object_p->extended_object.u.class_prop.extra_info & ECMA_ASYNC_GENERATOR_CALLED)
|
||||
if (async_generator_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_ASYNC_GENERATOR_CALLED)
|
||||
{
|
||||
ecma_value_t executable_object = ecma_make_object_value ((ecma_object_t *) async_generator_object_p);
|
||||
ecma_enqueue_promise_async_generator_job (executable_object);
|
||||
return result;
|
||||
}
|
||||
|
||||
async_generator_object_p->extended_object.u.class_prop.extra_info |= ECMA_ASYNC_GENERATOR_CALLED;
|
||||
async_generator_object_p->extended_object.u.cls.u2.executable_obj_flags |= ECMA_ASYNC_GENERATOR_CALLED;
|
||||
ecma_async_generator_run (async_generator_object_p);
|
||||
return result;
|
||||
}
|
||||
@@ -190,15 +190,15 @@ ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< a
|
||||
ecma_value_t
|
||||
ecma_async_generator_run (vm_executable_object_t *async_generator_object_p) /**< async generator */
|
||||
{
|
||||
JERRY_ASSERT (async_generator_object_p->extended_object.u.class_prop.class_id
|
||||
== LIT_MAGIC_STRING_ASYNC_GENERATOR_UL);
|
||||
JERRY_ASSERT (!ECMA_IS_INTERNAL_VALUE_NULL (async_generator_object_p->extended_object.u.class_prop.u.head));
|
||||
JERRY_ASSERT (async_generator_object_p->extended_object.u.cls.type == ECMA_OBJECT_CLASS_ASYNC_GENERATOR);
|
||||
JERRY_ASSERT (!ECMA_IS_INTERNAL_VALUE_NULL (async_generator_object_p->extended_object.u.cls.u3.head));
|
||||
|
||||
ecma_value_t head = async_generator_object_p->extended_object.u.class_prop.u.head;
|
||||
ecma_value_t head = async_generator_object_p->extended_object.u.cls.u3.head;
|
||||
ecma_async_generator_task_t *task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, head);
|
||||
ecma_value_t result;
|
||||
|
||||
if (async_generator_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)
|
||||
if (async_generator_object_p->extended_object.u.cls.u2.executable_obj_flags
|
||||
& ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)
|
||||
{
|
||||
switch (task_p->operation_type)
|
||||
{
|
||||
@@ -255,7 +255,7 @@ ecma_async_generator_run (vm_executable_object_t *async_generator_object_p) /**<
|
||||
|
||||
JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result));
|
||||
|
||||
async_generator_object_p->extended_object.u.class_prop.extra_info &= ECMA_AWAIT_CLEAR_MASK;
|
||||
async_generator_object_p->extended_object.u.cls.u2.executable_obj_flags &= ECMA_AWAIT_CLEAR_MASK;
|
||||
async_generator_object_p->frame_ctx.block_result = ECMA_VALUE_UNDEFINED;
|
||||
async_generator_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_throw;
|
||||
|
||||
@@ -283,9 +283,9 @@ ecma_async_generator_run (vm_executable_object_t *async_generator_object_p) /**<
|
||||
|
||||
result = opfunc_resume_executable_object (async_generator_object_p, result);
|
||||
|
||||
if (async_generator_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_COMPLETED)
|
||||
if (async_generator_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED)
|
||||
{
|
||||
JERRY_ASSERT (head == async_generator_object_p->extended_object.u.class_prop.u.head);
|
||||
JERRY_ASSERT (head == async_generator_object_p->extended_object.u.cls.u3.head);
|
||||
ecma_async_generator_finalize (async_generator_object_p, result);
|
||||
result = ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
@@ -300,7 +300,7 @@ void
|
||||
ecma_async_generator_finalize (vm_executable_object_t *async_generator_object_p, /**< async generator */
|
||||
ecma_value_t value) /**< final value (takes reference) */
|
||||
{
|
||||
ecma_value_t next = async_generator_object_p->extended_object.u.class_prop.u.head;
|
||||
ecma_value_t next = async_generator_object_p->extended_object.u.cls.u3.head;
|
||||
ecma_async_generator_task_t *task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, next);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (value))
|
||||
@@ -318,7 +318,7 @@ ecma_async_generator_finalize (vm_executable_object_t *async_generator_object_p,
|
||||
ecma_free_value (value);
|
||||
|
||||
next = task_p->next;
|
||||
async_generator_object_p->extended_object.u.class_prop.u.head = next;
|
||||
async_generator_object_p->extended_object.u.cls.u3.head = next;
|
||||
jmem_heap_free_block (task_p, sizeof (ecma_async_generator_task_t));
|
||||
|
||||
while (!ECMA_IS_INTERNAL_VALUE_NULL (next))
|
||||
@@ -339,7 +339,7 @@ ecma_async_generator_finalize (vm_executable_object_t *async_generator_object_p,
|
||||
ecma_free_value_if_not_object (task_p->operation_value);
|
||||
|
||||
next = task_p->next;
|
||||
async_generator_object_p->extended_object.u.class_prop.u.head = next;
|
||||
async_generator_object_p->extended_object.u.cls.u3.head = next;
|
||||
jmem_heap_free_block (task_p, sizeof (ecma_async_generator_task_t));
|
||||
}
|
||||
} /* ecma_async_generator_finalize */
|
||||
|
||||
@@ -42,7 +42,7 @@ typedef enum
|
||||
* Get the state of an async yield iterator.
|
||||
*/
|
||||
#define ECMA_AWAIT_GET_STATE(async_generator_object_p) \
|
||||
((async_generator_object_p)->extended_object.u.class_prop.extra_info >> ECMA_AWAIT_STATE_SHIFT)
|
||||
((async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags >> ECMA_AWAIT_STATE_SHIFT)
|
||||
|
||||
/**
|
||||
* Set the state of an async yield iterator.
|
||||
@@ -50,10 +50,10 @@ typedef enum
|
||||
#define ECMA_AWAIT_SET_STATE(async_generator_object_p, to) \
|
||||
do \
|
||||
{ \
|
||||
uint16_t extra_info = (async_generator_object_p)->extended_object.u.class_prop.extra_info; \
|
||||
uint16_t extra_info = (async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags; \
|
||||
extra_info &= ((1 << ECMA_AWAIT_STATE_SHIFT) - 1); \
|
||||
extra_info |= (ECMA_AWAIT_ ## to) << ECMA_AWAIT_STATE_SHIFT; \
|
||||
(async_generator_object_p)->extended_object.u.class_prop.extra_info = extra_info; \
|
||||
(async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags = extra_info; \
|
||||
} \
|
||||
while (false)
|
||||
|
||||
@@ -73,7 +73,7 @@ typedef enum
|
||||
* Change the state of an async yield iterator.
|
||||
*/
|
||||
#define ECMA_AWAIT_CHANGE_STATE(async_generator_object_p, from, to) \
|
||||
((async_generator_object_p)->extended_object.u.class_prop.extra_info ^= ECMA_AWAIT_CS_HELPER (from, to))
|
||||
((async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags ^= ECMA_AWAIT_CS_HELPER (from, to))
|
||||
|
||||
ecma_value_t ecma_async_generator_enqueue (vm_executable_object_t *async_generator_object_p,
|
||||
ecma_async_generator_operation_type_t operation, ecma_value_t value);
|
||||
|
||||
@@ -52,8 +52,9 @@ ecma_op_create_bigint_object (ecma_value_t arg) /**< argument passed to the toOb
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_BIGINT_UL;
|
||||
ext_object_p->u.class_prop.u.value = ecma_copy_value (arg);
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BIGINT;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_BIGINT_UL;
|
||||
ext_object_p->u.cls.u3.value = ecma_copy_value (arg);
|
||||
|
||||
return ecma_make_object_value (object_p);
|
||||
} /* ecma_op_create_bigint_object */
|
||||
|
||||
@@ -71,8 +71,9 @@ ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boo
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_BOOLEAN_UL;
|
||||
ext_object_p->u.class_prop.u.value = ecma_make_boolean_value (boolean_value);
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BOOLEAN;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_BOOLEAN_UL;
|
||||
ext_object_p->u.cls.u3.value = ecma_make_boolean_value (boolean_value);
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
if (new_target)
|
||||
|
||||
@@ -316,9 +316,9 @@ ecma_op_container_free_entries (ecma_object_t *object_p) /**< collection object
|
||||
|
||||
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
|
||||
switch (map_object_p->u.class_prop.class_id)
|
||||
switch (map_object_p->u.cls.u2.id)
|
||||
{
|
||||
#if JERRY_BUILTIN_WEAKSET
|
||||
case LIT_MAGIC_STRING_WEAKSET_UL:
|
||||
@@ -388,15 +388,16 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_deref_object (proto_p);
|
||||
ecma_extended_object_t *map_obj_p = (ecma_extended_object_t *) object_p;
|
||||
map_obj_p->u.class_prop.extra_info = ECMA_CONTAINER_FLAGS_EMPTY;
|
||||
map_obj_p->u.class_prop.class_id = (uint16_t) lit_id;
|
||||
map_obj_p->u.cls.type = ECMA_OBJECT_CLASS_CONTAINER;
|
||||
map_obj_p->u.cls.u1.container_flags = ECMA_CONTAINER_FLAGS_EMPTY;
|
||||
map_obj_p->u.cls.u2.id = (uint16_t) lit_id;
|
||||
|
||||
if (lit_id == LIT_MAGIC_STRING_WEAKMAP_UL || lit_id == LIT_MAGIC_STRING_WEAKSET_UL)
|
||||
{
|
||||
map_obj_p->u.class_prop.extra_info |= ECMA_CONTAINER_FLAGS_WEAK;
|
||||
map_obj_p->u.cls.u1.container_flags |= ECMA_CONTAINER_FLAGS_WEAK;
|
||||
}
|
||||
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (map_obj_p->u.class_prop.u.value, container_p);
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (map_obj_p->u.cls.u3.value, container_p);
|
||||
|
||||
ecma_value_t set_value = ecma_make_object_value (object_p);
|
||||
ecma_value_t result = set_value;
|
||||
@@ -564,12 +565,12 @@ ecma_op_container_get_object (ecma_value_t this_arg, /**< this argument */
|
||||
{
|
||||
if (ecma_is_value_object (this_arg))
|
||||
{
|
||||
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) ecma_get_object_from_value (this_arg);
|
||||
ecma_object_t *map_object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
if (ecma_get_object_type ((ecma_object_t *) map_object_p) == ECMA_OBJECT_TYPE_CLASS
|
||||
&& map_object_p->u.class_prop.class_id == lit_id)
|
||||
if (ecma_object_class_is (map_object_p, ECMA_OBJECT_CLASS_CONTAINER)
|
||||
&& ((ecma_extended_object_t *) map_object_p)->u.cls.u2.id == lit_id)
|
||||
{
|
||||
return map_object_p;
|
||||
return (ecma_extended_object_t *) map_object_p;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,7 +594,7 @@ ecma_value_t
|
||||
ecma_op_container_size (ecma_extended_object_t *map_object_p) /**< internal class id */
|
||||
{
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
|
||||
return ecma_make_uint32_value (ECMA_CONTAINER_GET_SIZE (container_p));
|
||||
} /* ecma_op_container_size */
|
||||
@@ -617,7 +618,7 @@ ecma_op_container_get (ecma_extended_object_t *map_object_p, /**< map object */
|
||||
#endif /* JERRY_BUILTIN_WEAKMAP */
|
||||
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
|
||||
if (ECMA_CONTAINER_GET_SIZE (container_p) == 0)
|
||||
{
|
||||
@@ -646,10 +647,10 @@ ecma_op_container_has (ecma_extended_object_t *map_object_p, /**< map object */
|
||||
lit_magic_string_id_t lit_id) /**< internal class id */
|
||||
{
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
|
||||
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET
|
||||
if ((map_object_p->u.class_prop.extra_info & ECMA_CONTAINER_FLAGS_WEAK) != 0
|
||||
if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0
|
||||
&& !ecma_is_value_object (key_arg))
|
||||
{
|
||||
return ECMA_VALUE_FALSE;
|
||||
@@ -704,10 +705,10 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */
|
||||
lit_magic_string_id_t lit_id) /**< internal class id */
|
||||
{
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
|
||||
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET
|
||||
if ((map_object_p->u.class_prop.extra_info & ECMA_CONTAINER_FLAGS_WEAK) != 0
|
||||
if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0
|
||||
&& !ecma_is_value_object (key_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Key must be an object"));
|
||||
@@ -724,7 +725,7 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */
|
||||
lit_id);
|
||||
|
||||
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET
|
||||
if ((map_object_p->u.class_prop.extra_info & ECMA_CONTAINER_FLAGS_WEAK) != 0)
|
||||
if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0)
|
||||
{
|
||||
ecma_object_t *key_p = ecma_get_object_from_value (key_arg);
|
||||
ecma_op_object_set_weak (key_p, (ecma_object_t *) map_object_p);
|
||||
@@ -763,7 +764,7 @@ ecma_op_container_foreach (ecma_extended_object_t *map_object_p, /**< map object
|
||||
ecma_value_t ret_value = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
|
||||
uint8_t entry_size = ecma_op_container_entry_size (lit_id);
|
||||
|
||||
@@ -822,7 +823,7 @@ ecma_op_container_delete (ecma_extended_object_t *map_object_p, /**< map object
|
||||
lit_magic_string_id_t lit_id) /**< internal class id */
|
||||
{
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
|
||||
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);
|
||||
|
||||
@@ -852,7 +853,7 @@ ecma_op_container_delete_weak (ecma_extended_object_t *map_object_p, /**< map ob
|
||||
}
|
||||
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
|
||||
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);
|
||||
|
||||
@@ -879,13 +880,13 @@ ecma_op_container_remove_weak_entry (ecma_object_t *object_p, /**< internal cont
|
||||
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
|
||||
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, map_object_p->u.class_prop.class_id);
|
||||
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, map_object_p->u.cls.u2.id);
|
||||
|
||||
JERRY_ASSERT (entry_p != NULL);
|
||||
|
||||
ecma_op_internal_buffer_delete (container_p, (ecma_container_pair_t *) entry_p, map_object_p->u.class_prop.class_id);
|
||||
ecma_op_internal_buffer_delete (container_p, (ecma_container_pair_t *) entry_p, map_object_p->u.cls.u2.id);
|
||||
} /* ecma_op_container_remove_weak_entry */
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
@@ -906,7 +907,7 @@ ecma_op_container_remove_weak_entry (ecma_object_t *object_p, /**< internal cont
|
||||
extern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_op_container_create_iterator (ecma_value_t this_arg, /**< this argument */
|
||||
ecma_builtin_id_t proto_id, /**< prototype builtin id */
|
||||
ecma_pseudo_array_type_t iterator_type, /**< iterator type */
|
||||
ecma_object_class_type_t iterator_type, /**< iterator type */
|
||||
ecma_iterator_kind_t kind) /**< iterator kind */
|
||||
{
|
||||
return ecma_op_create_iterator_object (this_arg,
|
||||
@@ -923,7 +924,7 @@ ecma_op_container_create_iterator (ecma_value_t this_arg, /**< this argument */
|
||||
static uint32_t
|
||||
ecma_op_iterator_get_index (ecma_object_t *iter_obj_p) /**< iterator object pointer */
|
||||
{
|
||||
uint32_t index = ((ecma_extended_object_t *) iter_obj_p)->u.pseudo_array.u1.iterator_index;
|
||||
uint32_t index = ((ecma_extended_object_t *) iter_obj_p)->u.cls.u2.iterator_index;
|
||||
|
||||
if (JERRY_UNLIKELY (index == ECMA_ITERATOR_INDEX_LIMIT))
|
||||
{
|
||||
@@ -965,7 +966,7 @@ ecma_op_iterator_set_index (ecma_object_t *iter_obj_p, /**< iterator object poin
|
||||
}
|
||||
else
|
||||
{
|
||||
((ecma_extended_object_t *) iter_obj_p)->u.pseudo_array.u1.iterator_index = (uint16_t) index;
|
||||
((ecma_extended_object_t *) iter_obj_p)->u.cls.u2.iterator_index = (uint16_t) index;
|
||||
}
|
||||
} /* ecma_op_iterator_set_index */
|
||||
|
||||
@@ -984,7 +985,7 @@ ecma_op_iterator_set_index (ecma_object_t *iter_obj_p, /**< iterator object poin
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_op_container_iterator_next (ecma_value_t this_val, /**< this argument */
|
||||
ecma_pseudo_array_type_t iterator_type) /**< type of the iterator */
|
||||
ecma_object_class_type_t iterator_type) /**< type of the iterator */
|
||||
{
|
||||
if (!ecma_is_value_object (this_val))
|
||||
{
|
||||
@@ -994,13 +995,12 @@ ecma_op_container_iterator_next (ecma_value_t this_val, /**< this argument */
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_val);
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_PSEUDO_ARRAY
|
||||
|| ext_obj_p->u.pseudo_array.type != iterator_type)
|
||||
if (!ecma_object_class_is (obj_p, iterator_type))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator"));
|
||||
}
|
||||
|
||||
ecma_value_t iterated_value = ext_obj_p->u.pseudo_array.u2.iterated_value;
|
||||
ecma_value_t iterated_value = ext_obj_p->u.cls.u3.iterated_value;
|
||||
|
||||
if (ecma_is_value_empty (iterated_value))
|
||||
{
|
||||
@@ -1008,22 +1008,22 @@ ecma_op_container_iterator_next (ecma_value_t this_val, /**< this argument */
|
||||
}
|
||||
|
||||
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) (ecma_get_object_from_value (iterated_value));
|
||||
lit_magic_string_id_t lit_id = map_object_p->u.class_prop.class_id;
|
||||
lit_magic_string_id_t lit_id = map_object_p->u.cls.u2.id;
|
||||
|
||||
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
map_object_p->u.class_prop.u.value);
|
||||
map_object_p->u.cls.u3.value);
|
||||
uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);
|
||||
uint32_t index = ecma_op_iterator_get_index (obj_p);
|
||||
|
||||
if (index == entry_count)
|
||||
{
|
||||
ext_obj_p->u.pseudo_array.u2.iterated_value = ECMA_VALUE_EMPTY;
|
||||
ext_obj_p->u.cls.u3.iterated_value = ECMA_VALUE_EMPTY;
|
||||
|
||||
return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);
|
||||
}
|
||||
|
||||
uint8_t entry_size = ecma_op_container_entry_size (lit_id);
|
||||
uint8_t iterator_kind = ext_obj_p->u.pseudo_array.extra_info;
|
||||
uint8_t iterator_kind = ext_obj_p->u.cls.u1.iterator_kind;
|
||||
ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);
|
||||
ecma_value_t ret_value = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
@@ -1136,12 +1136,12 @@ ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id, /**< built
|
||||
case ECMA_CONTAINER_ROUTINE_ENTRIES:
|
||||
{
|
||||
ecma_builtin_id_t builtin_iterator_prototype = ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE;
|
||||
ecma_pseudo_array_type_t iterator_type = ECMA_PSEUDO_MAP_ITERATOR;
|
||||
ecma_object_class_type_t iterator_type = ECMA_OBJECT_CLASS_MAP_ITERATOR;
|
||||
|
||||
if (lit_id != LIT_MAGIC_STRING_MAP_UL)
|
||||
{
|
||||
builtin_iterator_prototype = ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE;
|
||||
iterator_type = ECMA_PSEUDO_SET_ITERATOR;
|
||||
iterator_type = ECMA_OBJECT_CLASS_SET_ITERATOR;
|
||||
}
|
||||
|
||||
ecma_iterator_kind_t kind = (ecma_iterator_kind_t) (builtin_routine_id - ECMA_CONTAINER_ROUTINE_KEYS);
|
||||
|
||||
@@ -71,9 +71,9 @@ void ecma_op_container_remove_weak_entry (ecma_object_t *container_p, ecma_value
|
||||
void ecma_op_container_free_entries (ecma_object_t *object_p);
|
||||
ecma_value_t ecma_op_container_create_iterator (ecma_value_t this_arg,
|
||||
ecma_builtin_id_t proto_id,
|
||||
ecma_pseudo_array_type_t iterator_type,
|
||||
ecma_object_class_type_t iterator_type,
|
||||
ecma_iterator_kind_t kind);
|
||||
ecma_value_t ecma_op_container_iterator_next (ecma_value_t this_val, ecma_pseudo_array_type_t iterator_type);
|
||||
ecma_value_t ecma_op_container_iterator_next (ecma_value_t this_val, ecma_object_class_type_t iterator_type);
|
||||
ecma_value_t ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id, ecma_value_t this_arg,
|
||||
const ecma_value_t arguments_list_p[],
|
||||
lit_magic_string_id_t lit_id);
|
||||
|
||||
@@ -532,21 +532,24 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */
|
||||
{
|
||||
ecma_check_value_type_is_spec_defined (value);
|
||||
ecma_builtin_id_t proto_id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE;
|
||||
uint16_t lit_id;
|
||||
uint8_t class_type;
|
||||
uint16_t class_id;
|
||||
|
||||
if (ecma_is_value_number (value))
|
||||
{
|
||||
#if JERRY_BUILTIN_NUMBER
|
||||
proto_id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE;
|
||||
#endif /* JERRY_BUILTIN_NUMBER */
|
||||
lit_id = LIT_MAGIC_STRING_NUMBER_UL;
|
||||
class_type = ECMA_OBJECT_CLASS_NUMBER;
|
||||
class_id = LIT_MAGIC_STRING_NUMBER_UL;
|
||||
}
|
||||
else if (ecma_is_value_string (value))
|
||||
{
|
||||
#if JERRY_BUILTIN_STRING
|
||||
proto_id = ECMA_BUILTIN_ID_STRING_PROTOTYPE;
|
||||
#endif /* JERRY_BUILTIN_STRING */
|
||||
lit_id = LIT_MAGIC_STRING_STRING_UL;
|
||||
class_type = ECMA_OBJECT_CLASS_STRING;
|
||||
class_id = LIT_MAGIC_STRING_STRING_UL;
|
||||
}
|
||||
else if (ecma_is_value_object (value))
|
||||
{
|
||||
@@ -556,7 +559,8 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */
|
||||
else if (ecma_is_value_symbol (value))
|
||||
{
|
||||
proto_id = ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE;
|
||||
lit_id = LIT_MAGIC_STRING_SYMBOL_UL;
|
||||
class_type = ECMA_OBJECT_CLASS_SYMBOL;
|
||||
class_id = LIT_MAGIC_STRING_SYMBOL_UL;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
@@ -578,33 +582,22 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */
|
||||
#if JERRY_BUILTIN_BOOLEAN
|
||||
proto_id = ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE;
|
||||
#endif /* JERRY_BUILTIN_BOOLEAN */
|
||||
lit_id = LIT_MAGIC_STRING_BOOLEAN_UL;
|
||||
class_type = ECMA_OBJECT_CLASS_BOOLEAN;
|
||||
class_id = LIT_MAGIC_STRING_BOOLEAN_UL;
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_op_create_class_object (proto_id, value, lit_id);
|
||||
} /* ecma_op_to_object */
|
||||
|
||||
/**
|
||||
* Create a ECMA_OBJECT_TYPE_CLASS object from the given arguments.
|
||||
*
|
||||
* @return ecma_value - constructed object
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_op_create_class_object (ecma_builtin_id_t proto_id, /**< prototype id */
|
||||
ecma_value_t value, /**< ecma value */
|
||||
uint16_t class_id) /**< magic string id */
|
||||
{
|
||||
ecma_object_t *object_p = ecma_create_object (ecma_builtin_get (proto_id),
|
||||
sizeof (ecma_extended_object_t),
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.class_id = class_id;
|
||||
ext_object_p->u.class_prop.u.value = ecma_copy_value_if_not_object (value);
|
||||
ext_object_p->u.cls.type = class_type;
|
||||
ext_object_p->u.cls.u2.id = class_id;
|
||||
ext_object_p->u.cls.u3.value = ecma_copy_value_if_not_object (value);
|
||||
|
||||
return ecma_make_object_value (object_p);
|
||||
} /* ecma_op_create_class_object */
|
||||
} /* ecma_op_to_object */
|
||||
|
||||
/**
|
||||
* FromPropertyDescriptor operation.
|
||||
|
||||
@@ -60,9 +60,6 @@ ecma_string_t *ecma_op_to_string (ecma_value_t value);
|
||||
ecma_string_t *ecma_op_to_property_key (ecma_value_t value);
|
||||
ecma_value_t ecma_op_to_object (ecma_value_t value);
|
||||
bool ecma_op_is_integer (ecma_number_t value);
|
||||
ecma_value_t ecma_op_create_class_object (ecma_builtin_id_t proto_id,
|
||||
ecma_value_t value,
|
||||
uint16_t lit_id);
|
||||
ecma_value_t ecma_op_to_integer (ecma_value_t value, ecma_number_t *number_p);
|
||||
ecma_value_t ecma_op_to_length (ecma_value_t value, ecma_length_t *length);
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
@@ -60,7 +60,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
|
||||
|
||||
ecma_object_t *buffer_p = ecma_get_object_from_value (buffer);
|
||||
|
||||
if (!ecma_object_class_is (buffer_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL))
|
||||
if (!ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'buffer' is not an ArrayBuffer"));
|
||||
}
|
||||
@@ -145,8 +145,9 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
|
||||
|
||||
/* 11 - 14. */
|
||||
ecma_dataview_object_t *dataview_obj_p = (ecma_dataview_object_t *) object_p;
|
||||
dataview_obj_p->header.u.class_prop.class_id = LIT_MAGIC_STRING_DATAVIEW_UL;
|
||||
dataview_obj_p->header.u.class_prop.u.length = view_byte_length;
|
||||
dataview_obj_p->header.u.cls.type = ECMA_OBJECT_CLASS_DATAVIEW;
|
||||
dataview_obj_p->header.u.cls.u2.id = LIT_MAGIC_STRING_DATAVIEW_UL;
|
||||
dataview_obj_p->header.u.cls.u3.length = view_byte_length;
|
||||
dataview_obj_p->buffer_p = buffer_p;
|
||||
dataview_obj_p->byte_offset = (uint32_t) offset;
|
||||
|
||||
@@ -168,12 +169,11 @@ ecma_op_dataview_get_object (ecma_value_t this_arg) /**< this argument */
|
||||
{
|
||||
if (ecma_is_value_object (this_arg))
|
||||
{
|
||||
ecma_dataview_object_t *dataview_object_p = (ecma_dataview_object_t *) ecma_get_object_from_value (this_arg);
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
if (ecma_get_object_type (&dataview_object_p->header.object) == ECMA_OBJECT_TYPE_CLASS
|
||||
&& dataview_object_p->header.u.class_prop.class_id == LIT_MAGIC_STRING_DATAVIEW_UL)
|
||||
if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_DATAVIEW))
|
||||
{
|
||||
return dataview_object_p;
|
||||
return (ecma_dataview_object_t *) object_p;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi
|
||||
}
|
||||
|
||||
ecma_object_t *buffer_p = view_p->buffer_p;
|
||||
JERRY_ASSERT (ecma_object_class_is (buffer_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL));
|
||||
JERRY_ASSERT (ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER));
|
||||
|
||||
/* 3. */
|
||||
ecma_number_t get_index;
|
||||
@@ -307,7 +307,7 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi
|
||||
uint32_t view_offset = view_p->byte_offset;
|
||||
|
||||
/* GetViewValue 8., SetViewValue 10. */
|
||||
uint32_t view_size = view_p->header.u.class_prop.u.length;
|
||||
uint32_t view_size = view_p->header.u.cls.u3.length;
|
||||
|
||||
/* GetViewValue 9., SetViewValue 11. */
|
||||
uint8_t element_size = (uint8_t) (1 << (ecma_typedarray_helper_get_shift_size (id)));
|
||||
@@ -362,10 +362,7 @@ ecma_is_dataview (ecma_value_t value) /**< the target need to be checked */
|
||||
return false;
|
||||
}
|
||||
|
||||
ecma_dataview_object_t *dataview_object_p = (ecma_dataview_object_t *) ecma_get_object_from_value (value);
|
||||
|
||||
return (ecma_get_object_type (&dataview_object_p->header.object) == ECMA_OBJECT_TYPE_CLASS
|
||||
&& dataview_object_p->header.u.class_prop.class_id == LIT_MAGIC_STRING_DATAVIEW_UL);
|
||||
return ecma_object_class_is (ecma_get_object_from_value (value), ECMA_OBJECT_CLASS_DATAVIEW);
|
||||
} /* ecma_is_dataview */
|
||||
|
||||
/**
|
||||
|
||||
@@ -154,7 +154,8 @@ ecma_new_standard_error (jerry_error_t error_type, /**< native error type */
|
||||
sizeof (ecma_extended_object_t),
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
((ecma_extended_object_t *) new_error_obj_p)->u.class_prop.class_id = LIT_MAGIC_STRING_ERROR_UL;
|
||||
((ecma_extended_object_t *) new_error_obj_p)->u.cls.type = ECMA_OBJECT_CLASS_ERROR;
|
||||
((ecma_extended_object_t *) new_error_obj_p)->u.cls.u2.id = LIT_MAGIC_STRING_ERROR_UL;
|
||||
|
||||
if (message_string_p != NULL)
|
||||
{
|
||||
|
||||
@@ -132,28 +132,31 @@ ecma_create_iter_result_object (ecma_value_t value, /**< value */
|
||||
ecma_value_t
|
||||
ecma_op_create_iterator_object (ecma_value_t iterated_value, /**< value from create iterator */
|
||||
ecma_object_t *prototype_obj_p, /**< prototype object */
|
||||
ecma_pseudo_array_type_t iterator_type, /**< iterator type */
|
||||
ecma_object_class_type_t iterator_type, /**< iterator type */
|
||||
ecma_iterator_kind_t kind) /**< iterator kind*/
|
||||
{
|
||||
/* 1. */
|
||||
JERRY_ASSERT (iterator_type >= ECMA_PSEUDO_ARRAY_ITERATOR
|
||||
&& iterator_type <= ECMA_PSEUDO_ARRAY__MAX
|
||||
&& kind < ECMA_ITERATOR__COUNT);
|
||||
JERRY_ASSERT (iterator_type == ECMA_OBJECT_CLASS_ARRAY_ITERATOR
|
||||
|| iterator_type == ECMA_OBJECT_CLASS_SET_ITERATOR
|
||||
|| iterator_type == ECMA_OBJECT_CLASS_MAP_ITERATOR
|
||||
|| iterator_type == ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR
|
||||
|| iterator_type == ECMA_OBJECT_CLASS_STRING_ITERATOR);
|
||||
JERRY_ASSERT (kind < ECMA_ITERATOR__COUNT);
|
||||
|
||||
/* 2. */
|
||||
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
|
||||
sizeof (ecma_extended_object_t),
|
||||
ECMA_OBJECT_TYPE_PSEUDO_ARRAY);
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
|
||||
ext_obj_p->u.pseudo_array.type = (uint8_t) iterator_type;
|
||||
ext_obj_p->u.cls.type = (uint8_t) iterator_type;
|
||||
|
||||
/* 3. */
|
||||
ext_obj_p->u.pseudo_array.u2.iterated_value = iterated_value;
|
||||
ext_obj_p->u.cls.u3.iterated_value = iterated_value;
|
||||
/* 4. */
|
||||
ext_obj_p->u.pseudo_array.u1.iterator_index = 0;
|
||||
ext_obj_p->u.cls.u2.iterator_index = 0;
|
||||
/* 5. */
|
||||
ext_obj_p->u.pseudo_array.extra_info = (uint8_t) kind;
|
||||
ext_obj_p->u.cls.u1.iterator_kind = (uint8_t) kind;
|
||||
|
||||
/* 6. */
|
||||
return ecma_make_object_value (object_p);
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef enum
|
||||
ecma_value_t
|
||||
ecma_op_create_iterator_object (ecma_value_t iterated_value,
|
||||
ecma_object_t *prototype_obj_p,
|
||||
ecma_pseudo_array_type_t iterator_type,
|
||||
ecma_object_class_type_t iterator_type,
|
||||
ecma_iterator_kind_t kind);
|
||||
|
||||
ecma_value_t
|
||||
|
||||
@@ -183,7 +183,7 @@ ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the
|
||||
{
|
||||
/* 2. */
|
||||
JERRY_ASSERT (ecma_object_class_is (ecma_get_object_from_value (job_p->capability),
|
||||
LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY));
|
||||
ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));
|
||||
ecma_promise_capabality_t *capability_p;
|
||||
capability_p = (ecma_promise_capabality_t *) ecma_get_object_from_value (job_p->capability);
|
||||
|
||||
@@ -192,7 +192,7 @@ ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the
|
||||
{
|
||||
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
|
||||
JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB,
|
||||
capability_p->header.u.class_prop.u.promise,
|
||||
capability_p->header.u.cls.u3.promise,
|
||||
ECMA_VALUE_UNDEFINED,
|
||||
JERRY_CONTEXT (promise_callback_user_p));
|
||||
}
|
||||
@@ -250,7 +250,7 @@ ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the
|
||||
{
|
||||
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
|
||||
JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_AFTER_REACTION_JOB,
|
||||
capability_p->header.u.class_prop.u.promise,
|
||||
capability_p->header.u.cls.u3.promise,
|
||||
ECMA_VALUE_UNDEFINED,
|
||||
JERRY_CONTEXT (promise_callback_user_p));
|
||||
}
|
||||
@@ -293,7 +293,8 @@ ecma_process_promise_async_reaction_job (ecma_job_promise_async_reaction_t *job_
|
||||
|
||||
if (ecma_job_queue_get_type (&job_p->header) == ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED)
|
||||
{
|
||||
if (!(executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD))
|
||||
if (!(executable_object_p->extended_object.u.cls.u2.executable_obj_flags
|
||||
& ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD))
|
||||
{
|
||||
executable_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_throw;
|
||||
}
|
||||
@@ -321,14 +322,14 @@ ecma_process_promise_async_reaction_job (ecma_job_promise_async_reaction_t *job_
|
||||
}
|
||||
|
||||
/* Exception: Abort iterators, clear all status. */
|
||||
executable_object_p->extended_object.u.class_prop.extra_info &= ECMA_AWAIT_CLEAR_MASK;
|
||||
executable_object_p->extended_object.u.cls.u2.executable_obj_flags &= ECMA_AWAIT_CLEAR_MASK;
|
||||
executable_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_throw;
|
||||
}
|
||||
}
|
||||
|
||||
ecma_value_t result;
|
||||
|
||||
if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)
|
||||
if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)
|
||||
{
|
||||
job_p->argument = ecma_await_continue (executable_object_p, job_p->argument);
|
||||
|
||||
@@ -337,7 +338,8 @@ ecma_process_promise_async_reaction_job (ecma_job_promise_async_reaction_t *job_
|
||||
job_p->argument = jcontext_take_exception ();
|
||||
executable_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_throw;
|
||||
}
|
||||
else if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)
|
||||
else if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags
|
||||
& ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)
|
||||
{
|
||||
/* Continue iteration. */
|
||||
JERRY_ASSERT (job_p->argument == ECMA_VALUE_UNDEFINED);
|
||||
@@ -356,15 +358,15 @@ ecma_process_promise_async_reaction_job (ecma_job_promise_async_reaction_t *job_
|
||||
}
|
||||
|
||||
/* Clear all status. */
|
||||
executable_object_p->extended_object.u.class_prop.extra_info &= ECMA_AWAIT_CLEAR_MASK;
|
||||
executable_object_p->extended_object.u.cls.u2.executable_obj_flags &= ECMA_AWAIT_CLEAR_MASK;
|
||||
}
|
||||
|
||||
result = opfunc_resume_executable_object (executable_object_p, job_p->argument);
|
||||
/* Argument reference has been taken by opfunc_resume_executable_object. */
|
||||
job_p->argument = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
uint16_t expected_bits = (ECMA_EXECUTABLE_OBJECT_COMPLETED | ECMA_ASYNC_GENERATOR_CALLED);
|
||||
if ((executable_object_p->extended_object.u.class_prop.extra_info & expected_bits) == expected_bits)
|
||||
const uint16_t expected_bits = (ECMA_EXECUTABLE_OBJECT_COMPLETED | ECMA_ASYNC_GENERATOR_CALLED);
|
||||
if ((executable_object_p->extended_object.u.cls.u2.executable_obj_flags & expected_bits) == expected_bits)
|
||||
{
|
||||
ecma_async_generator_finalize (executable_object_p, result);
|
||||
result = ECMA_VALUE_UNDEFINED;
|
||||
@@ -425,7 +427,7 @@ ecma_process_promise_resolve_thenable_job (ecma_job_promise_resolve_thenable_t *
|
||||
{
|
||||
ecma_promise_object_t *promise_p = (ecma_promise_object_t *) ecma_get_object_from_value (job_p->promise);
|
||||
|
||||
promise_p->header.u.class_prop.extra_info &= (uint16_t) ~ECMA_PROMISE_ALREADY_RESOLVED;
|
||||
promise_p->header.u.cls.u1.promise_flags &= (uint8_t) ~ECMA_PROMISE_ALREADY_RESOLVED;
|
||||
|
||||
ecma_value_t ret = ecma_promise_run_executor ((ecma_object_t *) promise_p, job_p->then, job_p->thenable);
|
||||
|
||||
|
||||
@@ -75,10 +75,11 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_NUMBER_UL;
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_NUMBER;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_NUMBER_UL;
|
||||
|
||||
/* Pass reference (no need to free conv_to_num_completion). */
|
||||
ext_object_p->u.class_prop.u.value = conv_to_num_completion;
|
||||
ext_object_p->u.cls.u3.value = conv_to_num_completion;
|
||||
#if JERRY_ESNEXT
|
||||
if (new_target)
|
||||
{
|
||||
|
||||
@@ -223,14 +223,14 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
if (hint == ECMA_PREFERRED_TYPE_NO)
|
||||
{
|
||||
if (ecma_object_class_is (obj_p, LIT_MAGIC_STRING_DATE_UL))
|
||||
hint = ECMA_PREFERRED_TYPE_NUMBER;
|
||||
|
||||
#if JERRY_BUILTIN_DATE
|
||||
if (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_DATE))
|
||||
{
|
||||
hint = ECMA_PREFERRED_TYPE_STRING;
|
||||
}
|
||||
else
|
||||
{
|
||||
hint = ECMA_PREFERRED_TYPE_NUMBER;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_DATE */
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -91,41 +91,99 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_STRING_UL)
|
||||
switch (ext_object_p->u.cls.type)
|
||||
{
|
||||
if (ecma_string_is_length (property_name_p))
|
||||
case ECMA_OBJECT_CLASS_STRING:
|
||||
{
|
||||
if (options & ECMA_PROPERTY_GET_VALUE)
|
||||
{
|
||||
ecma_value_t prim_value_p = ext_object_p->u.class_prop.u.value;
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);
|
||||
|
||||
lit_utf8_size_t length = ecma_string_get_length (prim_value_str_p);
|
||||
property_ref_p->virtual_value = ecma_make_uint32_value (length);
|
||||
}
|
||||
|
||||
return ECMA_PROPERTY_VIRTUAL;
|
||||
}
|
||||
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_value_t prim_value_p = ext_object_p->u.class_prop.u.value;
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);
|
||||
|
||||
if (index < ecma_string_get_length (prim_value_str_p))
|
||||
if (ecma_string_is_length (property_name_p))
|
||||
{
|
||||
if (options & ECMA_PROPERTY_GET_VALUE)
|
||||
{
|
||||
ecma_char_t char_at_idx = ecma_string_get_char_at_pos (prim_value_str_p, index);
|
||||
ecma_string_t *char_str_p = ecma_new_ecma_string_from_code_unit (char_at_idx);
|
||||
property_ref_p->virtual_value = ecma_make_string_value (char_str_p);
|
||||
ecma_value_t prim_value_p = ext_object_p->u.cls.u3.value;
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);
|
||||
|
||||
lit_utf8_size_t length = ecma_string_get_length (prim_value_str_p);
|
||||
property_ref_p->virtual_value = ecma_make_uint32_value (length);
|
||||
}
|
||||
|
||||
return ECMA_PROPERTY_FLAG_ENUMERABLE | ECMA_PROPERTY_VIRTUAL;
|
||||
return ECMA_PROPERTY_VIRTUAL;
|
||||
}
|
||||
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_value_t prim_value_p = ext_object_p->u.cls.u3.value;
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);
|
||||
|
||||
if (index < ecma_string_get_length (prim_value_str_p))
|
||||
{
|
||||
if (options & ECMA_PROPERTY_GET_VALUE)
|
||||
{
|
||||
ecma_char_t char_at_idx = ecma_string_get_char_at_pos (prim_value_str_p, index);
|
||||
ecma_string_t *char_str_p = ecma_new_ecma_string_from_code_unit (char_at_idx);
|
||||
property_ref_p->virtual_value = ecma_make_string_value (char_str_p);
|
||||
}
|
||||
|
||||
return ECMA_PROPERTY_FLAG_ENUMERABLE | ECMA_PROPERTY_VIRTUAL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
/* ES2015 9.4.5.1 */
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY:
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
if (ecma_prop_name_is_symbol (property_name_p))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t array_index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
ecma_value_t value = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
if (array_index < info.length)
|
||||
{
|
||||
uint32_t byte_pos = array_index << info.shift;
|
||||
value = ecma_get_typedarray_element (info.buffer_p + byte_pos, info.id);
|
||||
}
|
||||
|
||||
if (!ecma_is_value_undefined (value))
|
||||
{
|
||||
if (options & ECMA_PROPERTY_GET_VALUE)
|
||||
{
|
||||
property_ref_p->virtual_value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_fast_free_value (value);
|
||||
}
|
||||
|
||||
return ECMA_PROPERTY_ENUMERABLE_WRITABLE | ECMA_PROPERTY_VIRTUAL;
|
||||
}
|
||||
|
||||
return ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP;
|
||||
}
|
||||
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
|
||||
if (ecma_compare_ecma_strings (property_name_p, num_to_str))
|
||||
{
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
|
||||
return ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP;
|
||||
}
|
||||
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -173,63 +231,6 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
|
||||
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
/* ES2015 9.4.5.1 */
|
||||
if (ecma_object_is_typedarray (object_p))
|
||||
{
|
||||
if (ecma_prop_name_is_symbol (property_name_p))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t array_index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
ecma_value_t value = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
if (array_index < info.length)
|
||||
{
|
||||
uint32_t byte_pos = array_index << info.shift;
|
||||
value = ecma_get_typedarray_element (info.buffer_p + byte_pos, info.id);
|
||||
}
|
||||
|
||||
if (!ecma_is_value_undefined (value))
|
||||
{
|
||||
if (options & ECMA_PROPERTY_GET_VALUE)
|
||||
{
|
||||
property_ref_p->virtual_value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_fast_free_value (value);
|
||||
}
|
||||
|
||||
return ECMA_PROPERTY_ENUMERABLE_WRITABLE | ECMA_PROPERTY_VIRTUAL;
|
||||
}
|
||||
|
||||
return ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP;
|
||||
}
|
||||
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
|
||||
if (ecma_compare_ecma_strings (property_name_p, num_to_str))
|
||||
{
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
|
||||
return ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP;
|
||||
}
|
||||
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -255,6 +256,14 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ECMA_OBJECT_TYPE_CLASS:
|
||||
{
|
||||
if (((ecma_extended_object_t *) object_p)->u.cls.type == ECMA_OBJECT_CLASS_ARGUMENTS)
|
||||
{
|
||||
property_p = ecma_op_arguments_object_try_to_lazy_instantiate_property (object_p, property_name_p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_FUNCTION:
|
||||
{
|
||||
#if !JERRY_ESNEXT
|
||||
@@ -299,14 +308,6 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
|
||||
property_p = ecma_op_bound_function_try_to_lazy_instantiate_property (object_p, property_name_p);
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
if (((ecma_extended_object_t *) object_p)->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS)
|
||||
{
|
||||
property_p = ecma_op_arguments_object_try_to_lazy_instantiate_property (object_p, property_name_p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -319,15 +320,15 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
|
||||
return ECMA_PROPERTY_TYPE_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
else if (type == ECMA_OBJECT_TYPE_PSEUDO_ARRAY
|
||||
&& ((ecma_extended_object_t *) object_p)->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS
|
||||
&& (((ecma_extended_object_t *) object_p)->u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_MAPPED))
|
||||
else if (type == ECMA_OBJECT_TYPE_CLASS
|
||||
&& ((ecma_extended_object_t *) object_p)->u.cls.type == ECMA_OBJECT_CLASS_ARGUMENTS
|
||||
&& (((ecma_extended_object_t *) object_p)->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED))
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index < ext_object_p->u.pseudo_array.u1.formal_params_number)
|
||||
if (index < ext_object_p->u.cls.u2.formal_params_number)
|
||||
{
|
||||
ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;
|
||||
|
||||
@@ -445,34 +446,101 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_STRING_UL)
|
||||
switch (ext_object_p->u.cls.type)
|
||||
{
|
||||
if (ecma_string_is_length (property_name_p))
|
||||
case ECMA_OBJECT_CLASS_STRING:
|
||||
{
|
||||
ecma_value_t prim_value_p = ext_object_p->u.class_prop.u.value;
|
||||
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);
|
||||
lit_utf8_size_t length = ecma_string_get_length (prim_value_str_p);
|
||||
|
||||
return ecma_make_uint32_value (length);
|
||||
}
|
||||
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_value_t prim_value_p = ext_object_p->u.class_prop.u.value;
|
||||
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);
|
||||
|
||||
if (index < ecma_string_get_length (prim_value_str_p))
|
||||
if (ecma_string_is_length (property_name_p))
|
||||
{
|
||||
ecma_char_t char_at_idx = ecma_string_get_char_at_pos (prim_value_str_p, index);
|
||||
return ecma_make_string_value (ecma_new_ecma_string_from_code_unit (char_at_idx));
|
||||
}
|
||||
}
|
||||
}
|
||||
ecma_value_t prim_value_p = ext_object_p->u.cls.u3.value;
|
||||
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);
|
||||
lit_utf8_size_t length = ecma_string_get_length (prim_value_str_p);
|
||||
|
||||
return ecma_make_uint32_value (length);
|
||||
}
|
||||
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_value_t prim_value_p = ext_object_p->u.cls.u3.value;
|
||||
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);
|
||||
|
||||
if (index < ecma_string_get_length (prim_value_str_p))
|
||||
{
|
||||
ecma_char_t char_at_idx = ecma_string_get_char_at_pos (prim_value_str_p, index);
|
||||
return ecma_make_string_value (ecma_new_ecma_string_from_code_unit (char_at_idx));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_ARGUMENTS:
|
||||
{
|
||||
if (!(ext_object_p->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index < ext_object_p->u.cls.u2.formal_params_number)
|
||||
{
|
||||
ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;
|
||||
|
||||
ecma_value_t *argv_p = (ecma_value_t *) (mapped_arguments_p + 1);
|
||||
|
||||
if (!ecma_is_value_empty (argv_p[index]))
|
||||
{
|
||||
ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index);
|
||||
ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env);
|
||||
|
||||
return ecma_op_get_binding_value (lex_env_p, name_p, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
/* ES2015 9.4.5.4 */
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY:
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
if (ecma_prop_name_is_symbol (property_name_p))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t array_index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
|
||||
if (array_index >= info.length)
|
||||
{
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
uint32_t byte_pos = array_index << info.shift;
|
||||
return ecma_get_typedarray_element (info.buffer_p + byte_pos, info.id);
|
||||
}
|
||||
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
|
||||
if (ecma_compare_ecma_strings (property_name_p, num_to_str))
|
||||
{
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_ARRAY:
|
||||
@@ -503,70 +571,6 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
|
||||
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS
|
||||
&& ext_object_p->u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
{
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index < ext_object_p->u.pseudo_array.u1.formal_params_number)
|
||||
{
|
||||
ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;
|
||||
|
||||
ecma_value_t *argv_p = (ecma_value_t *) (mapped_arguments_p + 1);
|
||||
|
||||
if (!ecma_is_value_empty (argv_p[index]))
|
||||
{
|
||||
ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index);
|
||||
ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env);
|
||||
|
||||
return ecma_op_get_binding_value (lex_env_p, name_p, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
/* ES2015 9.4.5.4 */
|
||||
if (ecma_object_is_typedarray (object_p))
|
||||
{
|
||||
if (ecma_prop_name_is_symbol (property_name_p))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t array_index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
|
||||
if (array_index >= info.length)
|
||||
{
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
uint32_t byte_pos = array_index << info.shift;
|
||||
return ecma_get_typedarray_element (info.buffer_p + byte_pos, info.id);
|
||||
}
|
||||
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
|
||||
if (ecma_compare_ecma_strings (property_name_p, num_to_str))
|
||||
{
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -592,6 +596,14 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ECMA_OBJECT_TYPE_CLASS:
|
||||
{
|
||||
if (((ecma_extended_object_t *) object_p)->u.cls.type == ECMA_OBJECT_CLASS_ARGUMENTS)
|
||||
{
|
||||
property_p = ecma_op_arguments_object_try_to_lazy_instantiate_property (object_p, property_name_p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_FUNCTION:
|
||||
{
|
||||
#if !JERRY_ESNEXT
|
||||
@@ -631,14 +643,6 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
|
||||
property_p = ecma_op_bound_function_try_to_lazy_instantiate_property (object_p, property_name_p);
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
if (((ecma_extended_object_t *) object_p)->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS)
|
||||
{
|
||||
property_p = ecma_op_arguments_object_try_to_lazy_instantiate_property (object_p, property_name_p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -1258,6 +1262,77 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ECMA_OBJECT_TYPE_CLASS:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
switch (ext_object_p->u.cls.type)
|
||||
{
|
||||
case ECMA_OBJECT_CLASS_ARGUMENTS:
|
||||
{
|
||||
if (!(ext_object_p->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index < ext_object_p->u.cls.u2.formal_params_number)
|
||||
{
|
||||
ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;
|
||||
|
||||
ecma_value_t *argv_p = (ecma_value_t *) (mapped_arguments_p + 1);
|
||||
|
||||
if (!ecma_is_value_empty (argv_p[index]))
|
||||
{
|
||||
ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index);
|
||||
ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env);
|
||||
ecma_op_set_mutable_binding (lex_env_p, name_p, value, true);
|
||||
return ECMA_VALUE_TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
/* ES2015 9.4.5.5 */
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY:
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
if (ecma_prop_name_is_symbol (property_name_p))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t array_index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
|
||||
if (array_index >= info.length)
|
||||
{
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
|
||||
uint32_t byte_pos = array_index << info.shift;
|
||||
return ecma_set_typedarray_element (info.buffer_p + byte_pos, value, info.id);
|
||||
}
|
||||
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
bool is_same = ecma_compare_ecma_strings (property_name_p, num_to_str);
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
|
||||
if (is_same)
|
||||
{
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_ARRAY:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
@@ -1287,68 +1362,6 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
}
|
||||
|
||||
JERRY_ASSERT (!ecma_op_object_is_fast_array (object_p));
|
||||
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS
|
||||
&& (ext_object_p->u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_MAPPED))
|
||||
{
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index < ext_object_p->u.pseudo_array.u1.formal_params_number)
|
||||
{
|
||||
ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;
|
||||
|
||||
ecma_value_t *argv_p = (ecma_value_t *) (mapped_arguments_p + 1);
|
||||
|
||||
if (!ecma_is_value_empty (argv_p[index]))
|
||||
{
|
||||
ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index);
|
||||
ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env);
|
||||
ecma_op_set_mutable_binding (lex_env_p, name_p, value, true);
|
||||
return ECMA_VALUE_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
/* ES2015 9.4.5.5 */
|
||||
if (ecma_object_is_typedarray (object_p))
|
||||
{
|
||||
if (ecma_prop_name_is_symbol (property_name_p))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t array_index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
|
||||
if (array_index >= info.length)
|
||||
{
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
|
||||
uint32_t byte_pos = array_index << info.shift;
|
||||
return ecma_set_typedarray_element (info.buffer_p + byte_pos, value, info.id);
|
||||
}
|
||||
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
bool is_same = ecma_compare_ecma_strings (property_name_p, num_to_str);
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
|
||||
if (is_same)
|
||||
{
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -1380,19 +1393,28 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_STRING_UL)
|
||||
switch (ext_object_p->u.cls.type)
|
||||
{
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
case ECMA_OBJECT_CLASS_STRING:
|
||||
{
|
||||
ecma_value_t prim_value_p = ext_object_p->u.class_prop.u.value;
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (index < ecma_string_get_length (prim_value_str_p))
|
||||
if (index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
return ecma_raise_readonly_assignment (property_name_p, is_throw);
|
||||
ecma_value_t prim_value_p = ext_object_p->u.cls.u3.value;
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);
|
||||
|
||||
if (index < ecma_string_get_length (prim_value_str_p))
|
||||
{
|
||||
return ecma_raise_readonly_assignment (property_name_p, is_throw);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_ARGUMENTS:
|
||||
{
|
||||
property_p = ecma_op_arguments_object_try_to_lazy_instantiate_property (object_p, property_name_p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1424,14 +1446,6 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
property_p = ecma_op_bound_function_try_to_lazy_instantiate_property (object_p, property_name_p);
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
if (((ecma_extended_object_t *) object_p)->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS)
|
||||
{
|
||||
property_p = ecma_op_arguments_object_try_to_lazy_instantiate_property (object_p, property_name_p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -1539,12 +1553,12 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
{
|
||||
const ecma_object_type_t obj_type = ecma_get_object_type (object_p);
|
||||
|
||||
if (obj_type == ECMA_OBJECT_TYPE_PSEUDO_ARRAY)
|
||||
if (obj_type == ECMA_OBJECT_TYPE_CLASS)
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS
|
||||
&& ext_object_p->u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_ARGUMENTS
|
||||
&& ext_object_p->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED)
|
||||
{
|
||||
const uint32_t flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | ECMA_PROP_SHOULD_THROW;
|
||||
return ecma_builtin_helper_def_prop (object_p, property_name_p, value, flags);
|
||||
@@ -1652,16 +1666,11 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT (property_name_p != NULL);
|
||||
|
||||
if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_PSEUDO_ARRAY)
|
||||
if (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARGUMENTS))
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
if (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS)
|
||||
{
|
||||
return ecma_op_arguments_object_delete (obj_p,
|
||||
property_name_p,
|
||||
is_strict);
|
||||
}
|
||||
return ecma_op_arguments_object_delete (obj_p,
|
||||
property_name_p,
|
||||
is_strict);
|
||||
}
|
||||
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
@@ -1738,35 +1747,37 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ECMA_OBJECT_TYPE_CLASS:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
switch (ext_object_p->u.cls.type)
|
||||
{
|
||||
case ECMA_OBJECT_CLASS_ARGUMENTS:
|
||||
{
|
||||
return ecma_op_arguments_object_define_own_property (obj_p, property_name_p, property_desc_p);
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
/* ES2015 9.4.5.1 */
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY:
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
return ecma_op_typedarray_define_own_property (obj_p, property_name_p, property_desc_p);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_ARRAY:
|
||||
{
|
||||
return ecma_op_array_object_define_own_property (obj_p, property_name_p, property_desc_p);
|
||||
}
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
case ECMA_OBJECT_TYPE_PROXY:
|
||||
{
|
||||
return ecma_proxy_object_define_own_property (obj_p, property_name_p, property_desc_p);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
case ECMA_OBJECT_TYPE_ARRAY:
|
||||
{
|
||||
return ecma_op_array_object_define_own_property (obj_p, property_name_p, property_desc_p);
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
if (ecma_object_is_typedarray (obj_p))
|
||||
{
|
||||
return ecma_op_typedarray_define_own_property (obj_p, property_name_p, property_desc_p);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
/* All iterators are pseudo arrays */
|
||||
if (((ecma_extended_object_t *) obj_p)->u.pseudo_array.type != ECMA_PSEUDO_ARRAY_ARGUMENTS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
return ecma_op_arguments_object_define_own_property (obj_p, property_name_p, property_desc_p);
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
@@ -2158,18 +2169,32 @@ ecma_object_list_lazy_property_names (ecma_object_t *obj_p, /**< object */
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
case ECMA_OBJECT_TYPE_CLASS:
|
||||
{
|
||||
if (((ecma_extended_object_t *) obj_p)->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS)
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
switch (ext_object_p->u.cls.type)
|
||||
{
|
||||
ecma_op_arguments_object_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_STRING:
|
||||
{
|
||||
ecma_op_string_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_ARGUMENTS:
|
||||
{
|
||||
ecma_op_arguments_object_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
|
||||
break;
|
||||
}
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
if (ecma_object_is_typedarray (obj_p))
|
||||
{
|
||||
ecma_op_typedarray_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
|
||||
}
|
||||
/* ES2015 9.4.5.1 */
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY:
|
||||
case ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO:
|
||||
{
|
||||
ecma_op_typedarray_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_FUNCTION:
|
||||
@@ -2187,17 +2212,6 @@ ecma_object_list_lazy_property_names (ecma_object_t *obj_p, /**< object */
|
||||
ecma_op_bound_function_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_CLASS:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
if (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_STRING_UL)
|
||||
{
|
||||
ecma_op_string_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_ARRAY:
|
||||
{
|
||||
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
|
||||
@@ -2685,54 +2699,53 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
return (lit_magic_string_id_t) ext_object_p->u.class_prop.class_id;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
switch (ext_obj_p->u.pseudo_array.type)
|
||||
switch (ext_object_p->u.cls.type)
|
||||
{
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY:
|
||||
case ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO:
|
||||
case ECMA_OBJECT_CLASS_ARGUMENTS:
|
||||
{
|
||||
return (lit_magic_string_id_t) ext_obj_p->u.pseudo_array.u1.class_id;
|
||||
return LIT_MAGIC_STRING_ARGUMENTS_UL;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_ESNEXT
|
||||
case ECMA_PSEUDO_ARRAY_ITERATOR:
|
||||
case ECMA_OBJECT_CLASS_GENERATOR:
|
||||
{
|
||||
return LIT_MAGIC_STRING_GENERATOR_UL;
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_ASYNC_GENERATOR:
|
||||
{
|
||||
return LIT_MAGIC_STRING_ASYNC_GENERATOR_UL;
|
||||
}
|
||||
case ECMA_OBJECT_CLASS_ARRAY_ITERATOR:
|
||||
{
|
||||
return LIT_MAGIC_STRING_ARRAY_ITERATOR_UL;
|
||||
}
|
||||
case ECMA_PSEUDO_SET_ITERATOR:
|
||||
case ECMA_OBJECT_CLASS_SET_ITERATOR:
|
||||
{
|
||||
return LIT_MAGIC_STRING_SET_ITERATOR_UL;
|
||||
}
|
||||
case ECMA_PSEUDO_MAP_ITERATOR:
|
||||
case ECMA_OBJECT_CLASS_MAP_ITERATOR:
|
||||
{
|
||||
return LIT_MAGIC_STRING_MAP_ITERATOR_UL;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_ESNEXT
|
||||
case ECMA_PSEUDO_STRING_ITERATOR:
|
||||
{
|
||||
return LIT_MAGIC_STRING_STRING_ITERATOR_UL;
|
||||
}
|
||||
case ECMA_PSEUDO_REGEXP_STRING_ITERATOR:
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
case ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR:
|
||||
{
|
||||
return LIT_MAGIC_STRING_REGEXP_STRING_ITERATOR_UL;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
default:
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
case ECMA_OBJECT_CLASS_STRING_ITERATOR:
|
||||
{
|
||||
JERRY_ASSERT (ext_obj_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS);
|
||||
|
||||
return LIT_MAGIC_STRING_ARGUMENTS_UL;
|
||||
return LIT_MAGIC_STRING_STRING_ITERATOR_UL;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
case ECMA_OBJECT_CLASS_MODULE:
|
||||
{
|
||||
return LIT_MAGIC_STRING_MODULE_UL;
|
||||
}
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
}
|
||||
|
||||
break;
|
||||
return (lit_magic_string_id_t) ext_object_p->u.cls.u2.id;
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_FUNCTION:
|
||||
case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:
|
||||
@@ -2841,13 +2854,13 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
|
||||
*/
|
||||
extern inline bool JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_object_class_is (ecma_object_t *object_p, /**< object */
|
||||
uint32_t class_id) /**< class id */
|
||||
ecma_object_class_type_t class_id) /**< class id */
|
||||
{
|
||||
if (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_CLASS)
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.class_prop.class_id == class_id)
|
||||
if (ext_object_p->u.cls.type == (uint8_t) class_id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -2856,6 +2869,7 @@ ecma_object_class_is (ecma_object_t *object_p, /**< object */
|
||||
return false;
|
||||
} /* ecma_object_class_is */
|
||||
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
/**
|
||||
* Checks if the given argument has [[RegExpMatcher]] internal slot
|
||||
*
|
||||
@@ -2866,8 +2880,9 @@ extern inline bool JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_object_is_regexp_object (ecma_value_t arg) /**< argument */
|
||||
{
|
||||
return (ecma_is_value_object (arg)
|
||||
&& ecma_object_class_is (ecma_get_object_from_value (arg), LIT_MAGIC_STRING_REGEXP_UL));
|
||||
&& ecma_object_class_is (ecma_get_object_from_value (arg), ECMA_OBJECT_CLASS_REGEXP));
|
||||
} /* ecma_object_is_regexp_object */
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
/**
|
||||
|
||||
@@ -100,8 +100,10 @@ ecma_collection_t *ecma_op_object_own_property_keys (ecma_object_t *obj_p);
|
||||
ecma_collection_t *ecma_op_object_enumerate (ecma_object_t *obj_p);
|
||||
|
||||
lit_magic_string_id_t ecma_object_get_class_name (ecma_object_t *obj_p);
|
||||
bool ecma_object_class_is (ecma_object_t *object_p, uint32_t class_id);
|
||||
bool ecma_object_class_is (ecma_object_t *object_p, ecma_object_class_type_t class_id);
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
bool ecma_object_is_regexp_object (ecma_value_t arg);
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
#if JERRY_ESNEXT
|
||||
ecma_value_t ecma_op_is_concat_spreadable (ecma_value_t arg);
|
||||
ecma_value_t ecma_op_is_regexp (ecma_value_t arg);
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
extern inline bool JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_is_promise (ecma_object_t *obj_p) /**< points to object */
|
||||
{
|
||||
return ecma_object_class_is (obj_p, LIT_MAGIC_STRING_PROMISE_UL);
|
||||
return ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_PROMISE);
|
||||
} /* ecma_is_promise */
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ ecma_promise_get_result (ecma_object_t *obj_p) /**< points to promise object */
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
return ecma_copy_value (ext_object_p->u.class_prop.u.value);
|
||||
return ecma_copy_value (ext_object_p->u.cls.u3.value);
|
||||
} /* ecma_promise_get_result */
|
||||
|
||||
/**
|
||||
@@ -77,9 +77,9 @@ ecma_promise_set_result (ecma_object_t *obj_p, /**< points to promise object */
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
JERRY_ASSERT (ext_object_p->u.class_prop.u.value == ECMA_VALUE_UNDEFINED);
|
||||
JERRY_ASSERT (ext_object_p->u.cls.u3.value == ECMA_VALUE_UNDEFINED);
|
||||
|
||||
ext_object_p->u.class_prop.u.value = result;
|
||||
ext_object_p->u.cls.u3.value = result;
|
||||
} /* ecma_promise_set_result */
|
||||
|
||||
/**
|
||||
@@ -87,12 +87,12 @@ ecma_promise_set_result (ecma_object_t *obj_p, /**< points to promise object */
|
||||
*
|
||||
* @return the state's enum value
|
||||
*/
|
||||
uint16_t
|
||||
uint8_t
|
||||
ecma_promise_get_flags (ecma_object_t *obj_p) /**< points to promise object */
|
||||
{
|
||||
JERRY_ASSERT (ecma_is_promise (obj_p));
|
||||
|
||||
return ((ecma_extended_object_t *) obj_p)->u.class_prop.extra_info;
|
||||
return ((ecma_extended_object_t *) obj_p)->u.cls.u1.promise_flags;
|
||||
} /* ecma_promise_get_flags */
|
||||
|
||||
/**
|
||||
@@ -105,10 +105,10 @@ ecma_promise_set_state (ecma_object_t *obj_p, /**< points to promise object */
|
||||
JERRY_ASSERT (ecma_is_promise (obj_p));
|
||||
JERRY_ASSERT (ecma_promise_get_flags (obj_p) & ECMA_PROMISE_IS_PENDING);
|
||||
|
||||
uint16_t flags_to_invert = (is_fulfilled ? (ECMA_PROMISE_IS_PENDING | ECMA_PROMISE_IS_FULFILLED)
|
||||
: ECMA_PROMISE_IS_PENDING);
|
||||
uint8_t flags_to_invert = (is_fulfilled ? (ECMA_PROMISE_IS_PENDING | ECMA_PROMISE_IS_FULFILLED)
|
||||
: ECMA_PROMISE_IS_PENDING);
|
||||
|
||||
((ecma_extended_object_t *) obj_p)->u.class_prop.extra_info ^= flags_to_invert;
|
||||
((ecma_extended_object_t *) obj_p)->u.cls.u1.promise_flags ^= flags_to_invert;
|
||||
} /* ecma_promise_set_state */
|
||||
|
||||
/**
|
||||
@@ -219,7 +219,7 @@ ecma_reject_promise (ecma_value_t promise, /**< promise */
|
||||
#if JERRY_PROMISE_CALLBACK
|
||||
if (reactions->item_count == 0)
|
||||
{
|
||||
((ecma_extended_object_t *) obj_p)->u.class_prop.extra_info |= ECMA_PROMISE_UNHANDLED_REJECT;
|
||||
((ecma_extended_object_t *) obj_p)->u.cls.u1.promise_flags |= ECMA_PROMISE_UNHANDLED_REJECT;
|
||||
|
||||
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))
|
||||
{
|
||||
@@ -341,7 +341,7 @@ ecma_reject_promise_with_checks (ecma_value_t promise, /**< promise */
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
((ecma_extended_object_t *) promise_obj_p)->u.class_prop.extra_info |= ECMA_PROMISE_ALREADY_RESOLVED;
|
||||
((ecma_extended_object_t *) promise_obj_p)->u.cls.u1.promise_flags |= ECMA_PROMISE_ALREADY_RESOLVED;
|
||||
|
||||
/* 6. */
|
||||
ecma_reject_promise (promise, reason);
|
||||
@@ -381,7 +381,7 @@ ecma_fulfill_promise_with_checks (ecma_value_t promise, /**< promise */
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
((ecma_extended_object_t *) promise_obj_p)->u.class_prop.extra_info |= ECMA_PROMISE_ALREADY_RESOLVED;
|
||||
((ecma_extended_object_t *) promise_obj_p)->u.cls.u1.promise_flags |= ECMA_PROMISE_ALREADY_RESOLVED;
|
||||
|
||||
ecma_fulfill_promise (promise, value);
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
@@ -504,10 +504,11 @@ ecma_op_create_promise_object (ecma_value_t executor, /**< the executor function
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
ecma_deref_object (proto_p);
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_PROMISE_UL;
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_PROMISE;
|
||||
/* 5 */
|
||||
ext_object_p->u.class_prop.extra_info = ECMA_PROMISE_IS_PENDING;
|
||||
ext_object_p->u.class_prop.u.value = ECMA_VALUE_UNDEFINED;
|
||||
ext_object_p->u.cls.u1.promise_flags = ECMA_PROMISE_IS_PENDING;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_PROMISE_UL;
|
||||
ext_object_p->u.cls.u3.value = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
/* 6-8. */
|
||||
ecma_promise_object_t *promise_object_p = (ecma_promise_object_t *) object_p;
|
||||
@@ -571,11 +572,11 @@ ecma_promise_remaining_inc_or_dec (ecma_value_t remaining, /**< the remaining co
|
||||
ecma_object_t *remaining_p = ecma_get_object_from_value (remaining);
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) remaining_p;
|
||||
|
||||
JERRY_ASSERT (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_NUMBER_UL);
|
||||
JERRY_ASSERT (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_NUMBER);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_integer_number (ext_object_p->u.class_prop.u.value));
|
||||
JERRY_ASSERT (ecma_is_value_integer_number (ext_object_p->u.cls.u3.value));
|
||||
|
||||
uint32_t current = (uint32_t) ecma_get_integer_from_value (ext_object_p->u.class_prop.u.value);
|
||||
uint32_t current = (uint32_t) ecma_get_integer_from_value (ext_object_p->u.cls.u3.value);
|
||||
|
||||
if (is_inc)
|
||||
{
|
||||
@@ -585,7 +586,7 @@ ecma_promise_remaining_inc_or_dec (ecma_value_t remaining, /**< the remaining co
|
||||
{
|
||||
current--;
|
||||
}
|
||||
ext_object_p->u.class_prop.u.value = ecma_make_uint32_value (current);
|
||||
ext_object_p->u.cls.u3.value = ecma_make_uint32_value (current);
|
||||
|
||||
return current;
|
||||
} /* ecma_promise_remaining_inc_or_dec */
|
||||
@@ -605,7 +606,9 @@ ecma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p, /**<
|
||||
{
|
||||
JERRY_UNUSED (args_count);
|
||||
ecma_promise_all_executor_t *executor_p = (ecma_promise_all_executor_t *) function_obj_p;
|
||||
uint16_t promise_type = executor_p->header.u.class_prop.extra_info;
|
||||
uint8_t promise_type = executor_p->header.u.built_in.u2.routine_flags;
|
||||
|
||||
promise_type = (uint8_t) (promise_type >> ECMA_NATIVE_HANDLER_FLAGS_PROMISE_HELPER_SHIFT);
|
||||
|
||||
/* 1 - 2. */
|
||||
if (executor_p->index == 0)
|
||||
@@ -710,7 +713,7 @@ ecma_op_get_capabilities_executor_cb (ecma_object_t *function_obj_p, /**< functi
|
||||
|
||||
/* 2-3. */
|
||||
ecma_object_t *capability_obj_p = ecma_get_object_from_value (executor_p->capability);
|
||||
JERRY_ASSERT (ecma_object_class_is (capability_obj_p, LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY));
|
||||
JERRY_ASSERT (ecma_object_class_is (capability_obj_p, ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));
|
||||
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;
|
||||
|
||||
/* 4. */
|
||||
@@ -761,8 +764,9 @@ ecma_promise_new_capability (ecma_value_t constructor, /**< constructor function
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;
|
||||
capability_p->header.u.class_prop.class_id = LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY;
|
||||
capability_p->header.u.class_prop.u.promise = ECMA_VALUE_UNDEFINED;
|
||||
capability_p->header.u.cls.type = ECMA_OBJECT_CLASS_PROMISE_CAPABILITY;
|
||||
capability_p->header.u.cls.u2.id = LIT_MAGIC_STRING_OBJECT_UL;
|
||||
capability_p->header.u.cls.u3.promise = ECMA_VALUE_UNDEFINED;
|
||||
capability_p->resolve = ECMA_VALUE_UNDEFINED;
|
||||
capability_p->reject = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
@@ -814,7 +818,7 @@ ecma_promise_new_capability (ecma_value_t constructor, /**< constructor function
|
||||
}
|
||||
|
||||
/* 10. */
|
||||
capability_p->header.u.class_prop.u.promise = promise;
|
||||
capability_p->header.u.cls.u3.promise = promise;
|
||||
|
||||
ecma_free_value (promise);
|
||||
|
||||
@@ -884,7 +888,7 @@ ecma_promise_reject_or_resolve (ecma_value_t this_arg, /**< "this" argument */
|
||||
|
||||
ecma_free_value (call_ret);
|
||||
|
||||
ecma_value_t promise = ecma_copy_value (capability_p->header.u.class_prop.u.promise);
|
||||
ecma_value_t promise = ecma_copy_value (capability_p->header.u.cls.u3.promise);
|
||||
ecma_deref_object (capability_obj_p);
|
||||
|
||||
return promise;
|
||||
@@ -905,7 +909,7 @@ ecma_promise_do_then (ecma_value_t promise, /**< the promise which call 'then' *
|
||||
ecma_value_t on_rejected, /**< on_rejected function */
|
||||
ecma_object_t *result_capability_obj_p) /**< promise capability */
|
||||
{
|
||||
JERRY_ASSERT (ecma_object_class_is (result_capability_obj_p, LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY));
|
||||
JERRY_ASSERT (ecma_object_class_is (result_capability_obj_p, ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));
|
||||
|
||||
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) result_capability_obj_p;
|
||||
|
||||
@@ -969,7 +973,7 @@ ecma_promise_do_then (ecma_value_t promise, /**< the promise which call 'then' *
|
||||
#if JERRY_PROMISE_CALLBACK
|
||||
if (ecma_promise_get_flags (promise_obj_p) & ECMA_PROMISE_UNHANDLED_REJECT)
|
||||
{
|
||||
promise_p->header.u.class_prop.extra_info &= (uint16_t) ~ECMA_PROMISE_UNHANDLED_REJECT;
|
||||
promise_p->header.u.cls.u1.promise_flags &= (uint8_t) ~ECMA_PROMISE_UNHANDLED_REJECT;
|
||||
|
||||
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))
|
||||
{
|
||||
@@ -984,7 +988,7 @@ ecma_promise_do_then (ecma_value_t promise, /**< the promise which call 'then' *
|
||||
}
|
||||
|
||||
/* 10. */
|
||||
return ecma_copy_value (capability_p->header.u.class_prop.u.promise);
|
||||
return ecma_copy_value (capability_p->header.u.cls.u3.promise);
|
||||
} /* ecma_promise_do_then */
|
||||
|
||||
/**
|
||||
@@ -1284,7 +1288,7 @@ ecma_promise_async_then (ecma_value_t promise, /**< promise object */
|
||||
#if JERRY_PROMISE_CALLBACK
|
||||
if (ecma_promise_get_flags (promise_obj_p) & ECMA_PROMISE_UNHANDLED_REJECT)
|
||||
{
|
||||
((ecma_extended_object_t *) promise_obj_p)->u.class_prop.extra_info &= (uint16_t) ~ECMA_PROMISE_UNHANDLED_REJECT;
|
||||
((ecma_extended_object_t *) promise_obj_p)->u.cls.u1.promise_flags &= (uint8_t) ~ECMA_PROMISE_UNHANDLED_REJECT;
|
||||
|
||||
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ typedef struct
|
||||
bool ecma_is_promise (ecma_object_t *obj_p);
|
||||
ecma_value_t ecma_op_create_promise_object (ecma_value_t executor, ecma_value_t parent,
|
||||
ecma_object_t *new_target_p);
|
||||
uint16_t ecma_promise_get_flags (ecma_object_t *promise_p);
|
||||
uint8_t ecma_promise_get_flags (ecma_object_t *promise_p);
|
||||
ecma_value_t ecma_promise_get_result (ecma_object_t *promise_p);
|
||||
void ecma_reject_promise (ecma_value_t promise, ecma_value_t reason);
|
||||
void ecma_fulfill_promise (ecma_value_t promise, ecma_value_t value);
|
||||
|
||||
@@ -244,7 +244,7 @@ ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer
|
||||
ecma_extended_object_t *regexp_obj_p = (ecma_extended_object_t *) new_object_p;
|
||||
|
||||
/* Class id will be initialized after the bytecode is compiled. */
|
||||
regexp_obj_p->u.class_prop.class_id = LIT_MAGIC_STRING_UNDEFINED;
|
||||
regexp_obj_p->u.cls.type = ECMA_OBJECT_CLASS__MAX;
|
||||
|
||||
ecma_value_t status = ecma_builtin_helper_def_prop (new_object_p,
|
||||
ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
|
||||
@@ -268,7 +268,7 @@ ecma_op_regexp_initialize (ecma_object_t *regexp_obj_p, /**< RegExp object */
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) regexp_obj_p;
|
||||
|
||||
#if !JERRY_ESNEXT
|
||||
if (ext_obj_p->u.class_prop.class_id == LIT_MAGIC_STRING_UNDEFINED)
|
||||
if (ext_obj_p->u.cls.type == ECMA_OBJECT_CLASS__MAX)
|
||||
{
|
||||
/* This instance has not been initialized before. */
|
||||
ecma_regexp_create_props (regexp_obj_p, pattern_str_p, flags);
|
||||
@@ -284,8 +284,9 @@ ecma_op_regexp_initialize (ecma_object_t *regexp_obj_p, /**< RegExp object */
|
||||
JERRY_UNUSED (flags);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ext_obj_p->u.class_prop.class_id = LIT_MAGIC_STRING_REGEXP_UL;
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (ext_obj_p->u.class_prop.u.value, bc_p);
|
||||
ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_REGEXP;
|
||||
ext_obj_p->u.cls.u2.id = LIT_MAGIC_STRING_REGEXP_UL;
|
||||
ECMA_SET_INTERNAL_VALUE_POINTER (ext_obj_p->u.cls.u3.value, bc_p);
|
||||
} /* ecma_op_regexp_initialize */
|
||||
|
||||
/**
|
||||
@@ -1736,8 +1737,7 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
|
||||
|
||||
/* 9. */
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) regexp_object_p;
|
||||
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_ANY_POINTER (re_compiled_code_t,
|
||||
ext_object_p->u.class_prop.u.value);
|
||||
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, ext_object_p->u.cls.u3.value);
|
||||
|
||||
/* 3. */
|
||||
lit_utf8_size_t input_size;
|
||||
@@ -2452,8 +2452,7 @@ cleanup_string:
|
||||
|
||||
ecma_object_t *const regexp_p = ecma_get_object_from_value (this_arg);
|
||||
ecma_extended_object_t *const ext_object_p = (ecma_extended_object_t *) regexp_p;
|
||||
re_compiled_code_t *const bc_p = ECMA_GET_INTERNAL_VALUE_ANY_POINTER (re_compiled_code_t,
|
||||
ext_object_p->u.class_prop.u.value);
|
||||
re_compiled_code_t *const bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, ext_object_p->u.cls.u3.value);
|
||||
|
||||
lit_utf8_size_t string_size;
|
||||
lit_utf8_size_t string_length;
|
||||
@@ -2611,8 +2610,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
|
||||
ecma_string_t *string_p, /**< source string */
|
||||
ecma_value_t replace_arg) /**< replace argument */
|
||||
{
|
||||
const re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
|
||||
re_obj_p->u.class_prop.u.value);
|
||||
const re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, re_obj_p->u.cls.u3.value);
|
||||
ecma_bytecode_ref ((ecma_compiled_code_t *) bc_p);
|
||||
|
||||
JERRY_ASSERT (bc_p != NULL);
|
||||
@@ -2972,7 +2970,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
|
||||
if (ecma_op_is_callable (result))
|
||||
{
|
||||
ecma_extended_object_t *function_p = (ecma_extended_object_t *) ecma_get_object_from_value (result);
|
||||
if (ecma_object_class_is (this_obj_p, LIT_MAGIC_STRING_REGEXP_UL)
|
||||
if (ecma_object_class_is (this_obj_p, ECMA_OBJECT_CLASS_REGEXP)
|
||||
&& ecma_builtin_is_regexp_exec (function_p))
|
||||
{
|
||||
ecma_deref_object ((ecma_object_t *) function_p);
|
||||
@@ -3016,7 +3014,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
|
||||
{
|
||||
ecma_free_value (result);
|
||||
|
||||
if (!ecma_object_class_is (this_obj_p, LIT_MAGIC_STRING_REGEXP_UL))
|
||||
if (!ecma_object_class_is (this_obj_p, ECMA_OBJECT_CLASS_REGEXP))
|
||||
{
|
||||
result = ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a valid RegExp object"));
|
||||
goto cleanup_results;
|
||||
|
||||
@@ -85,8 +85,9 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_STRING_UL;
|
||||
ext_object_p->u.class_prop.u.value = prim_value;
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_STRING;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_STRING_UL;
|
||||
ext_object_p->u.cls.u3.value = prim_value;
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
if (new_target)
|
||||
@@ -110,9 +111,9 @@ ecma_op_string_list_lazy_property_names (ecma_object_t *obj_p, /**< a String obj
|
||||
JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
JERRY_ASSERT (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_STRING_UL);
|
||||
JERRY_ASSERT (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_STRING);
|
||||
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (ext_object_p->u.class_prop.u.value);
|
||||
ecma_string_t *prim_value_str_p = ecma_get_string_from_value (ext_object_p->u.cls.u3.value);
|
||||
|
||||
lit_utf8_size_t length = ecma_string_get_length (prim_value_str_p);
|
||||
|
||||
|
||||
@@ -90,8 +90,9 @@ ecma_op_create_symbol_object (const ecma_value_t value) /**< symbol value */
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_SYMBOL_UL;
|
||||
ext_object_p->u.class_prop.u.value = ecma_copy_value (value);
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_SYMBOL;
|
||||
ext_object_p->u.cls.u2.id = LIT_MAGIC_STRING_SYMBOL_UL;
|
||||
ext_object_p->u.cls.u3.value = ecma_copy_value (value);
|
||||
|
||||
return ecma_make_object_value (object_p);
|
||||
} /* ecma_op_create_symbol_object */
|
||||
@@ -166,9 +167,9 @@ ecma_symbol_this_value (ecma_value_t this_arg) /**< this argument value */
|
||||
{
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_obj_p->u.class_prop.class_id == LIT_MAGIC_STRING_SYMBOL_UL)
|
||||
if (ext_obj_p->u.cls.type == ECMA_OBJECT_CLASS_SYMBOL)
|
||||
{
|
||||
return ext_obj_p->u.class_prop.u.value;
|
||||
return ext_obj_p->u.cls.u3.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ ecma_get_typedarray_id (ecma_object_t *obj_p) /**< typedarray object **/
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
return (ecma_typedarray_type_t) ext_object_p->u.pseudo_array.extra_info;
|
||||
return (ecma_typedarray_type_t) ext_object_p->u.cls.u1.typedarray_type;
|
||||
} /* ecma_get_typedarray_id */
|
||||
|
||||
/**
|
||||
@@ -784,13 +784,13 @@ ecma_typedarray_create_object_with_length (uint32_t array_length, /**< length of
|
||||
|
||||
ecma_object_t *object_p = ecma_create_object (proto_p,
|
||||
sizeof (ecma_extended_object_t),
|
||||
ECMA_OBJECT_TYPE_PSEUDO_ARRAY);
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.pseudo_array.u1.class_id = ecma_typedarray_magic_string_list[typedarray_id];
|
||||
ext_object_p->u.pseudo_array.type = ECMA_PSEUDO_ARRAY_TYPEDARRAY;
|
||||
ext_object_p->u.pseudo_array.extra_info = (uint8_t) typedarray_id;
|
||||
ext_object_p->u.pseudo_array.u2.arraybuffer = ecma_make_object_value (new_arraybuffer_p);
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_TYPEDARRAY;
|
||||
ext_object_p->u.cls.u1.typedarray_type = (uint8_t) typedarray_id;
|
||||
ext_object_p->u.cls.u2.id = ecma_typedarray_magic_string_list[typedarray_id];
|
||||
ext_object_p->u.cls.u3.arraybuffer = ecma_make_object_value (new_arraybuffer_p);
|
||||
|
||||
ecma_deref_object (new_arraybuffer_p);
|
||||
|
||||
@@ -824,17 +824,17 @@ ecma_typedarray_create_object_with_buffer (ecma_object_t *arraybuffer_p, /**< th
|
||||
size_t object_size = (needs_ext_typedarray_obj ? sizeof (ecma_extended_typedarray_object_t)
|
||||
: sizeof (ecma_extended_object_t));
|
||||
|
||||
ecma_object_t *object_p = ecma_create_object (proto_p, object_size, ECMA_OBJECT_TYPE_PSEUDO_ARRAY);
|
||||
ecma_object_t *object_p = ecma_create_object (proto_p, object_size, ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.pseudo_array.u1.class_id = ecma_typedarray_magic_string_list[typedarray_id];
|
||||
ext_object_p->u.pseudo_array.type = ECMA_PSEUDO_ARRAY_TYPEDARRAY;
|
||||
ext_object_p->u.pseudo_array.extra_info = (uint8_t) typedarray_id;
|
||||
ext_object_p->u.pseudo_array.u2.arraybuffer = ecma_make_object_value (arraybuffer_p);
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_TYPEDARRAY;
|
||||
ext_object_p->u.cls.u1.typedarray_type = (uint8_t) typedarray_id;
|
||||
ext_object_p->u.cls.u2.id = ecma_typedarray_magic_string_list[typedarray_id];
|
||||
ext_object_p->u.cls.u3.arraybuffer = ecma_make_object_value (arraybuffer_p);
|
||||
|
||||
if (needs_ext_typedarray_obj)
|
||||
{
|
||||
ext_object_p->u.pseudo_array.type = ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO;
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO;
|
||||
|
||||
ecma_extended_typedarray_object_t *typedarray_info_p = (ecma_extended_typedarray_object_t *) object_p;
|
||||
typedarray_info_p->array_length = array_length;
|
||||
@@ -1223,7 +1223,7 @@ ecma_typedarray_get_arraybuffer (ecma_object_t *typedarray_p) /**< the pointer t
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) typedarray_p;
|
||||
|
||||
return ecma_get_object_from_value (ext_object_p->u.pseudo_array.u2.arraybuffer);
|
||||
return ecma_get_object_from_value (ext_object_p->u.cls.u3.arraybuffer);
|
||||
} /* ecma_typedarray_get_arraybuffer */
|
||||
|
||||
/**
|
||||
@@ -1251,9 +1251,9 @@ ecma_typedarray_get_length (ecma_object_t *typedarray_p) /**< the pointer to the
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) typedarray_p;
|
||||
|
||||
if (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_TYPEDARRAY)
|
||||
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_TYPEDARRAY)
|
||||
{
|
||||
ecma_object_t *arraybuffer_p = ecma_get_object_from_value (ext_object_p->u.pseudo_array.u2.arraybuffer);
|
||||
ecma_object_t *arraybuffer_p = ecma_get_object_from_value (ext_object_p->u.cls.u3.arraybuffer);
|
||||
uint32_t buffer_length = ecma_arraybuffer_get_length (arraybuffer_p);
|
||||
uint8_t shift = ecma_typedarray_get_element_size_shift (typedarray_p);
|
||||
|
||||
@@ -1283,7 +1283,7 @@ ecma_typedarray_get_offset (ecma_object_t *typedarray_p) /**< the pointer to the
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) typedarray_p;
|
||||
|
||||
if (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_TYPEDARRAY)
|
||||
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_TYPEDARRAY)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1380,7 +1380,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
element_size_shift,
|
||||
typedarray_id);
|
||||
}
|
||||
else if (ecma_object_class_is (obj_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL))
|
||||
else if (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))
|
||||
{
|
||||
/* 22.2.1.5 */
|
||||
ecma_object_t *arraybuffer_p = obj_p;
|
||||
@@ -1498,7 +1498,7 @@ ecma_typedarray_iterators_helper (ecma_value_t this_arg, /**< this argument */
|
||||
|
||||
return ecma_op_create_iterator_object (this_arg,
|
||||
prototype_obj_p,
|
||||
ECMA_PSEUDO_ARRAY_ITERATOR,
|
||||
ECMA_OBJECT_CLASS_ARRAY_ITERATOR,
|
||||
kind);
|
||||
} /* ecma_typedarray_iterators_helper */
|
||||
|
||||
@@ -1513,12 +1513,12 @@ ecma_object_is_typedarray (ecma_object_t *obj_p) /**< the target object need to
|
||||
{
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));
|
||||
|
||||
if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_PSEUDO_ARRAY)
|
||||
if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_CLASS)
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
return ((ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_TYPEDARRAY)
|
||||
|| (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO));
|
||||
return (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_TYPEDARRAY
|
||||
|| ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_TYPEDARRAY_WITH_INFO);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -40,7 +40,6 @@ typedef enum
|
||||
LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES, /**< %TypedArray%.prototype values and [@@iterator] routine */
|
||||
LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES, /**< Set.prototype values, keys and [@@iterator] routines */
|
||||
LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES, /**< Map.prototype entries and [@@iterator] routines */
|
||||
LIT_INTERNAL_MAGIC_PROMISE_CAPABILITY, /**< PromiseCapability record */
|
||||
/* List of well known symbols */
|
||||
LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR, /**< @@asyncIterator well known symbol */
|
||||
LIT_GLOBAL_SYMBOL__FIRST = LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR, /**< first global symbol */
|
||||
@@ -59,7 +58,6 @@ typedef enum
|
||||
LIT_GLOBAL_SYMBOL__LAST = LIT_GLOBAL_SYMBOL_MATCH_ALL, /**< last global symbol */
|
||||
|
||||
LIT_INTERNAL_MAGIC_STRING_DELETED, /**< special value for deleted properties */
|
||||
LIT_INTERNAL_MAGIC_STRING_INTERNAL_OBJECT, /**< Internal object ID for internal properties */
|
||||
LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_INIT, /**< function which initializes properties */
|
||||
|
||||
LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER, /**< native pointer info associated with an object */
|
||||
|
||||
@@ -120,7 +120,10 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TAN, "tan")
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP, "(?:)")
|
||||
#endif
|
||||
#if JERRY_BUILTIN_DATE \
|
||||
|| JERRY_ESNEXT
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DATE_UL, "Date")
|
||||
#endif
|
||||
#if JERRY_BUILTIN_JSON
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_JSON_U, "JSON")
|
||||
#endif
|
||||
@@ -328,8 +331,13 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MODULE_UL, "Module")
|
||||
#endif
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NUMBER_UL, "Number")
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OBJECT_UL, "Object")
|
||||
#if JERRY_BUILTIN_REGEXP \
|
||||
|| JERRY_ESNEXT
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REGEXP_UL, "RegExp")
|
||||
#endif
|
||||
#if JERRY_PARSER
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SCRIPT_UL, "Script")
|
||||
#endif
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRING_UL, "String")
|
||||
#if JERRY_ESNEXT
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL_UL, "Symbol")
|
||||
@@ -470,8 +478,7 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL_DOT_UL, "Symbol.")
|
||||
|| JERRY_BUILTIN_WEAKMAP
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKMAP_UL, "WeakMap")
|
||||
#endif
|
||||
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET || JERRY_BUILTIN_WEAKREF \
|
||||
|| JERRY_BUILTIN_WEAKREF
|
||||
#if JERRY_BUILTIN_WEAKREF
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKREF_UL, "WeakRef")
|
||||
#endif
|
||||
#if JERRY_BUILTIN_CONTAINER \
|
||||
@@ -784,8 +791,7 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_DATE_UL, "setUTCDate")
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STARTS_WITH, "startsWith")
|
||||
#endif
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RESOURCE_ANON, "<anonymous>")
|
||||
#if JERRY_BUILTIN_DATAVIEW \
|
||||
|| JERRY_BUILTIN_TYPEDARRAY
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARRAY_BUFFER_UL, "ArrayBuffer")
|
||||
#endif
|
||||
#if JERRY_BUILTIN_ERRORS
|
||||
@@ -1073,8 +1079,15 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (3, LIT_MAGIC_STRING_NAN)
|
||||
#endif
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP)
|
||||
#else
|
||||
#elif JERRY_BUILTIN_DATE \
|
||||
|| JERRY_ESNEXT
|
||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_DATE_UL)
|
||||
#elif JERRY_BUILTIN_JSON
|
||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_JSON_U)
|
||||
#elif JERRY_BUILTIN_MATH
|
||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_LN10_U)
|
||||
#else
|
||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_NULL_UL)
|
||||
#endif
|
||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (5, LIT_MAGIC_STRING_ARRAY_UL)
|
||||
#if JERRY_PARSER && JERRY_RESOURCE_NAME
|
||||
|
||||
+12
-12
@@ -608,7 +608,7 @@ opfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context
|
||||
|
||||
ecma_object_t *proto_p = NULL;
|
||||
/* Async function objects are not accessible, so their class_id is not relevant. */
|
||||
uint16_t class_id = LIT_MAGIC_STRING_GENERATOR_UL;
|
||||
uint8_t class_type = ECMA_OBJECT_CLASS_GENERATOR;
|
||||
|
||||
if (type == VM_CREATE_EXECUTABLE_OBJECT_GENERATOR)
|
||||
{
|
||||
@@ -617,7 +617,7 @@ opfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context
|
||||
if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) == CBC_FUNCTION_ASYNC_GENERATOR)
|
||||
{
|
||||
default_proto_id = ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE;
|
||||
class_id = LIT_MAGIC_STRING_ASYNC_GENERATOR_UL;
|
||||
class_type = ECMA_OBJECT_CLASS_ASYNC_GENERATOR;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_NON_ARROW_FUNC);
|
||||
@@ -636,9 +636,9 @@ opfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context
|
||||
ecma_deref_object (proto_p);
|
||||
}
|
||||
|
||||
executable_object_p->extended_object.u.class_prop.class_id = class_id;
|
||||
executable_object_p->extended_object.u.class_prop.extra_info = 0;
|
||||
ECMA_SET_INTERNAL_VALUE_ANY_POINTER (executable_object_p->extended_object.u.class_prop.u.head, NULL);
|
||||
executable_object_p->extended_object.u.cls.type = class_type;
|
||||
executable_object_p->extended_object.u.cls.u2.executable_obj_flags = 0;
|
||||
ECMA_SET_INTERNAL_VALUE_ANY_POINTER (executable_object_p->extended_object.u.cls.u3.head, NULL);
|
||||
|
||||
JERRY_ASSERT (!(frame_ctx_p->status_flags & VM_FRAME_CTX_DIRECT_EVAL));
|
||||
|
||||
@@ -768,9 +768,9 @@ opfunc_resume_executable_object (vm_executable_object_t *executable_object_p, /*
|
||||
|
||||
ecma_ref_if_object (executable_object_p->frame_ctx.block_result);
|
||||
|
||||
JERRY_ASSERT (ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED (executable_object_p->extended_object.u.class_prop.extra_info));
|
||||
JERRY_ASSERT (ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED (executable_object_p));
|
||||
|
||||
executable_object_p->extended_object.u.class_prop.extra_info |= ECMA_EXECUTABLE_OBJECT_RUNNING;
|
||||
executable_object_p->extended_object.u.cls.u2.executable_obj_flags |= ECMA_EXECUTABLE_OBJECT_RUNNING;
|
||||
|
||||
executable_object_p->frame_ctx.prev_context_p = JERRY_CONTEXT (vm_top_context_p);
|
||||
JERRY_CONTEXT (vm_top_context_p) = &executable_object_p->frame_ctx;
|
||||
@@ -791,14 +791,14 @@ opfunc_resume_executable_object (vm_executable_object_t *executable_object_p, /*
|
||||
#endif /* JERRY_BUILTIN_REALMS */
|
||||
|
||||
JERRY_CONTEXT (current_new_target_p) = old_new_target;
|
||||
executable_object_p->extended_object.u.class_prop.extra_info &= (uint16_t) ~ECMA_EXECUTABLE_OBJECT_RUNNING;
|
||||
executable_object_p->extended_object.u.cls.u2.executable_obj_flags &= (uint8_t) ~ECMA_EXECUTABLE_OBJECT_RUNNING;
|
||||
|
||||
if (executable_object_p->frame_ctx.call_operation != VM_EXEC_RETURN)
|
||||
{
|
||||
JERRY_ASSERT (executable_object_p->frame_ctx.call_operation == VM_NO_EXEC_OP);
|
||||
|
||||
/* All resources are released. */
|
||||
executable_object_p->extended_object.u.class_prop.extra_info |= ECMA_EXECUTABLE_OBJECT_COMPLETED;
|
||||
executable_object_p->extended_object.u.cls.u2.executable_obj_flags |= ECMA_EXECUTABLE_OBJECT_COMPLETED;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -841,7 +841,7 @@ opfunc_async_generator_yield (ecma_extended_object_t *async_generator_object_p,
|
||||
{
|
||||
ecma_async_generator_task_t *task_p;
|
||||
task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t,
|
||||
async_generator_object_p->u.class_prop.u.head);
|
||||
async_generator_object_p->u.cls.u3.head);
|
||||
|
||||
ecma_value_t iter_result = ecma_create_iter_result_object (value, ECMA_VALUE_FALSE);
|
||||
ecma_fulfill_promise (task_p->promise, iter_result);
|
||||
@@ -850,7 +850,7 @@ opfunc_async_generator_yield (ecma_extended_object_t *async_generator_object_p,
|
||||
ecma_free_value (value);
|
||||
|
||||
ecma_value_t next = task_p->next;
|
||||
async_generator_object_p->u.class_prop.u.head = next;
|
||||
async_generator_object_p->u.cls.u3.head = next;
|
||||
|
||||
JERRY_ASSERT (task_p->operation_value == ECMA_VALUE_UNDEFINED);
|
||||
jmem_heap_free_block (task_p, sizeof (ecma_async_generator_task_t));
|
||||
@@ -892,7 +892,7 @@ opfunc_async_create_and_await (vm_frame_ctx_t *frame_ctx_p, /**< frame context *
|
||||
vm_executable_object_t *executable_object_p;
|
||||
executable_object_p = opfunc_create_executable_object (frame_ctx_p, VM_CREATE_EXECUTABLE_OBJECT_ASYNC);
|
||||
|
||||
executable_object_p->extended_object.u.class_prop.extra_info |= extra_flags;
|
||||
executable_object_p->extended_object.u.cls.u2.executable_obj_flags |= extra_flags;
|
||||
|
||||
ecma_promise_async_then (result, ecma_make_object_value ((ecma_object_t *) executable_object_p));
|
||||
ecma_deref_object ((ecma_object_t *) executable_object_p);
|
||||
|
||||
@@ -401,7 +401,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
{
|
||||
uint16_t extra_flags = (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD
|
||||
| (ECMA_AWAIT_FOR_CLOSE << ECMA_AWAIT_STATE_SHIFT));
|
||||
async_generator_object_p->u.class_prop.extra_info |= extra_flags;
|
||||
async_generator_object_p->u.cls.u2.executable_obj_flags |= extra_flags;
|
||||
|
||||
stack_top_p = vm_stack_context_abort (frame_ctx_p, stack_top_p);
|
||||
|
||||
|
||||
+5
-5
@@ -2623,7 +2623,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
{
|
||||
ecma_extended_object_t *async_generator_object_p = VM_GET_EXECUTABLE_OBJECT (frame_ctx_p);
|
||||
|
||||
JERRY_ASSERT (!(async_generator_object_p->u.class_prop.extra_info
|
||||
JERRY_ASSERT (!(async_generator_object_p->u.cls.u2.executable_obj_flags
|
||||
& ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD));
|
||||
|
||||
/* Byte code is executed at the first time. */
|
||||
@@ -2651,7 +2651,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
goto error;
|
||||
}
|
||||
|
||||
async_generator_object_p->u.class_prop.extra_info |= ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD;
|
||||
async_generator_object_p->u.cls.u2.executable_obj_flags |= ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD;
|
||||
frame_ctx_p->block_result = left_value;
|
||||
|
||||
frame_ctx_p->call_operation = VM_EXEC_RETURN;
|
||||
@@ -4307,7 +4307,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
frame_ctx_p->stack_top_p = stack_top_p;
|
||||
|
||||
uint16_t extra_flags = (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD
|
||||
| (ECMA_AWAIT_FOR_NEXT << ECMA_AWAIT_STATE_SHIFT));
|
||||
| (ECMA_AWAIT_FOR_NEXT << ECMA_AWAIT_STATE_SHIFT));
|
||||
|
||||
if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) == CBC_FUNCTION_ASYNC_GENERATOR
|
||||
|| frame_ctx_p->block_result != ECMA_VALUE_UNDEFINED)
|
||||
@@ -4320,7 +4320,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
goto error;
|
||||
}
|
||||
|
||||
executable_object_p->u.class_prop.extra_info |= extra_flags;
|
||||
executable_object_p->u.cls.u2.executable_obj_flags |= extra_flags;
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
@@ -4356,7 +4356,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
|
||||
uint16_t extra_flags = (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD
|
||||
| (ECMA_AWAIT_FOR_NEXT << ECMA_AWAIT_STATE_SHIFT));
|
||||
executable_object_p->u.class_prop.extra_info |= extra_flags;
|
||||
executable_object_p->u.cls.u2.executable_obj_flags |= extra_flags;
|
||||
|
||||
frame_ctx_p->call_operation = VM_EXEC_RETURN;
|
||||
frame_ctx_p->byte_code_p = byte_code_start_p + branch_offset;
|
||||
|
||||
Reference in New Issue
Block a user