mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
[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:
parent
da24cd6a2f
commit
26af0cddc6
94 changed files with 3129 additions and 1627 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue