mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Improve the performance of resolve reference. (#1453)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
parent
6d67b8dff9
commit
25f58894ef
@ -19,6 +19,7 @@
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-lcache.h"
|
||||
#include "ecma-lex-env.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-reference.h"
|
||||
@ -88,6 +89,30 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
|
||||
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
|
||||
ecma_property_t *property_p = ecma_lcache_lookup (binding_obj_p, name_p);
|
||||
|
||||
if (property_p != NULL)
|
||||
{
|
||||
ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
|
||||
|
||||
if (ECMA_PROPERTY_GET_TYPE (*property_p) == ECMA_PROPERTY_TYPE_NAMEDDATA)
|
||||
{
|
||||
return ecma_fast_copy_value (prop_value_p->value);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (*property_p) == ECMA_PROPERTY_TYPE_NAMEDACCESSOR);
|
||||
|
||||
ecma_object_t *getter_p = ecma_get_named_accessor_property_getter (prop_value_p);
|
||||
|
||||
if (getter_p == NULL)
|
||||
{
|
||||
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
|
||||
ecma_value_t base_value = ecma_make_object_value (binding_obj_p);
|
||||
return ecma_op_function_call (getter_p, base_value, NULL, 0);
|
||||
}
|
||||
|
||||
ecma_value_t prop_value = ecma_op_object_find (binding_obj_p, name_p);
|
||||
|
||||
if (ecma_is_value_found (prop_value))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user