Add fast paths for hasProperty internal method (#407)

Also the Object.[[Get]] method is modified to follow the standard requirements without recursion.

Signed-off-by: Robert Fancsik <frobert@inf.u-szeged.hu>
This commit is contained in:
Robert Fancsik 2019-09-03 10:14:03 +02:00 committed by Boram Bae
commit 1df4dcd1a8
10 changed files with 86 additions and 11 deletions

View file

@ -55,6 +55,17 @@ ArrayObject::ArrayObject(ExecutionState& state, double length)
(ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::NonEnumerablePresent | ObjectPropertyDescriptor::NonConfigurablePresent)));
}
ObjectHasPropertyResult ArrayObject::hasProperty(ExecutionState& state, const ObjectPropertyName& P) ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE
{
ObjectGetResult v = getFastModeValue(state, P);
if (LIKELY(v.hasValue())) {
return ObjectHasPropertyResult(v);
}
return Object::hasProperty(state, P);
}
ObjectGetResult ArrayObject::getOwnProperty(ExecutionState& state, const ObjectPropertyName& P) ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE
{
ObjectGetResult v = getFastModeValue(state, P);