Remove redundant parameter modules (#390)

* CodeBlock has essential parameter name list only
* toString builtin function is fixed to use the entire source instead of body source
* some TCs are fixed upto the spec

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
Hyukwoo Park 2019-08-27 10:40:30 +09:00 committed by Boram Bae
commit cc3f7deb8c
12 changed files with 32 additions and 162 deletions

View file

@ -213,29 +213,4 @@ void ScriptFunctionObject::generateArgumentsObject(ExecutionState& state, size_t
}
}
}
void ScriptFunctionObject::generateRestParameter(ExecutionState& state, FunctionEnvironmentRecord* record, Value* parameterStorageInStack, const size_t argc, Value* argv)
{
ArrayObject* newArray;
size_t parameterLen = (size_t)m_codeBlock->parameterCount();
if (argc > parameterLen) {
size_t arrLen = argc - parameterLen;
newArray = new ArrayObject(state, (double)arrLen);
for (size_t i = 0; i < arrLen; i++) {
newArray->setIndexedProperty(state, Value(i), argv[parameterLen + i]);
}
} else {
newArray = new ArrayObject(state);
}
InterpretedCodeBlock::FunctionParametersInfo lastInfo = const_cast<InterpretedCodeBlock::FunctionParametersInfoVector&>(m_codeBlock->asInterpretedCodeBlock()->parametersInfomation()).back();
if (!m_codeBlock->canUseIndexedVariableStorage()) {
record->initializeBinding(state, lastInfo.m_name, Value(newArray));
} else if (lastInfo.m_isHeapAllocated) {
record->heapStorage()[lastInfo.m_index] = newArray;
} else {
parameterStorageInStack[lastInfo.m_index] = newArray;
}
}
}