Improve accessing TypedArray Performance

Add Object::getIndexedPropertyValue method for achive that
the function removes redundant creation of ObjectGetResult.
And Improve TypedArray object reading performance through better implementation

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2022-04-14 16:49:00 +09:00 committed by Boram Bae
commit 71a6afeaae
9 changed files with 90 additions and 27 deletions

View file

@ -114,6 +114,18 @@ ObjectGetResult StringObject::getIndexedProperty(ExecutionState& state, const Va
return get(state, ObjectPropertyName(state, property), receiver);
}
Value StringObject::getIndexedPropertyValue(ExecutionState& state, const Value& property, const Value& receiver)
{
size_t idx = property.tryToUseAsIndexProperty(state);
if (idx != Value::InvalidIndexPropertyValue) {
size_t strLen = m_primitiveValue->length();
if (LIKELY(idx < strLen)) {
return state.context()->staticStrings().charCodeToString(m_primitiveValue->charAt(idx));
}
}
return get(state, ObjectPropertyName(state, property), receiver).value(state, receiver);
}
ObjectHasPropertyResult StringObject::hasIndexedProperty(ExecutionState& state, const Value& propertyName)
{
size_t idx = propertyName.tryToUseAsIndexProperty(state);