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
@@ -825,7 +825,7 @@ ecma_builtin_json_stringify (ecma_value_t this_arg, /**< 'this' argument */
/* 4.b */
else if (ecma_object_get_class_name (obj_p) == LIT_MAGIC_STRING_ARRAY_UL)
{
ecma_string_t *length_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
ecma_string_t *length_str_p = ecma_new_ecma_length_string ();
ECMA_TRY_CATCH (array_length,
ecma_op_object_get (obj_p, length_str_p),
@@ -1624,7 +1624,7 @@ ecma_builtin_json_array (ecma_object_t *obj_p, /**< the array object*/
/* 5. */
ecma_collection_header_t *partial_p = ecma_new_values_collection (NULL, 0, true);
ecma_string_t *length_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
ecma_string_t *length_str_p = ecma_new_ecma_length_string ();
/* 6. */
ECMA_TRY_CATCH (array_length,