mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-29 10:02:14 +00:00
Refactoring index property handling
* when trying to use index property, we use only 32bit for index value (uint32_t) * rename ArrayIndex as to Index32 and IndexProperty * add cctest to verify the new api Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
parent
12855be3f6
commit
0b0ddee8e1
16 changed files with 180 additions and 237 deletions
|
|
@ -52,8 +52,8 @@ void* StringObject::operator new(size_t size)
|
|||
|
||||
ObjectHasPropertyResult StringObject::hasProperty(ExecutionState& state, const ObjectPropertyName& P)
|
||||
{
|
||||
Value::ValueIndex idx = P.tryToUseAsIndex();
|
||||
if (idx != Value::InvalidIndexValue) {
|
||||
size_t idx = P.tryToUseAsIndexProperty();
|
||||
if (idx != Value::InvalidIndexPropertyValue) {
|
||||
size_t strLen = m_primitiveValue->length();
|
||||
if (LIKELY(idx < strLen)) {
|
||||
return ObjectHasPropertyResult(ObjectGetResult(Value(String::fromCharCode(m_primitiveValue->charAt(idx))), false, true, false));
|
||||
|
|
@ -65,8 +65,8 @@ ObjectHasPropertyResult StringObject::hasProperty(ExecutionState& state, const O
|
|||
|
||||
ObjectGetResult StringObject::getOwnProperty(ExecutionState& state, const ObjectPropertyName& P)
|
||||
{
|
||||
Value::ValueIndex idx = P.tryToUseAsIndex();
|
||||
if (idx != Value::InvalidIndexValue) {
|
||||
size_t idx = P.tryToUseAsIndexProperty();
|
||||
if (idx != Value::InvalidIndexPropertyValue) {
|
||||
size_t strLen = m_primitiveValue->length();
|
||||
if (LIKELY(idx < strLen)) {
|
||||
return ObjectGetResult(Value(String::fromCharCode(m_primitiveValue->charAt(idx))), false, true, false);
|
||||
|
|
@ -104,8 +104,8 @@ void StringObject::enumeration(ExecutionState& state, bool (*callback)(Execution
|
|||
|
||||
ObjectGetResult StringObject::getIndexedProperty(ExecutionState& state, const Value& property, const Value& receiver)
|
||||
{
|
||||
Value::ValueIndex idx = property.tryToUseAsIndex(state);
|
||||
if (idx != Value::InvalidIndexValue) {
|
||||
size_t idx = property.tryToUseAsIndexProperty(state);
|
||||
if (idx != Value::InvalidIndexPropertyValue) {
|
||||
size_t strLen = m_primitiveValue->length();
|
||||
if (LIKELY(idx < strLen)) {
|
||||
return ObjectGetResult(Value(String::fromCharCode(m_primitiveValue->charAt(idx))), false, true, false);
|
||||
|
|
@ -116,8 +116,8 @@ ObjectGetResult StringObject::getIndexedProperty(ExecutionState& state, const Va
|
|||
|
||||
ObjectHasPropertyResult StringObject::hasIndexedProperty(ExecutionState& state, const Value& propertyName)
|
||||
{
|
||||
Value::ValueIndex idx = propertyName.tryToUseAsIndex(state);
|
||||
if (idx != Value::InvalidIndexValue) {
|
||||
size_t idx = propertyName.tryToUseAsIndexProperty(state);
|
||||
if (idx != Value::InvalidIndexPropertyValue) {
|
||||
size_t strLen = m_primitiveValue->length();
|
||||
if (LIKELY(idx < strLen)) {
|
||||
return ObjectHasPropertyResult(ObjectGetResult(Value(String::fromCharCode(m_primitiveValue->charAt(idx))), false, true, false));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue