Improve array length setting. (#1393)

The new set does not allocate memory when the size of the array is reduced.
Furthermore the [[PutObject]] method directly calls the new length setter.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2016-10-19 09:45:17 +02:00
committed by yichoi
parent a130059c8b
commit 3ce48be152
5 changed files with 332 additions and 295 deletions
+1 -10
View File
@@ -624,16 +624,7 @@ ecma_op_object_put (ecma_object_t *object_p, /**< the object */
{
if (type == ECMA_OBJECT_TYPE_ARRAY && ecma_string_is_length (property_name_p))
{
/* These cases cannot be optimized. */
ecma_property_descriptor_t value_desc = ecma_make_empty_property_descriptor ();
value_desc.is_value_defined = true;
value_desc.value = value;
return ecma_op_object_define_own_property (object_p,
property_name_p,
&value_desc,
is_throw);
return ecma_op_array_object_set_length (object_p, value, 0);
}
/* There is no need for special casing arrays here because changing the