RETURN_VALUE_IF_ABRUPT_COMPLETION should return JSTaggedValue::Exception()

issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I9E9CZ

Signed-off-by: hecunmao <hecunmao@huawei.com>
Change-Id: Id52cece085e12c626011b525a2a3f75b1a5e7408
This commit is contained in:
hecunmao 2024-04-06 17:20:40 +08:00
parent aefb1ad7bc
commit ef3fdb8b59
5 changed files with 23 additions and 7 deletions

View File

@ -660,7 +660,7 @@ JSTaggedValue EcmaInterpreter::Execute(EcmaRuntimeCallInfo *info)
ASSERT(thread->IsInManagedState());
INTERPRETER_TRACE(thread, Execute);
// check stack overflow before re-enter interpreter
STACK_LIMIT_CHECK(thread, thread->GetException());
STACK_LIMIT_CHECK(thread, JSTaggedValue::Exception());
if (thread->IsAsmInterpreter()) {
return InterpreterAssembly::Execute(info);
}

View File

@ -519,7 +519,7 @@ bool JSProxy::HasProperty(JSThread *thread, const JSHandle<JSProxy> &proxy, cons
OperationResult JSProxy::GetProperty(JSThread *thread, const JSHandle<JSProxy> &proxy,
const JSHandle<JSTaggedValue> &key, const JSHandle<JSTaggedValue> &receiver)
{
STACK_LIMIT_CHECK(thread, OperationResult(thread, thread->GetException(), PropertyMetaData(false)));
STACK_LIMIT_CHECK(thread, OperationResult(thread, JSTaggedValue::Exception(), PropertyMetaData(false)));
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
// step 1 ~ 10 are almost same as GetOwnProperty
ASSERT(JSTaggedValue::IsPropertyKey(key));

View File

@ -2449,10 +2449,10 @@ JSValueRef* FunctionRef::CallForNapi(const EcmaVM *vm, JSValueRef *thisObj,
info->SetCallArg(i, arg);
}
if (thread->IsAsmInterpreter()) {
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread,
reinterpret_cast<JSValueRef *>(JSHandle<JSTaggedValue>(thread, thread->GetException()).GetAddress()));
STACK_LIMIT_CHECK(thread,
reinterpret_cast<JSValueRef *>(JSHandle<JSTaggedValue>(thread, thread->GetException()).GetAddress()));
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, reinterpret_cast<JSValueRef *>(
JSHandle<JSTaggedValue>(thread, JSTaggedValue::Exception()).GetAddress()));
STACK_LIMIT_CHECK(thread, reinterpret_cast<JSValueRef *>(
JSHandle<JSTaggedValue>(thread, JSTaggedValue::Exception()).GetAddress()));
auto *hclass = func.GetTaggedObject()->GetClass();
if (hclass->IsClassConstructor()) {
RETURN_STACK_BEFORE_THROW_IF_ASM(thread);

View File

@ -12,3 +12,4 @@
# limitations under the License.
RangeError: Invalid string length
Exception Test End

View File

@ -27,4 +27,19 @@ try {
}
} catch(e) {
print(e);
}
}
function runNearStackLimit(f) { function t() { try { t(); } catch (e) { f(); } }; try { t(); } catch (e) { } }
let obj = { "name": "tom" };
let px = new Proxy(obj, {});
function f() {
for (let i = 0; i < 100; i++) { };
px.name;
const o9 = {
[px]() {
},
};
runNearStackLimit(f);
}
f();
print("Exception Test End")