mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Adding lcache lookup and insert to ecma_find_named_property; removing lcache insert from ecma_op_object_get_own_property.
This commit is contained in:
parent
3b29280b79
commit
ef012d9cd4
@ -568,12 +568,19 @@ ecma_create_named_accessor_property (ecma_object_t *obj_p, /**< object */
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in */
|
||||
const ecma_string_t *name_p) /**< property's name */
|
||||
ecma_string_t *name_p) /**< property's name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL);
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
|
||||
for (ecma_property_t *property_p = ecma_get_property_list (obj_p);
|
||||
ecma_property_t *property_p;
|
||||
|
||||
if (ecma_lcache_lookup (obj_p, name_p, &property_p))
|
||||
{
|
||||
return property_p;
|
||||
}
|
||||
|
||||
for (property_p = ecma_get_property_list (obj_p);
|
||||
property_p != NULL;
|
||||
property_p = ECMA_GET_POINTER(property_p->next_property_p))
|
||||
{
|
||||
@ -596,11 +603,13 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
|
||||
|
||||
if (ecma_compare_ecma_strings (name_p, property_name_p))
|
||||
{
|
||||
return property_p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
ecma_lcache_insert (obj_p, name_p, property_p);
|
||||
|
||||
return property_p;
|
||||
} /* ecma_find_named_property */
|
||||
|
||||
/**
|
||||
@ -614,7 +623,7 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_get_named_property (ecma_object_t *obj_p, /**< object to find property in */
|
||||
const ecma_string_t *name_p) /**< property's name */
|
||||
ecma_string_t *name_p) /**< property's name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL);
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
@ -637,7 +646,7 @@ ecma_get_named_property (ecma_object_t *obj_p, /**< object to find property in *
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_get_named_data_property (ecma_object_t *obj_p, /**< object to find property in */
|
||||
const ecma_string_t *name_p) /**< property's name */
|
||||
ecma_string_t *name_p) /**< property's name */
|
||||
{
|
||||
JERRY_ASSERT (obj_p != NULL);
|
||||
JERRY_ASSERT (name_p != NULL);
|
||||
|
||||
@ -264,11 +264,11 @@ extern ecma_property_t *ecma_create_named_accessor_property (ecma_object_t *obj_
|
||||
ecma_property_enumerable_value_t enumerable,
|
||||
ecma_property_configurable_value_t configurable);
|
||||
extern ecma_property_t *ecma_find_named_property (ecma_object_t *obj_p,
|
||||
const ecma_string_t *name_p);
|
||||
ecma_string_t *name_p);
|
||||
extern ecma_property_t *ecma_get_named_property (ecma_object_t *obj_p,
|
||||
const ecma_string_t *name_p);
|
||||
ecma_string_t *name_p);
|
||||
extern ecma_property_t *ecma_get_named_data_property (ecma_object_t *obj_p,
|
||||
const ecma_string_t *name_p);
|
||||
ecma_string_t *name_p);
|
||||
|
||||
extern void ecma_free_property (ecma_object_t *obj_p, ecma_property_t *prop_p);
|
||||
|
||||
|
||||
@ -201,7 +201,7 @@ ecma_lcache_insert (ecma_object_t *object_p, /**< object */
|
||||
* @return true - if (object, property name) pair is registered in LCache,
|
||||
* false - probably, not registered.
|
||||
*/
|
||||
bool
|
||||
inline bool __attribute_always_inline__
|
||||
ecma_lcache_lookup (ecma_object_t *object_p, /**< object */
|
||||
const ecma_string_t *prop_name_p, /**< property's name */
|
||||
ecma_property_t **prop_p_p) /**< out: if return value is true,
|
||||
|
||||
@ -118,12 +118,6 @@ ecma_op_object_get_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Property name should be the same as the value passed to ecma_lcache_lookup above,
|
||||
* or at least hash for the two strings should be either non-computable or the same (see also: ecma_string_try_hash).
|
||||
*/
|
||||
ecma_lcache_insert (obj_p, property_name_p, prop_p);
|
||||
|
||||
return prop_p;
|
||||
} /* ecma_op_object_get_own_property */
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user