mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-29 10:02:14 +00:00
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:
parent
387a30267c
commit
1df4dcd1a8
10 changed files with 86 additions and 11 deletions
|
|
@ -48,6 +48,18 @@ void* StringObject::operator new(size_t size)
|
|||
return GC_MALLOC_EXPLICITLY_TYPED(size, descr);
|
||||
}
|
||||
|
||||
ObjectHasPropertyResult StringObject::hasProperty(ExecutionState& state, const ObjectPropertyName& P) ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE
|
||||
{
|
||||
Value::ValueIndex idx = P.tryToUseAsIndex();
|
||||
if (idx != Value::InvalidIndexValue) {
|
||||
size_t strLen = m_primitiveValue->length();
|
||||
if (LIKELY(idx < strLen)) {
|
||||
return ObjectHasPropertyResult(ObjectGetResult(Value(String::fromCharCode(m_primitiveValue->charAt(idx))), false, true, false));
|
||||
}
|
||||
}
|
||||
return Object::hasProperty(state, P);
|
||||
}
|
||||
|
||||
|
||||
ObjectGetResult StringObject::getOwnProperty(ExecutionState& state, const ObjectPropertyName& P) ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue