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:
@@ -1229,9 +1229,8 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum
|
||||
{
|
||||
ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p);
|
||||
|
||||
uint32_t index;
|
||||
bool is_index = ecma_string_get_array_index (property_name_p, &index);
|
||||
JERRY_ASSERT (is_index);
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
JERRY_ASSERT (index != ECMA_STRING_NOT_ARRAY_INDEX);
|
||||
|
||||
if (index < len)
|
||||
{
|
||||
@@ -1249,9 +1248,8 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum
|
||||
{
|
||||
ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p);
|
||||
|
||||
uint32_t index;
|
||||
bool is_index = ecma_string_get_array_index (property_name_p, &index);
|
||||
JERRY_ASSERT (is_index);
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
JERRY_ASSERT (index != ECMA_STRING_NOT_ARRAY_INDEX);
|
||||
|
||||
if (index >= len)
|
||||
{
|
||||
@@ -1309,9 +1307,8 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum
|
||||
{
|
||||
ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p);
|
||||
|
||||
uint32_t index;
|
||||
bool is_index = ecma_string_get_array_index (property_name_p, &index);
|
||||
JERRY_ASSERT (is_index);
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
JERRY_ASSERT (index != ECMA_STRING_NOT_ARRAY_INDEX);
|
||||
|
||||
if (index >= copied_num && index < len)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user