All strings whose are valid array indicies always use the UINT32_IN_DESC format. (#1422)

This patch reduces memory consumption for strings such as "0" or "123"
by 8 bytes and "4294967295" by 16 bytes. The hash computation is changed
for using the lower 16 bits for these strings which is much faster than
converting the value to string first and compute the hash. The trade-of
is a small overhead when strings are created or concatenated.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2016-11-07 15:37:36 +01:00
committed by GitHub
parent 4c5ff4ad27
commit 9f556e1c38
8 changed files with 194 additions and 206 deletions
@@ -255,9 +255,9 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, /**< the
return ret_value;
}
uint32_t index;
uint32_t index = ecma_string_get_array_index (property_name_p);
if (!ecma_string_get_array_index (property_name_p, &index))
if (index == ECMA_STRING_NOT_ARRAY_INDEX)
{
return ret_value;
}
@@ -338,9 +338,9 @@ ecma_op_arguments_object_delete (ecma_object_t *object_p, /**< the object */
if (ecma_is_value_true (ret_value))
{
uint32_t index;
uint32_t index = ecma_string_get_array_index (property_name_p);
if (ecma_string_get_array_index (property_name_p, &index))
if (index != ECMA_STRING_NOT_ARRAY_INDEX)
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;