mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
1. fix ArrayIndex uint32 into uint64
2. fix Invalid ArrayIndexValue into 2^32 + 1 3. fix Array.prototype.push bug 4. implement part of Array.prototype.splice Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
fac1a2f9e7
commit
9340d87ded
9 changed files with 132 additions and 66 deletions
|
|
@ -33,7 +33,7 @@ bool ArrayObject::defineOwnProperty(ExecutionState& state, const ObjectPropertyN
|
|||
return true;
|
||||
}
|
||||
|
||||
uint32_t idx = P.toValue(state).toArrayIndex(state);
|
||||
uint64_t idx = P.toValue(state).toArrayIndex(state);
|
||||
if (idx != Value::InvalidArrayIndexValue) {
|
||||
setArrayLength(state, idx + 1);
|
||||
}
|
||||
|
|
@ -44,14 +44,14 @@ bool ArrayObject::defineOwnProperty(ExecutionState& state, const ObjectPropertyN
|
|||
bool ArrayObject::deleteOwnProperty(ExecutionState& state, const ObjectPropertyName& P) ESCARGOT_OBJECT_SUBCLASS_MUST_REDEFINE
|
||||
{
|
||||
if (LIKELY(isFastModeArray())) {
|
||||
uint32_t idx;
|
||||
uint64_t idx;
|
||||
if (LIKELY(P.isUIntType())) {
|
||||
idx = P.uintValue();
|
||||
} else {
|
||||
idx = P.string(state)->tryToUseAsArrayIndex();
|
||||
}
|
||||
if (LIKELY(idx != Value::InvalidArrayIndexValue)) {
|
||||
uint32_t len = m_fastModeData.size();
|
||||
uint64_t len = m_fastModeData.size();
|
||||
ASSERT(len == getArrayLength(state));
|
||||
if (idx < len) {
|
||||
m_fastModeData[idx] = Value(Value::EmptyValue);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue