Remove ecma_op_object_get_own_data_prop and use ecma_op_object_get_by_magic_id instead (#3969)

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
Szilagyi Adam 2020-07-13 12:12:46 +02:00 committed by GitHub
parent 870a3d3ffb
commit 9dbbcab49d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 39 deletions

View File

@ -757,39 +757,6 @@ ecma_op_object_find (ecma_object_t *object_p, /**< the object */
return ECMA_VALUE_NOT_FOUND;
} /* ecma_op_object_find */
/**
* Get own property by name
*
* Note: property must be an existing data property
*
* @return ecma value
* Returned value must be freed with ecma_free_value
*/
inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE
ecma_op_object_get_own_data_prop (ecma_object_t *object_p, /**< the object */
ecma_string_t *property_name_p) /**< property name */
{
JERRY_ASSERT (ecma_is_lexical_environment (object_p)
|| !ecma_op_object_is_fast_array (object_p));
ecma_value_t result = ecma_op_object_find_own (ecma_make_object_value (object_p),
object_p,
property_name_p);
#ifndef JERRY_NDEBUG
/* Because ecma_op_object_find_own might create a property
* this check is executed after the function return. */
ecma_property_t *property_p = ecma_find_named_property (object_p,
property_name_p);
JERRY_ASSERT (property_p != NULL
&& ECMA_PROPERTY_GET_TYPE (*property_p) == ECMA_PROPERTY_TYPE_NAMEDDATA
&& !ecma_is_property_configurable (*property_p));
#endif /* !JERRY_NDEBUG */
return result;
} /* ecma_op_object_get_own_data_prop */
/**
* [[Get]] operation of ecma object
*

View File

@ -35,7 +35,6 @@ ecma_value_t ecma_op_object_find_own (ecma_value_t base_value, ecma_object_t *ob
ecma_value_t ecma_op_object_find (ecma_object_t *object_p, ecma_string_t *property_name_p);
ecma_value_t ecma_op_object_find_by_uint32_index (ecma_object_t *object_p, uint32_t index);
ecma_value_t ecma_op_object_find_by_number_index (ecma_object_t *object_p, ecma_number_t index);
ecma_value_t ecma_op_object_get_own_data_prop (ecma_object_t *object_p, ecma_string_t *property_name_p);
ecma_value_t ecma_op_object_get (ecma_object_t *object_p, ecma_string_t *property_name_p);
ecma_value_t ecma_op_object_get_with_receiver (ecma_object_t *object_p, ecma_string_t *property_name_p,
ecma_value_t receiver);

View File

@ -1683,8 +1683,7 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
uint32_t index = 0;
if (bc_p->header.status_flags & (RE_FLAG_GLOBAL | RE_FLAG_STICKY))
{
ecma_string_t *lastindex_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL);
ecma_value_t lastindex_value = ecma_op_object_get_own_data_prop (regexp_object_p, lastindex_str_p);
ecma_value_t lastindex_value = ecma_op_object_get_by_magic_id (regexp_object_p, LIT_MAGIC_STRING_LASTINDEX_UL);
ecma_number_t lastindex_num;
ret_value = ecma_op_to_integer (lastindex_value, &lastindex_num);
@ -1710,7 +1709,7 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
if (index > input_length)
{
ret_value = ecma_op_object_put (regexp_object_p,
lastindex_str_p,
ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
ecma_make_integer_value (0),
true);
@ -2804,8 +2803,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
if (sticky && !global)
{
ecma_string_t *lastindex_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL);
ecma_value_t lastindex_value = ecma_op_object_get_own_data_prop (this_obj_p, lastindex_str_p);
ecma_value_t lastindex_value = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_LASTINDEX_UL);
result = ecma_op_to_length (lastindex_value, &replace_ctx.index);
ecma_free_value (lastindex_value);