Improve the construction of "length" built-in strings.

The "length" property name is the most frequently used built-in string
and also frequently created by various hot-paths. New functions are
added to improve the speed of the "length" string creation.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2016-07-13 04:50:47 -07:00
parent b4bba2ef70
commit 6f1ce8d6bb
17 changed files with 131 additions and 84 deletions
@@ -103,7 +103,7 @@ ecma_op_create_array_object (const ecma_value_t *arguments_list_p, /**< list of
* See also: ecma_object_get_class_name
*/
ecma_string_t *length_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
ecma_string_t *length_magic_string_p = ecma_new_ecma_length_string ();
ecma_property_t *length_prop_p = ecma_create_named_data_property (obj_p,
length_magic_string_p,
@@ -157,7 +157,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_ARRAY);
// 1.
ecma_string_t *magic_string_length_p = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
ecma_string_t *magic_string_length_p = ecma_new_ecma_length_string ();
ecma_property_t *len_prop_p = ecma_op_object_get_own_property (obj_p, magic_string_length_p);
JERRY_ASSERT (len_prop_p != NULL && ECMA_PROPERTY_GET_TYPE (len_prop_p) == ECMA_PROPERTY_TYPE_NAMEDDATA);
@@ -214,7 +214,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
if (new_len_uint32 >= old_len_uint32)
{
// i.
magic_string_length_p = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
magic_string_length_p = ecma_new_ecma_length_string ();
ret_value = ecma_op_general_object_define_own_property (obj_p,
magic_string_length_p,
&new_len_property_desc,
@@ -248,7 +248,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
}
// j.
magic_string_length_p = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
magic_string_length_p = ecma_new_ecma_length_string ();
ecma_value_t succeeded = ecma_op_general_object_define_own_property (obj_p,
magic_string_length_p,
&new_len_property_desc,
@@ -329,7 +329,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
}
// 3.
ecma_string_t *magic_string_length_p = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
ecma_string_t *magic_string_length_p = ecma_new_ecma_length_string ();
ecma_value_t completion = ecma_op_general_object_define_own_property (obj_p,
magic_string_length_p,
&new_len_property_desc,
@@ -363,7 +363,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
prop_desc_not_writable.is_writable = false;
ecma_value_t completion_set_not_writable;
magic_string_length_p = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
magic_string_length_p = ecma_new_ecma_length_string ();
completion_set_not_writable = ecma_op_general_object_define_own_property (obj_p,
magic_string_length_p,
&prop_desc_not_writable,