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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user