Improve magic string handling. (#2221)

Remove unnecessary ref / deref calls when magic strings are used.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2018-03-01 13:31:15 +01:00
committed by GitHub
parent 26ee8f7137
commit d60d4dbba9
30 changed files with 306 additions and 497 deletions
@@ -952,14 +952,14 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
ecma_collection_header_t *for_non_enumerable_p = separate_enumerable ? non_enum_collection_p : main_collection_p;
/* 'length' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_string_t *name_p = ecma_new_ecma_length_string ();
ecma_append_to_values_collection (for_non_enumerable_p, ecma_make_string_value (name_p), 0);
ecma_deref_ecma_string (name_p);
ecma_append_to_values_collection (for_non_enumerable_p,
ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH),
0);
/* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */
name_p = ecma_get_magic_string (LIT_MAGIC_STRING_PROTOTYPE);
ecma_append_to_values_collection (for_non_enumerable_p, ecma_make_string_value (name_p), 0);
ecma_deref_ecma_string (name_p);
ecma_append_to_values_collection (for_non_enumerable_p,
ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE),
0);
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
@@ -970,14 +970,14 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)
{
/* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */
name_p = ecma_get_magic_string (LIT_MAGIC_STRING_CALLER);
ecma_append_to_values_collection (for_non_enumerable_p, ecma_make_string_value (name_p), 0);
ecma_deref_ecma_string (name_p);
ecma_append_to_values_collection (for_non_enumerable_p,
ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER),
0);
/* 'arguments' property is non-enumerable (ECMA-262 v5, 13.2.5) */
name_p = ecma_get_magic_string (LIT_MAGIC_STRING_ARGUMENTS);
ecma_append_to_values_collection (for_non_enumerable_p, ecma_make_string_value (name_p), 0);
ecma_deref_ecma_string (name_p);
ecma_append_to_values_collection (for_non_enumerable_p,
ecma_make_magic_string_value (LIT_MAGIC_STRING_ARGUMENTS),
0);
}
} /* ecma_op_function_list_lazy_property_names */
@@ -1007,9 +1007,9 @@ ecma_op_external_function_list_lazy_property_names (bool separate_enumerable, /*
ecma_collection_header_t *for_non_enumerable_p = separate_enumerable ? non_enum_collection_p : main_collection_p;
/* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */
ecma_string_t *name_p = ecma_get_magic_string (LIT_MAGIC_STRING_PROTOTYPE);
ecma_append_to_values_collection (for_non_enumerable_p, ecma_make_string_value (name_p), 0);
ecma_deref_ecma_string (name_p);
ecma_append_to_values_collection (for_non_enumerable_p,
ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE),
0);
} /* ecma_op_external_function_list_lazy_property_names */
/**
@@ -1039,19 +1039,19 @@ ecma_op_bound_function_list_lazy_property_names (bool separate_enumerable, /**<
ecma_collection_header_t *for_non_enumerable_p = separate_enumerable ? non_enum_collection_p : main_collection_p;
/* 'length' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_string_t *name_p = ecma_new_ecma_length_string ();
ecma_append_to_values_collection (for_non_enumerable_p, ecma_make_string_value (name_p), 0);
ecma_deref_ecma_string (name_p);
ecma_append_to_values_collection (for_non_enumerable_p,
ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH),
0);
/* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */
name_p = ecma_get_magic_string (LIT_MAGIC_STRING_CALLER);
ecma_append_to_values_collection (for_non_enumerable_p, ecma_make_string_value (name_p), 0);
ecma_deref_ecma_string (name_p);
ecma_append_to_values_collection (for_non_enumerable_p,
ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER),
0);
/* 'arguments' property is non-enumerable (ECMA-262 v5, 13.2.5) */
name_p = ecma_get_magic_string (LIT_MAGIC_STRING_ARGUMENTS);
ecma_append_to_values_collection (for_non_enumerable_p, ecma_make_string_value (name_p), 0);
ecma_deref_ecma_string (name_p);
ecma_append_to_values_collection (for_non_enumerable_p,
ecma_make_magic_string_value (LIT_MAGIC_STRING_ARGUMENTS),
0);
} /* ecma_op_bound_function_list_lazy_property_names */
/**