1. When 'writable' property of array length turned into 'false', convert it into NonFastMode

2. If RegExp's source needs escapeSlash process, it should count the number of leading backSlashs

Signed-off-by: Saebom Kim sae-bom.kim@samsung.com
This commit is contained in:
Saebom Kim 2017-04-04 17:47:20 +09:00
commit 6d4ed41488
5 changed files with 107 additions and 410 deletions

View file

@ -246,8 +246,13 @@ bool ArrayObject::setArrayLength(ExecutionState& state, const uint64_t& newLengt
if (LIKELY(isFastModeArray())) {
auto oldSize = getArrayLength(state);
auto oldLenDesc = structure()->readProperty(state, (size_t)0);
m_values[ESCARGOT_OBJECT_BUILTIN_PROPERTY_NUMBER] = Value(newLength);
m_fastModeData.resize(oldSize, newLength, Value(Value::EmptyValue));
if (UNLIKELY(!oldLenDesc.m_descriptor.isWritable())) {
convertIntoNonFastMode(state);
}
return true;
} else {
if (!isInArrayObjectDefineOwnProperty()) {
@ -278,10 +283,6 @@ bool ArrayObject::setArrayLength(ExecutionState& state, const uint64_t& newLengt
return false;
}
}
if (!oldLenDesc.m_descriptor.isWritable()) {
return false;
}
}
m_values[ESCARGOT_OBJECT_BUILTIN_PROPERTY_NUMBER] = Value(newLength);
return true;