mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-27 04:00:37 +00:00
An exception was generated when throwing an exception. Procedure
issue:https://gitee.com/open_harmony/dashboard?issue_id=I9RPS3 Signed-off-by: hecunmao <hecunmao@huawei.com> Change-Id: I34067353d54e2a670bf96fa0f4897b100505dbbf
This commit is contained in:
parent
184c7a3df4
commit
61b5c2f5fb
@ -1125,7 +1125,7 @@ void Builtins::InitializeAllTypeError(const JSHandle<GlobalEnv> &env, const JSHa
|
||||
InitializeError(env, errorNativeFuncInstanceHClass, JSType::JS_TERMINATION_ERROR);
|
||||
|
||||
JSHandle<EcmaString> handleMsg = factory_->NewFromUtf8ReadOnly("Default oom error");
|
||||
JSHandle<JSObject> oomError = factory_->NewJSError(ErrorType::OOM_ERROR, handleMsg, true);
|
||||
JSHandle<JSObject> oomError = factory_->NewJSError(ErrorType::OOM_ERROR, handleMsg, StackCheck::YES);
|
||||
env->SetOOMErrorObject(thread_, oomError);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ JSTaggedValue BuiltinsAsyncFromSyncIterator::Throw(EcmaRuntimeCallInfo *argv)
|
||||
if (!result->IsECMAObject()) {
|
||||
// a.Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
|
||||
JSHandle<JSObject> resolutionError =
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "AsyncFromSyncIteratorPrototype.throw: is not Object.");
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "AsyncFromSyncIteratorPrototype.throw: is not Object.", StackCheck::NO);
|
||||
JSHandle<JSTaggedValue> reject(thread, pcap->GetReject());
|
||||
EcmaRuntimeCallInfo *info =
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread, reject, undefinedValue, undefinedValue, 1);
|
||||
@ -197,7 +197,7 @@ JSTaggedValue BuiltinsAsyncFromSyncIterator::Return(EcmaRuntimeCallInfo *argv)
|
||||
if (!result->IsECMAObject()) {
|
||||
// a.Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
|
||||
JSHandle<JSObject> resolutionError =
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "AsyncFromSyncIteratorPrototype.return: is not Object.");
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "AsyncFromSyncIteratorPrototype.return: is not Object.", StackCheck::NO);
|
||||
JSHandle<JSTaggedValue> rstErr = JSHandle<JSTaggedValue>::Cast(resolutionError);
|
||||
JSHandle<JSTaggedValue> reject(thread, pcap->GetReject());
|
||||
EcmaRuntimeCallInfo *info =
|
||||
|
@ -71,7 +71,7 @@ JSTaggedValue BuiltinsJson::ParseWithTransformType(EcmaRuntimeCallInfo *argv, Tr
|
||||
|
||||
uint32_t argc = argv->GetArgsNumber();
|
||||
if (argc == 0) {
|
||||
JSHandle<JSObject> syntaxError = factory->GetJSError(base::ErrorType::SYNTAX_ERROR, "arg is empty");
|
||||
JSHandle<JSObject> syntaxError = factory->GetJSError(base::ErrorType::SYNTAX_ERROR, "arg is empty", StackCheck::NO);
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, syntaxError.GetTaggedValue(), JSTaggedValue::Exception());
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ JSTaggedValue BuiltinsMap::AddEntriesFromIterable(JSThread *thread, const JSHand
|
||||
|
||||
// If Type(nextItem) is not Object
|
||||
if (!nextValue->IsECMAObject()) {
|
||||
JSHandle<JSObject> typeError = factory->GetJSError(ErrorType::TYPE_ERROR, "nextItem is not Object");
|
||||
JSHandle<JSObject> typeError = factory->GetJSError(ErrorType::TYPE_ERROR, "nextItem is not Object", StackCheck::NO);
|
||||
JSHandle<JSTaggedValue> record(
|
||||
factory->NewCompletionRecord(CompletionRecordType::THROW, JSHandle<JSTaggedValue>(typeError)));
|
||||
JSTaggedValue ret = JSIterator::IteratorClose(thread, iter, record).GetTaggedValue();
|
||||
|
@ -57,8 +57,8 @@ JSTaggedValue BuiltinsPromiseHandler::Resolve(EcmaRuntimeCallInfo *argv)
|
||||
// b. Return RejectPromise(promise, selfResolutionError).
|
||||
JSHandle<JSTaggedValue> resolution = BuiltinsBase::GetCallArg(argv, 0);
|
||||
if (JSTaggedValue::SameValue(resolution.GetTaggedValue(), resolvePromise.GetTaggedValue())) {
|
||||
JSHandle<JSObject> resolutionError =
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "Resolve: The promise and resolution cannot be the same.");
|
||||
JSHandle<JSObject> resolutionError = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
"Resolve: The promise and resolution cannot be the same.", StackCheck::NO);
|
||||
JSPromise::RejectPromise(thread, resolvePromise, JSHandle<JSTaggedValue>::Cast(resolutionError));
|
||||
return JSTaggedValue::Undefined();
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ JSTaggedValue BuiltinsPromiseJob::DynamicImportJob(EcmaRuntimeCallInfo *argv)
|
||||
if (!hasRecord) {
|
||||
CString normalizeStr = ModulePathHelper::ReformatPath(entryPoint);
|
||||
CString msg = "Cannot find dynamic-import module '" + normalizeStr;
|
||||
JSTaggedValue error = factory->GetJSError(ErrorType::REFERENCE_ERROR, msg.c_str()).GetTaggedValue();
|
||||
JSTaggedValue error = factory->GetJSError(ErrorType::REFERENCE_ERROR, msg.c_str(), StackCheck::NO).GetTaggedValue();
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, CatchException(thread, reject));
|
||||
}
|
||||
if (jsPandaFile->IsJson(recordInfo)) {
|
||||
@ -222,7 +222,7 @@ JSTaggedValue BuiltinsPromiseJob::DynamicImportJob(EcmaRuntimeCallInfo *argv)
|
||||
if (!moduleManager->IsModuleLoaded(moduleName.GetTaggedValue())) {
|
||||
if (!JSPandaFileExecutor::ExecuteFromAbcFile(thread, fileNameStr.c_str(), entryPoint.c_str(), false, true)) {
|
||||
CString msg = "Cannot execute request dynamic-imported module : " + entryPoint;
|
||||
JSTaggedValue error = factory->GetJSError(ErrorType::REFERENCE_ERROR, msg.c_str()).GetTaggedValue();
|
||||
JSTaggedValue error = factory->GetJSError(ErrorType::REFERENCE_ERROR, msg.c_str(), StackCheck::NO).GetTaggedValue();
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, CatchException(thread, reject));
|
||||
}
|
||||
} else {
|
||||
|
@ -2250,14 +2250,14 @@ uint32_t BuiltinsRegExp::UpdateExpressionFlags(JSThread *thread, const CString &
|
||||
default: {
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> syntaxError =
|
||||
factory->GetJSError(base::ErrorType::SYNTAX_ERROR, "invalid regular expression flags");
|
||||
factory->GetJSError(base::ErrorType::SYNTAX_ERROR, "invalid regular expression flags", StackCheck::NO);
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, syntaxError.GetTaggedValue(), 0);
|
||||
}
|
||||
}
|
||||
if ((flagsBits & flagsBitsTemp) != 0) {
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> syntaxError =
|
||||
factory->GetJSError(base::ErrorType::SYNTAX_ERROR, "invalid regular expression flags");
|
||||
factory->GetJSError(base::ErrorType::SYNTAX_ERROR, "invalid regular expression flags", StackCheck::NO);
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, syntaxError.GetTaggedValue(), 0);
|
||||
}
|
||||
flagsBits |= flagsBitsTemp;
|
||||
@ -2356,7 +2356,7 @@ JSTaggedValue BuiltinsRegExp::RegExpInitialize(JSThread *thread, const JSHandle<
|
||||
parser.Parse();
|
||||
if (parser.IsError()) {
|
||||
JSHandle<JSObject> syntaxError =
|
||||
factory->GetJSError(base::ErrorType::SYNTAX_ERROR, parser.GetErrorMsg().c_str());
|
||||
factory->GetJSError(base::ErrorType::SYNTAX_ERROR, parser.GetErrorMsg().c_str(), StackCheck::NO);
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, syntaxError.GetTaggedValue(), JSTaggedValue::Exception());
|
||||
}
|
||||
groupName = parser.GetGroupNames();
|
||||
|
@ -287,7 +287,7 @@ JSTaggedValue BuiltinsSharedMap::AddEntriesFromIterable(JSThread *thread, const
|
||||
|
||||
// If Type(nextItem) is not Object
|
||||
if (!nextValue->IsECMAObject()) {
|
||||
JSHandle<JSObject> typeError = factory->GetJSError(ErrorType::TYPE_ERROR, "nextItem is not Object");
|
||||
JSHandle<JSObject> typeError = factory->GetJSError(ErrorType::TYPE_ERROR, "nextItem is not Object", StackCheck::NO);
|
||||
JSHandle<JSTaggedValue> record(
|
||||
factory->NewCompletionRecord(CompletionRecordType::THROW, JSHandle<JSTaggedValue>(typeError)));
|
||||
JSTaggedValue ret = JSIterator::IteratorClose(thread, iter, record).GetTaggedValue();
|
||||
|
@ -19,7 +19,7 @@ namespace panda::ecmascript::containers {
|
||||
JSTaggedValue ContainerError::BusinessError(JSThread *thread, int32_t errorCode, const char *msg)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::ERROR, msg);
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::ERROR, msg, StackCheck::NO);
|
||||
JSHandle<JSTaggedValue> code(thread, JSTaggedValue(errorCode));
|
||||
JSHandle<EcmaString> key = factory->NewFromUtf8("code");
|
||||
JSHandle<EcmaString> name = factory->NewFromUtf8("name");
|
||||
|
@ -343,7 +343,7 @@
|
||||
return; \
|
||||
} \
|
||||
ObjectFactory *_factory = (thread)->GetEcmaVM()->GetFactory(); \
|
||||
JSHandle<JSObject> _error = _factory->GetJSError(type, message, false); \
|
||||
JSHandle<JSObject> _error = _factory->GetJSError(type, message, ecmascript::StackCheck::NO); \
|
||||
(thread)->SetException(_error.GetTaggedValue()); \
|
||||
return; \
|
||||
} while (false)
|
||||
@ -353,7 +353,7 @@
|
||||
do { \
|
||||
EcmaVM *_ecmaVm = (thread)->GetEcmaVM(); \
|
||||
ObjectFactory *_factory = _ecmaVm->GetFactory(); \
|
||||
JSHandle<JSObject> _error = _factory->GetJSError(type, message); \
|
||||
JSHandle<JSObject> _error = _factory->GetJSError(type, message, ecmascript::StackCheck::NO); \
|
||||
(thread)->SetException(_error.GetTaggedValue()); \
|
||||
_ecmaVm->HandleUncatchableError(); \
|
||||
} while (false)
|
||||
@ -374,7 +374,7 @@
|
||||
return JSHandle<type>(thread, JSTaggedValue::Exception()); \
|
||||
} \
|
||||
ObjectFactory *_factory = (thread)->GetEcmaVM()->GetFactory(); \
|
||||
JSHandle<JSObject> _error = _factory->GetJSError(errorType, message, false); \
|
||||
JSHandle<JSObject> _error = _factory->GetJSError(errorType, message, ecmascript::StackCheck::NO); \
|
||||
(thread)->SetException(_error.GetTaggedValue()); \
|
||||
return JSHandle<type>(thread, JSTaggedValue::Exception()); \
|
||||
} while (false)
|
||||
@ -386,7 +386,7 @@
|
||||
return (value); \
|
||||
} \
|
||||
ObjectFactory *_factory = (thread)->GetEcmaVM()->GetFactory(); \
|
||||
JSHandle<JSObject> _error = _factory->GetJSError(errorType, message, false); \
|
||||
JSHandle<JSObject> _error = _factory->GetJSError(errorType, message, ecmascript::StackCheck::NO); \
|
||||
(thread)->SetException(_error.GetTaggedValue()); \
|
||||
return (value); \
|
||||
} while (false)
|
||||
@ -400,7 +400,8 @@
|
||||
ObjectFactory *_factory = (thread)->GetEcmaVM()->GetFactory(); \
|
||||
CString normalizeStr = ModulePathHelper::ReformatPath(currentRecord); \
|
||||
CString msg = "Cannot find module '" + requestStr + "' imported from '" + normalizeStr + "'."; \
|
||||
JSHandle<JSObject> _error = _factory->GetJSError(ErrorType::REFERENCE_ERROR, msg.c_str(), false); \
|
||||
JSHandle<JSObject> _error = _factory->GetJSError(ErrorType::REFERENCE_ERROR, \
|
||||
msg.c_str(), ecmascript::StackCheck::NO); \
|
||||
(thread)->SetException(_error.GetTaggedValue()); \
|
||||
return (value); \
|
||||
} while (false)
|
||||
|
@ -942,7 +942,7 @@ void EcmaVM::TriggerConcurrentCallback(JSTaggedValue result, JSTaggedValue hint)
|
||||
auto status = promise->GetPromiseState();
|
||||
if (status == PromiseState::PENDING) {
|
||||
result = JSHandle<JSTaggedValue>::Cast(factory_->GetJSError(
|
||||
ErrorType::ERROR, "Can't return Promise in pending state")).GetTaggedValue();
|
||||
ErrorType::ERROR, "Can't return Promise in pending state", StackCheck::NO)).GetTaggedValue();
|
||||
} else {
|
||||
result = promise->GetPromiseResult();
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ using CommonStubCSigns = kungfu::CommonStubCSigns;
|
||||
{ \
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread); \
|
||||
JSHandle<JSObject> error = factory->GetJSError( \
|
||||
ErrorType::TYPE_ERROR, "is not callable"); \
|
||||
ErrorType::TYPE_ERROR, "is not callable", StackCheck::NO); \
|
||||
thread->SetException(error.GetTaggedValue()); \
|
||||
} \
|
||||
INTERPRETER_GOTO_EXCEPTION_HANDLER(); \
|
||||
@ -283,7 +283,7 @@ using CommonStubCSigns = kungfu::CommonStubCSigns;
|
||||
{ \
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread); \
|
||||
JSHandle<JSObject> error = factory->GetJSError( \
|
||||
ErrorType::TYPE_ERROR, "is not callable"); \
|
||||
ErrorType::TYPE_ERROR, "is not callable", StackCheck::NO); \
|
||||
thread->SetException(error.GetTaggedValue()); \
|
||||
} \
|
||||
INTERPRETER_GOTO_EXCEPTION_HANDLER(); \
|
||||
@ -855,7 +855,7 @@ JSTaggedValue EcmaInterpreter::GeneratorReEnterAot(JSThread *thread, JSHandle<Ge
|
||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<JSObject> error =
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "class constructor cannot called without 'new'");
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "class constructor cannot called without 'new'", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
}
|
||||
return thread->GetException();
|
||||
@ -1434,7 +1434,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
{
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSObject> error =
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "class constructor cannot called without 'new'");
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "class constructor cannot called without 'new'", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
}
|
||||
INTERPRETER_GOTO_EXCEPTION_HANDLER();
|
||||
@ -1556,7 +1556,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
{
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
"Derived constructor must return object or undefined");
|
||||
"Derived constructor must return object or undefined", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
}
|
||||
INTERPRETER_GOTO_EXCEPTION_HANDLER();
|
||||
@ -1601,7 +1601,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, const uint8_t
|
||||
{
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread);
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
"Derived constructor must return object or undefined");
|
||||
"Derived constructor must return object or undefined", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
}
|
||||
INTERPRETER_GOTO_EXCEPTION_HANDLER();
|
||||
|
@ -264,7 +264,7 @@ using CommonStubCSigns = kungfu::CommonStubCSigns;
|
||||
{ \
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread); \
|
||||
JSHandle<JSObject> error = factory->GetJSError( \
|
||||
ErrorType::TYPE_ERROR, "is not callable"); \
|
||||
ErrorType::TYPE_ERROR, "is not callable", StackCheck::NO); \
|
||||
thread->SetException(error.GetTaggedValue()); \
|
||||
} \
|
||||
INTERPRETER_GOTO_EXCEPTION_HANDLER(); \
|
||||
@ -286,7 +286,7 @@ using CommonStubCSigns = kungfu::CommonStubCSigns;
|
||||
{ \
|
||||
[[maybe_unused]] EcmaHandleScope handleScope(thread); \
|
||||
JSHandle<JSObject> error = factory->GetJSError( \
|
||||
ErrorType::TYPE_ERROR, "is not callable"); \
|
||||
ErrorType::TYPE_ERROR, "is not callable", StackCheck::NO); \
|
||||
thread->SetException(error.GetTaggedValue()); \
|
||||
} \
|
||||
INTERPRETER_GOTO_EXCEPTION_HANDLER(); \
|
||||
|
@ -38,11 +38,12 @@ namespace panda::ecmascript {
|
||||
// +--------------------------+
|
||||
EcmaRuntimeCallInfo* EcmaInterpreter::NewRuntimeCallInfoBase(
|
||||
JSThread *thread, JSTaggedType func, JSTaggedType thisObj, JSTaggedType newTarget,
|
||||
uint32_t numArgs, bool needCheckStack)
|
||||
uint32_t numArgs, StackCheck needCheckStack)
|
||||
{
|
||||
JSTaggedType *prevSp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
|
||||
JSTaggedType *newSp = GetInterpreterFrameEnd(thread, prevSp);
|
||||
if (needCheckStack && UNLIKELY(thread->DoStackOverflowCheck(newSp - numArgs - NUM_MANDATORY_JSFUNC_ARGS))) {
|
||||
if (needCheckStack == StackCheck::YES &&
|
||||
UNLIKELY(thread->DoStackOverflowCheck(newSp - numArgs - NUM_MANDATORY_JSFUNC_ARGS))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ EcmaRuntimeCallInfo* EcmaInterpreter::NewRuntimeCallInfoBase(
|
||||
|
||||
EcmaRuntimeCallInfo* EcmaInterpreter::NewRuntimeCallInfo(
|
||||
JSThread *thread, JSTaggedValue func, JSTaggedValue thisObj, JSTaggedValue newTarget,
|
||||
uint32_t numArgs, bool needCheckStack)
|
||||
uint32_t numArgs, StackCheck needCheckStack)
|
||||
{
|
||||
return NewRuntimeCallInfoBase(thread, func.GetRawData(), thisObj.GetRawData(), newTarget.GetRawData(),
|
||||
numArgs, needCheckStack);
|
||||
@ -76,14 +77,14 @@ EcmaRuntimeCallInfo* EcmaInterpreter::NewRuntimeCallInfo(
|
||||
|
||||
EcmaRuntimeCallInfo* EcmaInterpreter::NewRuntimeCallInfo(
|
||||
JSThread *thread, JSHandle<JSTaggedValue> func, JSHandle<JSTaggedValue> thisObj,
|
||||
JSHandle<JSTaggedValue> newTarget, uint32_t numArgs, bool needCheckStack)
|
||||
JSHandle<JSTaggedValue> newTarget, uint32_t numArgs, StackCheck needCheckStack)
|
||||
{
|
||||
return NewRuntimeCallInfoBase(thread, func.GetTaggedType(), thisObj.GetTaggedType(), newTarget.GetTaggedType(),
|
||||
numArgs, needCheckStack);
|
||||
}
|
||||
|
||||
EcmaRuntimeCallInfo* EcmaInterpreter::ReBuildRuntimeCallInfo(JSThread *thread, EcmaRuntimeCallInfo* info,
|
||||
int numArgs, bool needCheckStack)
|
||||
int numArgs, StackCheck needCheckStack)
|
||||
{
|
||||
JSTaggedValue func = info->GetFunctionValue();
|
||||
JSTaggedValue newTarget = info->GetNewTargetValue();
|
||||
@ -99,7 +100,8 @@ EcmaRuntimeCallInfo* EcmaInterpreter::ReBuildRuntimeCallInfo(JSThread *thread, E
|
||||
args[i] = info->GetCallArgValue(actualArgc - i - 1).GetRawData();
|
||||
}
|
||||
currentSp += (info->GetArgsNumber() + NUM_MANDATORY_JSFUNC_ARGS + 2); // 2: include thread_ and numArgs_
|
||||
if (needCheckStack && UNLIKELY(thread->DoStackOverflowCheck(currentSp - numArgs - NUM_MANDATORY_JSFUNC_ARGS))) {
|
||||
if (needCheckStack == StackCheck::YES &&
|
||||
UNLIKELY(thread->DoStackOverflowCheck(currentSp - numArgs - NUM_MANDATORY_JSFUNC_ARGS))) {
|
||||
return nullptr;
|
||||
}
|
||||
ASSERT(numArgs != actualArgc);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "ecmascript/frames.h"
|
||||
#include "ecmascript/method.h"
|
||||
#include "ecmascript/require/js_cjs_module.h"
|
||||
#include "ecmascript/object_factory.h"
|
||||
#include "libpandafile/bytecode_instruction-inl.h"
|
||||
|
||||
namespace panda::ecmascript {
|
||||
@ -44,12 +45,12 @@ public:
|
||||
static JSTaggedValue ExecuteNative(EcmaRuntimeCallInfo *info);
|
||||
static EcmaRuntimeCallInfo* NewRuntimeCallInfo(
|
||||
JSThread *thread, JSTaggedValue func, JSTaggedValue thisObj, JSTaggedValue newTarget,
|
||||
uint32_t numArgs, bool needCheckStack = true);
|
||||
uint32_t numArgs, StackCheck needCheckStack = StackCheck::YES);
|
||||
static EcmaRuntimeCallInfo* NewRuntimeCallInfo(
|
||||
JSThread *thread, JSHandle<JSTaggedValue> func, JSHandle<JSTaggedValue> thisObj,
|
||||
JSHandle<JSTaggedValue> newTarget, uint32_t numArgs, bool needCheckStack = true);
|
||||
JSHandle<JSTaggedValue> newTarget, uint32_t numArgs, StackCheck needCheckStack = StackCheck::YES);
|
||||
static EcmaRuntimeCallInfo* ReBuildRuntimeCallInfo(
|
||||
JSThread *thread, EcmaRuntimeCallInfo* info, int numArgs, bool needCheckStack = true);
|
||||
JSThread *thread, EcmaRuntimeCallInfo* info, int numArgs, StackCheck needCheckStack = StackCheck::YES);
|
||||
static JSTaggedValue GeneratorReEnterInterpreter(JSThread *thread, JSHandle<GeneratorContext> context);
|
||||
static JSTaggedValue GeneratorReEnterAot(JSThread *thread, JSHandle<GeneratorContext> context);
|
||||
#ifndef EXCLUDE_C_INTERPRETER
|
||||
@ -84,7 +85,7 @@ private:
|
||||
static void InitStackFrameForSP(JSTaggedType *prevSp);
|
||||
static EcmaRuntimeCallInfo* NewRuntimeCallInfoBase(
|
||||
JSThread *thread, JSTaggedType func, JSTaggedType thisObj, JSTaggedType newTarget,
|
||||
uint32_t numArgs, bool needCheckStack = true);
|
||||
uint32_t numArgs, StackCheck needCheckStack = StackCheck::YES);
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
#endif // ECMASCRIPT_INTERPRETER_INTERPRETER_H
|
||||
|
@ -242,7 +242,7 @@ JSTaggedValue InterpreterAssembly::Execute(EcmaRuntimeCallInfo *info)
|
||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<JSObject> error =
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "class constructor cannot called without 'new'");
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "class constructor cannot called without 'new'", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
}
|
||||
return thread->GetException();
|
||||
|
@ -75,7 +75,7 @@ JSTaggedValue JSAsyncGeneratorObject::AsyncGeneratorResolve(JSThread *thread,
|
||||
JSHandle<JSTaggedValue> resolve(thread, capability->GetResolve());
|
||||
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
|
||||
EcmaRuntimeCallInfo* info =
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread, resolve, undefined, undefined, 1, false);
|
||||
EcmaInterpreter::NewRuntimeCallInfo(thread, resolve, undefined, undefined, 1, StackCheck::NO);
|
||||
info->SetCallArg(its.GetTaggedValue());
|
||||
[[maybe_unused]] JSTaggedValue res = JSFunction::Call(info);
|
||||
if ((thread)->HasPendingException()) {
|
||||
@ -262,8 +262,8 @@ JSTaggedValue JSAsyncGeneratorObject::AsyncGeneratorEnqueue(JSThread *thread, co
|
||||
if (thread->HasPendingException()) {
|
||||
thread->ClearException();
|
||||
// a. Let badGeneratorError be a newly created TypeError object.
|
||||
JSHandle<JSObject> resolutionError =
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "Resolve: The promise and resolution cannot be the same.");
|
||||
JSHandle<JSObject> resolutionError = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
"Resolve: The promise and resolution cannot be the same.", StackCheck::NO);
|
||||
// b. Perform ! Call(promiseCapability.[[Reject]], undefined, « badGeneratorError »).
|
||||
const GlobalEnvConstants *constants = thread->GlobalConstants();
|
||||
JSHandle<JSTaggedValue> rstErr = JSHandle<JSTaggedValue>::Cast(resolutionError);
|
||||
|
@ -486,8 +486,8 @@ JSTaggedValue JSFunction::InvokeOptimizedEntrypoint(JSThread *thread, JSHandle<J
|
||||
if (mainFunc->IsClassConstructor()) {
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> error =
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "class constructor cannot called without 'new'");
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
"class constructor cannot called without 'new'", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
}
|
||||
return thread->GetException();
|
||||
|
@ -249,7 +249,8 @@ JSHandle<JSTaggedValue> JSListFormat::StringListFromIterable(JSThread *thread, c
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||
if (!nextValue->IsString()) {
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> typeError = factory->GetJSError(ErrorType::TYPE_ERROR, "nextValue is not string");
|
||||
JSHandle<JSObject> typeError =
|
||||
factory->GetJSError(ErrorType::TYPE_ERROR, "nextValue is not string", StackCheck::NO);
|
||||
JSHandle<JSTaggedValue> error(
|
||||
factory->NewCompletionRecord(CompletionRecordType::THROW, JSHandle<JSTaggedValue>(typeError)));
|
||||
JSTaggedValue result = JSIterator::IteratorClose(thread, iteratorRecord, error).GetTaggedValue();
|
||||
|
@ -1438,7 +1438,7 @@ JSHandle<JSTaggedValue> JSDeserializer::ReadJSError(SerializationUID uid)
|
||||
}
|
||||
JSHandle<JSTaggedValue> msg = DeserializeJSTaggedValue();
|
||||
JSHandle<EcmaString> handleMsg(msg);
|
||||
JSHandle<JSTaggedValue> errorTag = JSHandle<JSTaggedValue>::Cast(factory_->NewJSError(errorType, handleMsg));
|
||||
JSHandle<JSTaggedValue> errorTag = JSHandle<JSTaggedValue>::Cast(factory_->NewJSError(errorType, handleMsg, StackCheck::NO));
|
||||
referenceMap_.emplace(objectId_++, errorTag);
|
||||
return errorTag;
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ bool JSThread::DoStackOverflowCheck(const JSTaggedType *sp)
|
||||
LOG_ECMA(ERROR) << "Stack overflow! Remaining stack size is: " << (sp - glueData_.frameBase_);
|
||||
if (!IsCrossThreadExecutionEnable() && LIKELY(!HasPendingException())) {
|
||||
ObjectFactory *factory = GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(base::ErrorType::RANGE_ERROR, "Stack overflow!", false);
|
||||
JSHandle<JSObject> error = factory->GetJSError(base::ErrorType::RANGE_ERROR, "Stack overflow!", StackCheck::NO);
|
||||
SetException(error.GetTaggedValue());
|
||||
}
|
||||
return true;
|
||||
@ -506,7 +506,7 @@ bool JSThread::DoStackLimitCheck()
|
||||
LOG_ECMA(ERROR) << "Stack overflow! current:" << GetCurrentStackPosition() << " limit:" << GetStackLimit();
|
||||
if (!IsCrossThreadExecutionEnable() && LIKELY(!HasPendingException())) {
|
||||
ObjectFactory *factory = GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(base::ErrorType::RANGE_ERROR, "Stack overflow!", false);
|
||||
JSHandle<JSObject> error = factory->GetJSError(base::ErrorType::RANGE_ERROR, "Stack overflow!", StackCheck::NO);
|
||||
SetException(error.GetTaggedValue());
|
||||
}
|
||||
return true;
|
||||
@ -700,7 +700,7 @@ void JSThread::TerminateExecution()
|
||||
{
|
||||
// set the TERMINATE_ERROR to exception
|
||||
ObjectFactory *factory = GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TERMINATION_ERROR, "Terminate execution!");
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TERMINATION_ERROR, "Terminate execution!", StackCheck::NO);
|
||||
SetException(error.GetTaggedValue());
|
||||
}
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ void BaseHeap::SetMachineCodeOutOfMemoryError(JSThread *thread, size_t size, std
|
||||
|
||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::OOM_ERROR, oss.str().c_str());
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::OOM_ERROR, oss.str().c_str(), StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ int ModuleManager::GetExportObjectIndex(EcmaVM *vm, JSHandle<SourceTextModule> e
|
||||
msg += "' which exported by '" + ConvertToString(ecmaModule->GetEcmaModuleFilename()) + "'";
|
||||
}
|
||||
ObjectFactory *factory = vm->GetFactory();
|
||||
JSTaggedValue error = factory->GetJSError(ErrorType::SYNTAX_ERROR, msg.c_str()).GetTaggedValue();
|
||||
JSTaggedValue error = factory->GetJSError(ErrorType::SYNTAX_ERROR, msg.c_str(), StackCheck::NO).GetTaggedValue();
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error, 0);
|
||||
}
|
||||
JSHandle<TaggedArray> localExportEntries(thread, ecmaModule->GetLocalExportEntries());
|
||||
|
@ -1060,7 +1060,7 @@ int SourceTextModule::InnerModuleEvaluationUnsafe(JSThread *thread, const JSHand
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSTaggedValue promiseResult = JSPromise::Cast(promise.GetTaggedObject())->GetPromiseResult();
|
||||
JSHandle<JSObject> error =
|
||||
factory->GetJSError(base::ErrorType::ERROR, nullptr);
|
||||
factory->GetJSError(base::ErrorType::ERROR, nullptr, StackCheck::NO);
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), promiseResult.GetInt());
|
||||
}
|
||||
return index;
|
||||
|
@ -124,7 +124,7 @@ JSTaggedValue ModuleManagerHelper::GetCJSModuleValue(JSThread *thread, JSTaggedV
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
CString errorMsg = "Loading requireModule" + ConvertToString(cjsModuleName.GetTaggedValue()) + "failed";
|
||||
JSHandle<JSObject> syntaxError =
|
||||
factory->GetJSError(base::ErrorType::SYNTAX_ERROR, errorMsg.c_str());
|
||||
factory->GetJSError(base::ErrorType::SYNTAX_ERROR, errorMsg.c_str(), StackCheck::NO);
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, syntaxError.GetTaggedValue(), JSTaggedValue::Exception());
|
||||
}
|
||||
return cjsExports.GetTaggedValue();
|
||||
@ -151,7 +151,7 @@ JSTaggedValue ModuleManagerHelper::GetCJSModuleValue(JSThread *thread, JSTaggedV
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
CString errorMsg = "Loading requireModule" + ConvertToString(cjsModuleName.GetTaggedValue()) + "failed";
|
||||
JSHandle<JSObject> syntaxError =
|
||||
factory->GetJSError(base::ErrorType::SYNTAX_ERROR, errorMsg.c_str());
|
||||
factory->GetJSError(base::ErrorType::SYNTAX_ERROR, errorMsg.c_str(), StackCheck::NO);
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, syntaxError.GetTaggedValue(), JSTaggedValue::Exception());
|
||||
}
|
||||
return cjsExports.GetTaggedValue();
|
||||
|
@ -3311,7 +3311,8 @@ bool SendableArrayRef::SetValueAt(const EcmaVM *vm, Local<JSValueRef> obj, uint3
|
||||
ObjectFactory *factory = vm->GetFactory(); \
|
||||
\
|
||||
JSHandle<EcmaString> messageValue(JSNApiHelper::ToJSHandle(message)); \
|
||||
JSHandle<JSTaggedValue> result(factory->NewJSError(ErrorType::type, messageValue)); \
|
||||
JSHandle<JSTaggedValue> result(factory->NewJSError(ErrorType::type, \
|
||||
messageValue, ecmascript::StackCheck::NO)); \
|
||||
return JSNApiHelper::ToLocal<JSValueRef>(result); \
|
||||
}
|
||||
|
||||
|
@ -967,7 +967,7 @@ JSHandle<JSArguments> ObjectFactory::NewJSArguments()
|
||||
return obj;
|
||||
}
|
||||
|
||||
JSHandle<JSObject> ObjectFactory::GetJSError(const ErrorType &errorType, const char *data, bool needCheckStack)
|
||||
JSHandle<JSObject> ObjectFactory::GetJSError(const ErrorType &errorType, const char *data, StackCheck needCheckStack)
|
||||
{
|
||||
ASSERT_PRINT(errorType == ErrorType::ERROR || errorType == ErrorType::EVAL_ERROR ||
|
||||
errorType == ErrorType::RANGE_ERROR || errorType == ErrorType::REFERENCE_ERROR ||
|
||||
@ -984,7 +984,7 @@ JSHandle<JSObject> ObjectFactory::GetJSError(const ErrorType &errorType, const c
|
||||
}
|
||||
|
||||
JSHandle<JSObject> ObjectFactory::NewJSError(const ErrorType &errorType, const JSHandle<EcmaString> &message,
|
||||
bool needCheckStack)
|
||||
StackCheck needCheckStack)
|
||||
{
|
||||
// if there have exception in thread, then return current exception, no need to new js error.
|
||||
if (thread_->HasPendingException()) {
|
||||
|
@ -191,6 +191,7 @@ using base::ErrorType;
|
||||
|
||||
enum class RemoveSlots { YES, NO };
|
||||
enum class GrowMode { KEEP, GROW };
|
||||
enum class StackCheck { YES, NO };
|
||||
|
||||
class ObjectFactory {
|
||||
public:
|
||||
@ -207,10 +208,10 @@ public:
|
||||
JSHandle<Program> NewProgram();
|
||||
|
||||
JSHandle<JSObject> PUBLIC_API GetJSError(const ErrorType &errorType, const char *data = nullptr,
|
||||
bool needCheckStack = true);
|
||||
StackCheck needCheckStack = StackCheck::YES);
|
||||
|
||||
JSHandle<JSObject> NewJSError(const ErrorType &errorType, const JSHandle<EcmaString> &message,
|
||||
bool needCheckStack = true);
|
||||
StackCheck needCheckStack = StackCheck::YES);
|
||||
|
||||
JSHandle<JSObject> NewJSAggregateError();
|
||||
|
||||
|
@ -136,7 +136,7 @@ void BaseDeserializer::DeserializeJSError(JSErrorInfo *info)
|
||||
JSTaggedValue errorMsg = info->errorMsg_;
|
||||
bool root = info->root_;
|
||||
ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> errorTag = factory->NewJSError(errorType, JSHandle<EcmaString>(thread_, errorMsg));
|
||||
JSHandle<JSObject> errorTag = factory->NewJSError(errorType, JSHandle<EcmaString>(thread_, errorMsg), StackCheck::NO);
|
||||
ObjectSlot slot = info->GetSlot();
|
||||
slot.Update(errorTag.GetTaggedType());
|
||||
if (!root && !errorTag.GetTaggedValue().IsInvalidValue()) {
|
||||
|
@ -1262,7 +1262,7 @@ HWTEST_F_L0(JSSerializerTest, SerializeJSError1)
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<EcmaString> msg(factory->NewFromASCII("this is error"));
|
||||
JSHandle<JSTaggedValue> errorTag =
|
||||
JSHandle<JSTaggedValue>::Cast(factory->NewJSError(base::ErrorType::ERROR, msg));
|
||||
JSHandle<JSTaggedValue>::Cast(factory->NewJSError(base::ErrorType::ERROR, msg, StackCheck::NO));
|
||||
|
||||
ValueSerializer *serializer = new ValueSerializer(thread);
|
||||
serializer->WriteValue(thread, errorTag, JSHandle<JSTaggedValue>(thread, JSTaggedValue::Undefined()),
|
||||
@ -1283,7 +1283,7 @@ HWTEST_F_L0(JSSerializerTest, SerializeJSError2)
|
||||
JSHandle<EcmaString> key2(factory->NewFromASCII("error2"));
|
||||
JSHandle<EcmaString> msg(factory->NewFromASCII("this is error"));
|
||||
JSHandle<JSTaggedValue> errorTag =
|
||||
JSHandle<JSTaggedValue>::Cast(factory->NewJSError(base::ErrorType::ERROR, msg));
|
||||
JSHandle<JSTaggedValue>::Cast(factory->NewJSError(base::ErrorType::ERROR, msg, StackCheck::NO));
|
||||
|
||||
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(obj), JSHandle<JSTaggedValue>(key1), errorTag);
|
||||
|
@ -1495,14 +1495,14 @@ void RuntimeStubs::RuntimeThrowPatternNonCoercible(JSThread *thread)
|
||||
{
|
||||
JSHandle<EcmaString> msg(thread->GlobalConstants()->GetHandledObjNotCoercibleString());
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::TYPE_ERROR, msg, false).GetTaggedValue());
|
||||
THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::TYPE_ERROR, msg, StackCheck::NO).GetTaggedValue());
|
||||
}
|
||||
|
||||
void RuntimeStubs::RuntimeThrowDeleteSuperProperty(JSThread *thread)
|
||||
{
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<EcmaString> info = factory->NewFromASCII("Can not delete super property");
|
||||
JSHandle<JSObject> errorObj = factory->NewJSError(base::ErrorType::REFERENCE_ERROR, info, false);
|
||||
JSHandle<JSObject> errorObj = factory->NewJSError(base::ErrorType::REFERENCE_ERROR, info, StackCheck::NO);
|
||||
THROW_NEW_ERROR_AND_RETURN(thread, errorObj.GetTaggedValue());
|
||||
}
|
||||
|
||||
@ -1513,7 +1513,7 @@ void RuntimeStubs::RuntimeThrowUndefinedIfHole(JSThread *thread, const JSHandle<
|
||||
|
||||
JSHandle<EcmaString> msg = factory->ConcatFromString(obj, info);
|
||||
THROW_NEW_ERROR_AND_RETURN(thread,
|
||||
factory->NewJSError(base::ErrorType::REFERENCE_ERROR, msg, false).GetTaggedValue());
|
||||
factory->NewJSError(base::ErrorType::REFERENCE_ERROR, msg, StackCheck::NO).GetTaggedValue());
|
||||
}
|
||||
|
||||
void RuntimeStubs::RuntimeThrowIfNotObject(JSThread *thread)
|
||||
@ -1528,7 +1528,7 @@ void RuntimeStubs::RuntimeThrowConstAssignment(JSThread *thread, const JSHandle<
|
||||
JSHandle<EcmaString> info = factory->NewFromASCII("Assignment to const variable ");
|
||||
|
||||
JSHandle<EcmaString> msg = factory->ConcatFromString(info, value);
|
||||
THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::TYPE_ERROR, msg, false).GetTaggedValue());
|
||||
THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::TYPE_ERROR, msg, StackCheck::NO).GetTaggedValue());
|
||||
}
|
||||
|
||||
JSTaggedValue RuntimeStubs::RuntimeLdGlobalRecord(JSThread *thread, JSTaggedValue key)
|
||||
@ -1582,7 +1582,7 @@ JSTaggedValue RuntimeStubs::RuntimeThrowReferenceError(JSThread *thread, const J
|
||||
JSHandle<EcmaString> info = factory->NewFromUtf8(desc);
|
||||
JSHandle<EcmaString> msg = factory->ConcatFromString(propName, info);
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread,
|
||||
factory->NewJSError(base::ErrorType::REFERENCE_ERROR, msg, false).GetTaggedValue(),
|
||||
factory->NewJSError(base::ErrorType::REFERENCE_ERROR, msg, StackCheck::NO).GetTaggedValue(),
|
||||
JSTaggedValue::Exception());
|
||||
}
|
||||
|
||||
|
@ -931,7 +931,7 @@ DEF_RUNTIME_STUBS(RegularJSObjDeletePrototype)
|
||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
|
||||
if (!result) {
|
||||
auto factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, "Cannot delete property");
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, "Cannot delete property", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
return JSTaggedValue::Exception().GetRawData();
|
||||
}
|
||||
@ -947,7 +947,7 @@ DEF_RUNTIME_STUBS(CallJSObjDeletePrototype)
|
||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
|
||||
if (!result) {
|
||||
auto factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, "Cannot delete property");
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, "Cannot delete property", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
return JSTaggedValue::Exception().GetRawData();
|
||||
}
|
||||
@ -2088,7 +2088,7 @@ DEF_RUNTIME_STUBS(ThrowTypeError)
|
||||
JSTaggedValue argMessageStringId = GetArg(argv, argc, 0); // 0: means the zeroth parameter
|
||||
std::string message = MessageString::GetMessageString(argMessageStringId.GetInt());
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, message.c_str());
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, message.c_str(), StackCheck::NO);
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), JSTaggedValue::Hole().GetRawData());
|
||||
}
|
||||
|
||||
@ -2107,7 +2107,7 @@ DEF_RUNTIME_STUBS(ThrowRangeError)
|
||||
JSTaggedValue argMessageStringId = GetArg(argv, argc, 0);
|
||||
std::string message = MessageString::GetMessageString(argMessageStringId.GetInt());
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::RANGE_ERROR, message.c_str());
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::RANGE_ERROR, message.c_str(), StackCheck::NO);
|
||||
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), JSTaggedValue::Hole().GetRawData());
|
||||
}
|
||||
|
||||
@ -2580,7 +2580,7 @@ DEF_RUNTIME_STUBS(ThrowNotCallableException)
|
||||
RUNTIME_STUBS_HEADER(ThrowNotCallableException);
|
||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, "is not callable");
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, "is not callable", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
return JSTaggedValue::Exception().GetRawData();
|
||||
}
|
||||
@ -2591,7 +2591,7 @@ DEF_RUNTIME_STUBS(ThrowSetterIsUndefinedException)
|
||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
"Cannot set property when setter is undefined");
|
||||
"Cannot set property when setter is undefined", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
return JSTaggedValue::Exception().GetRawData();
|
||||
}
|
||||
@ -2602,7 +2602,7 @@ DEF_RUNTIME_STUBS(ThrowCallConstructorException)
|
||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
"class constructor cannot called without 'new'");
|
||||
"class constructor cannot called without 'new'", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
return JSTaggedValue::Exception().GetRawData();
|
||||
}
|
||||
@ -2613,7 +2613,7 @@ DEF_RUNTIME_STUBS(ThrowNonConstructorException)
|
||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
"function is non-constructor");
|
||||
"function is non-constructor", StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
return JSTaggedValue::Exception().GetRawData();
|
||||
}
|
||||
@ -2626,7 +2626,7 @@ DEF_RUNTIME_STUBS(ThrowStackOverflowException)
|
||||
// so check thread here to distinguish it with the actual stack overflow.
|
||||
ecmaVm->CheckThread();
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::RANGE_ERROR, "Stack overflow!", false);
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::RANGE_ERROR, "Stack overflow!", StackCheck::NO);
|
||||
if (LIKELY(!thread->HasPendingException())) {
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
}
|
||||
@ -2639,7 +2639,8 @@ DEF_RUNTIME_STUBS(ThrowDerivedMustReturnException)
|
||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||
JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
|
||||
"Derived constructor must return object or undefined");
|
||||
"Derived constructor must return object or undefined",
|
||||
StackCheck::NO);
|
||||
thread->SetException(error.GetTaggedValue());
|
||||
return JSTaggedValue::Exception().GetRawData();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user