[return-check] change exception handling to return-check based method in interpreting (runtime) process

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
HyukWoo Park 2023-07-30 00:28:57 +09:00
commit 26af0cddc6
94 changed files with 3129 additions and 1627 deletions

View file

@ -132,6 +132,9 @@ public:
{
// Let result be OrdinaryCallEvaluateBody(F, argumentsList).
const Value& result = interpreterReturnValue;
if (UNLIKELY(result.isException())) {
return result;
}
// If result.[[type]] is return, then
// If Type(result.[[value]]) is Object, return NormalCompletion(result.[[value]]).
if (result.isObject()) {
@ -163,6 +166,7 @@ Value ScriptFunctionObject::construct(ExecutionState& state, const size_t argc,
Object* proto = Object::getPrototypeFromConstructor(state, newTarget, [](ExecutionState& state, Context* constructorRealm) -> Object* {
return constructorRealm->globalObject()->objectPrototype();
});
RETURN_VALUE_IF_PENDING_EXCEPTION
// Set the [[Prototype]] internal slot of obj to proto.
Object* thisArgument = new Object(state, proto);
@ -184,9 +188,11 @@ void ScriptFunctionObject::generateArgumentsObject(ExecutionState& state, size_t
auto result = environmentRecordWillArgumentsObjectBeLocatedIn->hasBinding(state, arguments);
if (UNLIKELY(result.m_index == SIZE_MAX)) {
environmentRecordWillArgumentsObjectBeLocatedIn->createBinding(state, arguments, false, true);
ASSERT(!state.hasPendingException());
result = environmentRecordWillArgumentsObjectBeLocatedIn->hasBinding(state, arguments);
}
environmentRecordWillArgumentsObjectBeLocatedIn->initializeBinding(state, arguments, newArgumentsObject);
ASSERT(!state.hasPendingException());
} else {
const InterpretedCodeBlock::IdentifierInfoVector& v = interpretedCodeBlock()->identifierInfos();
for (size_t i = 0; i < v.size(); i++) {
@ -195,6 +201,7 @@ void ScriptFunctionObject::generateArgumentsObject(ExecutionState& state, size_t
stackStorage[v[i].m_indexForIndexedStorage] = newArgumentsObject;
} else {
environmentRecordWillArgumentsObjectBeLocatedIn->setHeapValueByIndex(state, v[i].m_indexForIndexedStorage, newArgumentsObject);
ASSERT(!state.hasPendingException());
}
break;
}