Add fast path to ecma_op_object_get with magic string. (#2078)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Dániel Bátyai
parent
a8dffe023e
commit
e964393abe
@@ -924,10 +924,8 @@ 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_new_ecma_length_string ();
|
||||
|
||||
ECMA_TRY_CATCH (array_length,
|
||||
ecma_op_object_get (obj_p, length_str_p),
|
||||
ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_LENGTH),
|
||||
ret_value);
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (array_length_num,
|
||||
@@ -1007,8 +1005,6 @@ ecma_builtin_json_stringify (ecma_value_t this_arg, /**< 'this' argument */
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (array_length_num);
|
||||
ECMA_FINALIZE (array_length);
|
||||
|
||||
ecma_deref_ecma_string (length_str_p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1328,11 +1324,10 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
|
||||
if (ecma_is_value_object (my_val))
|
||||
{
|
||||
ecma_object_t *value_obj_p = ecma_get_object_from_value (my_val);
|
||||
ecma_string_t *to_json_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_TO_JSON_UL);
|
||||
|
||||
/* 2.a */
|
||||
ECMA_TRY_CATCH (toJSON,
|
||||
ecma_op_object_get (value_obj_p, to_json_str_p),
|
||||
ecma_op_object_get_by_magic_id (value_obj_p, LIT_MAGIC_STRING_TO_JSON_UL),
|
||||
ret_value);
|
||||
|
||||
/* 2.b */
|
||||
@@ -1353,8 +1348,6 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
|
||||
}
|
||||
|
||||
ECMA_FINALIZE (toJSON);
|
||||
|
||||
ecma_deref_ecma_string (to_json_str_p);
|
||||
}
|
||||
|
||||
/* 3. */
|
||||
@@ -1727,11 +1720,9 @@ 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_new_ecma_length_string ();
|
||||
|
||||
/* 6. */
|
||||
ECMA_TRY_CATCH (array_length,
|
||||
ecma_op_object_get (obj_p, length_str_p),
|
||||
ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_LENGTH),
|
||||
ret_value);
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (array_length_num,
|
||||
@@ -1819,7 +1810,6 @@ ecma_builtin_json_array (ecma_object_t *obj_p, /**< the array object*/
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (array_length_num);
|
||||
ECMA_FINALIZE (array_length);
|
||||
|
||||
ecma_deref_ecma_string (length_str_p);
|
||||
ecma_free_values_collection (partial_p, true);
|
||||
|
||||
/* 11. */
|
||||
|
||||
Reference in New Issue
Block a user