Change array length into a virtual property. (#1439)

This change allows easier access to array length which improves
the performance of inserting new items into an array and there
is no need to allocate length strings anymore. The trade-of is
that array length cannot be cached anymore.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2016-11-22 13:29:53 +01:00
committed by GitHub
parent 4a0f78bc4b
commit 132477f7d5
8 changed files with 236 additions and 152 deletions
+9
View File
@@ -467,6 +467,15 @@ ecma_gc_sweep (ecma_object_t *object_p) /**< object to free */
return;
}
if (object_type == ECMA_OBJECT_TYPE_ARRAY)
{
size_t size = (ecma_get_object_is_builtin (object_p) ? sizeof (ecma_extended_built_in_object_t)
: sizeof (ecma_extended_object_t));
ecma_dealloc_extended_object ((ecma_extended_object_t *) object_p, size);
return;
}
if (ecma_get_object_is_builtin (object_p)
|| object_type == ECMA_OBJECT_TYPE_EXTERNAL_FUNCTION)
{
+9
View File
@@ -616,6 +616,15 @@ typedef struct
ecma_value_t bytecode_cp; /**< function byte code */
} function;
/*
* Description of array objects.
*/
struct
{
uint32_t length; /**< length property value */
ecma_property_t length_prop; /**< length property */
} array;
/*
* Description of arguments objects.
*/