回退 'Pull Request !5071 : 回退 'Pull Request !5059 : Check stackoverflow before entering asm interpreter''

This commit is contained in:
openharmony_ci 2023-10-28 04:19:06 +00:00 committed by Gitee
parent bde42db2ee
commit 16c80aee29
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -650,6 +650,17 @@ JSTaggedValue EcmaInterpreter::Execute(EcmaRuntimeCallInfo *info)
JSThread *thread = info->GetThread();
INTERPRETER_TRACE(thread, Execute);
if (thread->IsAsmInterpreter()) {
// check stack overflow before re-enter asm interpreter
if (UNLIKELY(thread->GetCurrentStackPosition() < thread->GetStackLimit())) {
LOG_ECMA(ERROR) << "Stack overflow! current:" << thread->GetCurrentStackPosition()
<< " limit:" << thread->GetStackLimit();
if (LIKELY(!thread->HasPendingException())) {
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
JSHandle<JSObject> error = factory->GetJSError(base::ErrorType::RANGE_ERROR, "Stack overflow!", false);
thread->SetException(error.GetTaggedValue());
}
return thread->GetException();
}
return InterpreterAssembly::Execute(info);
}
#ifndef EXCLUDE_C_INTERPRETER