Improve define own property. (#1369)

This patch changes define own property to search a property only once.
Currently all existing properties are searched at least twice, sometimes
three times which is not optimal.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2016-09-23 10:06:36 +02:00
committed by GitHub
parent 547647af13
commit 0ad347b97f
3 changed files with 82 additions and 54 deletions
@@ -76,6 +76,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
JERRY_ASSERT (object_p != NULL
&& !ecma_is_lexical_environment (object_p));
JERRY_ASSERT (property_name_p != NULL);
JERRY_ASSERT (options == ECMA_PROPERTY_GET_NO_OPTIONS || property_ref_p != NULL);
ecma_object_type_t type = ecma_get_object_type (object_p);
@@ -178,6 +179,11 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
}
}
if (options & ECMA_PROPERTY_GET_EXT_REFERENCE)
{
((ecma_extended_property_ref_t *) property_ref_p)->property_p = property_p;
}
if (property_ref_p != NULL)
{
property_ref_p->value_p = ECMA_PROPERTY_VALUE_PTR (property_p);