From efa26cb1030d5387b1fe2693f56aaef6296b0371 Mon Sep 17 00:00:00 2001 From: wu_zhang_da Date: Fri, 19 Jul 2024 16:06:57 +0800 Subject: [PATCH] Revert "Disable worker aot optimization" Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAE7O5 This reverts commit ef2532024a1fd9435287a125ce53705ea2823200. Change-Id: I5401b5c973bb83568dc568e0dfe4d9e9784a2412 Signed-off-by: wu_zhang_da --- .../compiler/aot_file/aot_file_manager.cpp | 21 +++++- ecmascript/compiler/call_stub_builder.cpp | 14 ++-- .../compiler/new_object_stub_builder.cpp | 11 +-- ecmascript/compiler/stub_builder-inl.h | 6 -- ecmascript/compiler/stub_builder.h | 1 - ecmascript/ecma_context.cpp | 5 +- ecmascript/interpreter/interpreter-inl.cpp | 2 +- .../interpreter/interpreter_assembly.cpp | 2 +- ecmascript/js_function.cpp | 2 +- ecmascript/js_runtime_options.h | 2 +- ecmascript/js_thread.cpp | 3 +- ecmascript/js_thread.h | 18 ----- ecmascript/napi/include/jsnapi_expo.h | 3 +- ecmascript/napi/jsnapi_expo.cpp | 46 ++----------- ecmascript/ohos/framework_helper.h | 2 - ecmascript/ohos/ohos_preload_app_info.h | 68 +++++++++++++++++++ ecmascript/stubs/runtime_stubs-inl.h | 2 +- ecmascript/stubs/runtime_stubs.cpp | 2 +- 18 files changed, 108 insertions(+), 102 deletions(-) create mode 100644 ecmascript/ohos/ohos_preload_app_info.h diff --git a/ecmascript/compiler/aot_file/aot_file_manager.cpp b/ecmascript/compiler/aot_file/aot_file_manager.cpp index 6a5580849a..7a0d086598 100644 --- a/ecmascript/compiler/aot_file/aot_file_manager.cpp +++ b/ecmascript/compiler/aot_file/aot_file_manager.cpp @@ -43,6 +43,7 @@ #include "ecmascript/mem/region.h" #include "ecmascript/message_string.h" #include "ecmascript/ohos/framework_helper.h" +#include "ecmascript/ohos/ohos_preload_app_info.h" #include "ecmascript/snapshot/mem/snapshot.h" #include "ecmascript/stackmap/ark_stackmap_parser.h" #include "ecmascript/stackmap/llvm/llvm_stackmap_parser.h" @@ -136,9 +137,23 @@ bool AOTFileManager::LoadAiFile(const JSPandaFile *jsPandaFile) return false; } - AnFileDataManager *anFileDataManager = AnFileDataManager::GetInstance(); - std::string aiFilename = anFileDataManager->GetDir(); - aiFilename += JSFilePath::GetHapName(jsPandaFile) + AOTFileManager::FILE_EXTENSION_AI; + std::string aiFilename = ""; + // device side aot compile success + if (AnFileDataManager::GetInstance()->IsEnable()) { + AnFileDataManager *anFileDataManager = AnFileDataManager::GetInstance(); + aiFilename = anFileDataManager->GetDir(); + aiFilename += JSFilePath::GetHapName(jsPandaFile) + FILE_EXTENSION_AI; + } else { + std::string moduleName = JSFilePath::GetHapName(jsPandaFile); + std::string hapPath = jsPandaFile->GetJSPandaFileHapPath().c_str(); + aiFilename = OhosPreloadAppInfo::GetPreloadAOTFileName(hapPath, moduleName) + FILE_EXTENSION_AI; + } + + if (aiFilename.empty()) { + LOG_ECMA(INFO) << "current thread can not find ai file"; + return false; + } + LoadAiFile(aiFilename); return true; } diff --git a/ecmascript/compiler/call_stub_builder.cpp b/ecmascript/compiler/call_stub_builder.cpp index 4f6e99abba..3b4b2e18ce 100644 --- a/ecmascript/compiler/call_stub_builder.cpp +++ b/ecmascript/compiler/call_stub_builder.cpp @@ -207,8 +207,6 @@ void CallStubBuilder::JSCallJSFunction(Label *exit, Label *noNeedCheckException) Label checkIsBaselineCompiling(env); Label methodIsFastCall(env); Label methodNotFastCall(env); - // Worker/Taskpool disable aot optimization - Label judgeAotAndFastCall(env); Label checkAot(env); { newTarget_ = Undefined(); @@ -216,15 +214,13 @@ void CallStubBuilder::JSCallJSFunction(Label *exit, Label *noNeedCheckException) realNumArgs_ = Int64Add(ZExtInt32ToInt64(actualNumArgs_), Int64(NUM_MANDATORY_JSFUNC_ARGS)); BRANCH(IsJsProxy(func_), &methodNotAot, &checkAot); Bind(&checkAot); - BRANCH(IsWorker(glue_), &funcCheckBaselineCode, &judgeAotAndFastCall); - Bind(&judgeAotAndFastCall); BRANCH(JudgeAotAndFastCall(func_, CircuitBuilder::JudgeMethodType::HAS_AOT_FASTCALL), &methodIsFastCall, &methodNotFastCall); Bind(&methodIsFastCall); { JSFastAotCall(exit); } - + Bind(&methodNotFastCall); BRANCH(JudgeAotAndFastCall(func_, CircuitBuilder::JudgeMethodType::HAS_AOT), &methodisAot, &funcCheckBaselineCode); @@ -232,7 +228,7 @@ void CallStubBuilder::JSCallJSFunction(Label *exit, Label *noNeedCheckException) { JSSlowAotCall(exit); } - + Bind(&funcCheckBaselineCode); GateRef baselineCodeOffset = IntPtr(JSFunction::BASELINECODE_OFFSET); GateRef baselineCode = Load(VariableType::JS_POINTER(), func_, baselineCodeOffset); @@ -378,7 +374,7 @@ void CallStubBuilder::JSCallAsmInterpreter(bool hasBaselineCode, Label *methodNo PrepareIdxForAsmInterpreterWithBaselineCode() : PrepareIdxForAsmInterpreterWithoutBaselineCode()); std::vector argsForAsmInterpreter = PrepareArgsForAsmInterpreter(); - + switch (callArgs_.mode) { case JSCallMode::CALL_ARG0: case JSCallMode::CALL_ARG1: @@ -687,10 +683,10 @@ std::vector CallStubBuilder::PrepareArgsForAot(GateRef expectedNum) std::vector appendArgs = PrepareAppendArgsForAotStep1(); basicArgs.insert(basicArgs.end(), appendArgs.begin(), appendArgs.end()); - + appendArgs = PrepareAppendArgsForAotStep2(expectedNum); basicArgs.insert(basicArgs.end(), appendArgs.begin(), appendArgs.end()); - + appendArgs = PrepareAppendArgsForAotStep3(expectedNum); basicArgs.insert(basicArgs.end(), appendArgs.begin(), appendArgs.end()); diff --git a/ecmascript/compiler/new_object_stub_builder.cpp b/ecmascript/compiler/new_object_stub_builder.cpp index d81b64acba..600124afc8 100644 --- a/ecmascript/compiler/new_object_stub_builder.cpp +++ b/ecmascript/compiler/new_object_stub_builder.cpp @@ -819,11 +819,6 @@ GateRef NewObjectStubBuilder::NewJSFunction(GateRef glue, GateRef constpool, Gat Label isHeapObject(env); Label afterAOTLiteral(env); - // Worker/Taskpool disable aot optimization - Label aotLiteral(env); - GateRef isWoker = IsWorker(glue); - BRANCH(isWoker, &afterAOTLiteral, &aotLiteral); - Bind(&aotLiteral); BRANCH(TaggedIsHeapObject(*val), &isHeapObject, &afterAOTLiteral); { Bind(&isHeapObject); @@ -877,10 +872,6 @@ GateRef NewObjectStubBuilder::NewJSFunction(GateRef glue, GateRef constpool, Gat Label hasCompiledStatus(env); Label afterDealWithCompiledStatus(env); Label tryInitFuncCodeEntry(env); - // Worker/Taskpool disable aot optimization - Label judgeAotWithCallField(env); - BRANCH(isWoker, &tryInitFuncCodeEntry, &judgeAotWithCallField); - Bind(&judgeAotWithCallField); BRANCH(IsAotWithCallField(method), &hasCompiledStatus, &tryInitFuncCodeEntry); Bind(&hasCompiledStatus); { @@ -1719,7 +1710,7 @@ GateRef NewObjectStubBuilder::FastSuperAllocateThis(GateRef glue, GateRef superC Label callRuntime(env); Label newObject(env); Label isFunction(env); - + BRANCH(IsJSFunction(newTarget), &isFunction, &callRuntime); Bind(&isFunction); DEFVARIABLE(thisObj, VariableType::JS_ANY(), Undefined()); diff --git a/ecmascript/compiler/stub_builder-inl.h b/ecmascript/compiler/stub_builder-inl.h index cb6ec90349..72e9b17828 100644 --- a/ecmascript/compiler/stub_builder-inl.h +++ b/ecmascript/compiler/stub_builder-inl.h @@ -3147,12 +3147,6 @@ inline GateRef StubBuilder::GetGlobalObject(GateRef glue) return Load(VariableType::JS_ANY(), glue, offset); } -inline GateRef StubBuilder::IsWorker(GateRef glue) -{ - GateRef isWorkerOffset = IntPtr(JSThread::GlueData::GetIsWorkerOffset(env_->Is32Bit())); - return Load(VariableType::BOOL(), glue, isWorkerOffset); -} - inline GateRef StubBuilder::GetMethodFromFunction(GateRef function) { return env_->GetBuilder()->GetMethodFromFunction(function); diff --git a/ecmascript/compiler/stub_builder.h b/ecmascript/compiler/stub_builder.h index b413758d84..5fac3cb2a6 100644 --- a/ecmascript/compiler/stub_builder.h +++ b/ecmascript/compiler/stub_builder.h @@ -774,7 +774,6 @@ ShortcutBoolOr([&]{ return first; }, [&]{ return second; }) void SetMachineCodeToFunction(GateRef glue, GateRef function, GateRef value, MemoryOrder order = MemoryOrder::Default()); GateRef GetGlobalObject(GateRef glue); - GateRef IsWorker(GateRef glue); GateRef GetMethodFromFunction(GateRef function); GateRef GetModuleFromFunction(GateRef function); GateRef GetHomeObjectFromFunction(GateRef function); diff --git a/ecmascript/ecma_context.cpp b/ecmascript/ecma_context.cpp index d2e56150f2..c5c1682c6d 100644 --- a/ecmascript/ecma_context.cpp +++ b/ecmascript/ecma_context.cpp @@ -650,10 +650,7 @@ JSTaggedValue EcmaContext::FindCachedConstpoolAndLoadAiIfNeeded(const JSPandaFil } // Getting the cached constpool in runtime means the ai data has not been loaded in current thread. // And we need to reload it - // Worker/Taskpool disable aot optimization - if (!thread_->IsWorker() && ecmascript::AnFileDataManager::GetInstance()->IsEnable()) { - aotFileManager_->LoadAiFile(jsPandaFile); - } + aotFileManager_->LoadAiFile(jsPandaFile); return constpool; } diff --git a/ecmascript/interpreter/interpreter-inl.cpp b/ecmascript/interpreter/interpreter-inl.cpp index 68b261cb0a..53ab6f9825 100644 --- a/ecmascript/interpreter/interpreter-inl.cpp +++ b/ecmascript/interpreter/interpreter-inl.cpp @@ -779,7 +779,7 @@ JSTaggedValue EcmaInterpreter::GeneratorReEnterInterpreter(JSThread *thread, JSH { [[maybe_unused]] EcmaHandleScope handleScope(thread); JSHandle func = JSHandle::Cast(JSHandle(thread, context->GetMethod())); - if (!thread->IsWorker() && func->IsCompiledCode()) { + if (func->IsCompiledCode()) { return GeneratorReEnterAot(thread, context); } diff --git a/ecmascript/interpreter/interpreter_assembly.cpp b/ecmascript/interpreter/interpreter_assembly.cpp index 8b3ec4945e..95f1c1fdb7 100644 --- a/ecmascript/interpreter/interpreter_assembly.cpp +++ b/ecmascript/interpreter/interpreter_assembly.cpp @@ -242,7 +242,7 @@ JSTaggedValue InterpreterAssembly::Execute(EcmaRuntimeCallInfo *info) callTarget = reinterpret_cast(info->GetFunctionValue().GetTaggedObject()); method = callTarget->GetCallTarget(); - if (!thread->IsWorker() && isCompiledCode) { + if (isCompiledCode) { JSHandle func(thread, info->GetFunctionValue()); if (func->IsClassConstructor()) { { diff --git a/ecmascript/js_function.cpp b/ecmascript/js_function.cpp index 7499ab40e9..c9678b0da1 100644 --- a/ecmascript/js_function.cpp +++ b/ecmascript/js_function.cpp @@ -627,7 +627,7 @@ JSTaggedValue JSFunction::ConstructInternal(EcmaRuntimeCallInfo *info) JSTaggedValue resultValue; info->SetThis(obj.GetTaggedValue()); - if (!thread->IsWorker() && func->IsCompiledCode()) { + if (func->IsCompiledCode()) { resultValue = InvokeOptimizedEntrypoint(thread, func, info); const JSTaggedType *curSp = thread->GetCurrentSPFrame(); InterpretedEntryFrame *entryState = InterpretedEntryFrame::GetFrameFromSp(curSp); diff --git a/ecmascript/js_runtime_options.h b/ecmascript/js_runtime_options.h index e683919d5e..0a841aba19 100644 --- a/ecmascript/js_runtime_options.h +++ b/ecmascript/js_runtime_options.h @@ -1843,7 +1843,7 @@ public: } public: - static constexpr int32_t MAX_APP_COMPILE_METHOD_SIZE = 1_KB; + static constexpr int32_t MAX_APP_COMPILE_METHOD_SIZE = 2_KB; private: static constexpr int32_t DEFAULT_OPT_LEVEL = 3; // 3: default opt level diff --git a/ecmascript/js_thread.cpp b/ecmascript/js_thread.cpp index 11dab319a4..ced7f3399d 100644 --- a/ecmascript/js_thread.cpp +++ b/ecmascript/js_thread.cpp @@ -104,7 +104,6 @@ JSThread *JSThread::Create(EcmaVM *vm) jsThread->glueData_.stackStart_ = GetCurrentStackPosition(); jsThread->glueData_.isEnableElementsKind_ = vm->IsEnableElementsKind(); jsThread->SetThreadId(); - jsThread->SetWorker(vm->GetJSOptions().IsWorker()); RegisterThread(jsThread); return jsThread; @@ -679,7 +678,7 @@ void JSThread::CheckSwitchDebuggerBCStub() void JSThread::CheckOrSwitchPGOStubs() { bool isSwitch = false; - if (!IsWorker() && IsPGOProfilerEnable()) { + if (IsPGOProfilerEnable()) { if (GetBCStubStatus() == BCStubStatus::NORMAL_BC_STUB) { SetBCStubStatus(BCStubStatus::PROFILE_BC_STUB); isSwitch = true; diff --git a/ecmascript/js_thread.h b/ecmascript/js_thread.h index a12dcc155a..ff5a217b99 100644 --- a/ecmascript/js_thread.h +++ b/ecmascript/js_thread.h @@ -858,16 +858,6 @@ public: glueData_.isDebugMode_ = false; } - bool IsWorker() - { - return glueData_.isWorker_; - } - - void SetWorker(bool isWorker) - { - glueData_.isWorker_ = isWorker; - } - template void SetInterruptValue(V value) { @@ -969,7 +959,6 @@ public: JSTaggedValue, base::AlignedBool, base::AlignedBool, - base::AlignedBool, base::AlignedUint32, JSTaggedValue, base::AlignedPointer, @@ -1010,7 +999,6 @@ public: InterruptVectorIndex, IsStartHeapSamplingIndex, IsDebugModeIndex, - IsWorkerIndex, IsFrameDroppedIndex, PropertiesGrowStepIndex, EntryFrameDroppedStateIndex, @@ -1192,11 +1180,6 @@ public: return GetOffset(Index::IsDebugModeIndex)>(isArch32); } - static size_t GetIsWorkerOffset(bool isArch32) - { - return GetOffset(Index::IsWorkerIndex)>(isArch32); - } - static size_t GetIsFrameDroppedOffset(bool isArch32) { return GetOffset(Index::IsFrameDroppedIndex)>(isArch32); @@ -1281,7 +1264,6 @@ public: alignas(EAS) volatile uint64_t interruptVector_ {0}; alignas(EAS) JSTaggedValue isStartHeapSampling_ {JSTaggedValue::False()}; alignas(EAS) bool isDebugMode_ {false}; - alignas(EAS) bool isWorker_ {false}; alignas(EAS) bool isFrameDropped_ {false}; alignas(EAS) uint32_t propertiesGrowStep_ {JSObjectResizingStrategy::PROPERTIES_GROW_SIZE}; alignas(EAS) uint64_t entryFrameDroppedState_ {FrameDroppedState::StateFalse}; diff --git a/ecmascript/napi/include/jsnapi_expo.h b/ecmascript/napi/include/jsnapi_expo.h index dfcdfaa2bd..19e678bd24 100644 --- a/ecmascript/napi/include/jsnapi_expo.h +++ b/ecmascript/napi/include/jsnapi_expo.h @@ -482,7 +482,7 @@ public: bool IsJSSharedInt32Array(const EcmaVM *vm); bool IsJSSharedUint32Array(const EcmaVM *vm); bool IsJSSharedFloat32Array(const EcmaVM *vm); - + bool IsGeneratorObject(const EcmaVM *vm); bool IsJSPrimitiveSymbol(const EcmaVM *vm); @@ -1444,7 +1444,6 @@ public: const std::string &moduleName, std::function cb); #endif - static std::string GetPreloadAotFile(EcmaVM *vm, const std::string &moduleName); // context static EcmaContext *CreateJSContext(EcmaVM *vm); static void SwitchCurrentContext(EcmaVM *vm, EcmaContext *context); diff --git a/ecmascript/napi/jsnapi_expo.cpp b/ecmascript/napi/jsnapi_expo.cpp index 32f11fd210..ca6545598a 100644 --- a/ecmascript/napi/jsnapi_expo.cpp +++ b/ecmascript/napi/jsnapi_expo.cpp @@ -95,6 +95,7 @@ #include "ecmascript/ohos/aot_runtime_info.h" #include "ecmascript/ohos/enable_aot_list_helper.h" #include "ecmascript/ohos/framework_helper.h" +#include "ecmascript/ohos/ohos_preload_app_info.h" #include "ecmascript/platform/aot_crash_info.h" #ifdef ARK_SUPPORT_INTL #include "ecmascript/js_bigint.h" @@ -4692,7 +4693,12 @@ void JSNApi::LoadAotFileInternal(EcmaVM *vm, const std::string &moduleName, std: { aotFileName = ecmascript::AnFileDataManager::GetInstance()->GetDir() + moduleName; } else { - aotFileName = GetPreloadAotFile(vm, moduleName); + std::string hapPath = ""; + ecmascript::SearchHapPathCallBack callback = vm->GetSearchHapPathCallBack(); + if (callback) { + callback(moduleName, hapPath); + } + aotFileName = ecmascript::OhosPreloadAppInfo::GetPreloadAOTFileName(hapPath, moduleName); } if (aotFileName.empty()) { LOG_ECMA(INFO) << "can not find aot file"; @@ -4731,44 +4737,6 @@ void JSNApi::LoadAotFile(EcmaVM *vm, [[maybe_unused]] const std::string &bundleN } #endif -std::string JSNApi::GetPreloadAotFile(EcmaVM *vm, const std::string &moduleName) -{ - std::string aotFileName; - std::string appName; - std::string folderPath; - std::string appPath; - std::string hapPath; - ecmascript::SearchHapPathCallBack callback = vm->GetSearchHapPathCallBack(); - if (callback) { - callback(moduleName, hapPath); - } - int folderEnd = -1; - int appEnd = -1; - if (hapPath.find(ecmascript::FrameworkHelper::PRELOAD_PATH_PREFIX) != std::string::npos) { - folderEnd = static_cast(hapPath.find_last_of('/')); - } - if (folderEnd != -1) { - // "/system/app/AppName" - folderPath = hapPath.substr(0, folderEnd); - appEnd = static_cast(folderPath.find_last_of('/')); - // "AppName" - appName = folderPath.substr(appEnd + 1); - } - if (appEnd != -1) { - // "/system/app" - appPath = hapPath.substr(0, appEnd); - // "/system/app/ark-cache/AppName/ModuleName" - aotFileName = appPath + ecmascript::FrameworkHelper::PRELOAD_AN_FOLDER + appName + "/" + moduleName; - } - std::string anFile = aotFileName + ecmascript::AOTFileManager::FILE_EXTENSION_AN; - std::string aiFile = aotFileName + ecmascript::AOTFileManager::FILE_EXTENSION_AI; - if (!ecmascript::FileExist(anFile.c_str()) || !ecmascript::FileExist(aiFile.c_str())) { - aotFileName.clear(); - } - - return aotFileName; -} - bool JSNApi::ExecuteInContext(EcmaVM *vm, const std::string &fileName, const std::string &entry, bool needUpdate) { CROSS_THREAD_AND_EXCEPTION_CHECK_WITH_RETURN(vm, false); diff --git a/ecmascript/ohos/framework_helper.h b/ecmascript/ohos/framework_helper.h index 2daf5bde78..2c207bf557 100644 --- a/ecmascript/ohos/framework_helper.h +++ b/ecmascript/ohos/framework_helper.h @@ -26,8 +26,6 @@ namespace panda::ecmascript { class FrameworkHelper { public: - constexpr static const char *const PRELOAD_PATH_PREFIX = "/system/"; - constexpr static const char *const PRELOAD_AN_FOLDER = "/ark-cache/"; FrameworkHelper(JSThread *thread) : thread_(thread), diff --git a/ecmascript/ohos/ohos_preload_app_info.h b/ecmascript/ohos/ohos_preload_app_info.h new file mode 100644 index 0000000000..c94e6d69e4 --- /dev/null +++ b/ecmascript/ohos/ohos_preload_app_info.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ECMASCRIPT_OHOS_PRELOAD_APP_INFO_H +#define ECMASCRIPT_OHOS_PRELOAD_APP_INFO_H + +#include +#include +#include + +#include "ecmascript/platform/file.h" +#include "macros.h" + +namespace panda::ecmascript { +class OhosPreloadAppInfo { +public: + constexpr static const char *const PRELOAD_PATH_PREFIX = "/system/"; + constexpr static const char *const PRELOAD_AN_FOLDER = "/ark-cache/"; + + OhosPreloadAppInfo() = default; + + static std::string GetPreloadAOTFileName(const std::string &hapPath, const std::string &moduleName) + { + std::string aotFileName = ""; + std::string appName = ""; + std::string folderPath = ""; + std::string appPath = ""; + + size_t folderEnd = 0; + size_t appEnd = 0; + if (hapPath.find(PRELOAD_PATH_PREFIX) != std::string::npos) { + folderEnd = hapPath.find_last_of('/'); + } + if (folderEnd != std::string::npos) { + // "/system/app/AppName" + folderPath = hapPath.substr(0, folderEnd); + appEnd = folderPath.find_last_of('/'); + // "AppName" + appName = folderPath.substr(appEnd + 1); + } + if (appEnd != std::string::npos) { + // "/system/app" + appPath = hapPath.substr(0, appEnd); + // "/system/app/ark-cache/AppName/ModuleName" + aotFileName = appPath + PRELOAD_AN_FOLDER + appName + "/" + moduleName; + } + std::string anFile = aotFileName + AOTFileManager::FILE_EXTENSION_AN; + std::string aiFile = aotFileName + AOTFileManager::FILE_EXTENSION_AI; + if (!FileExist(anFile.c_str()) || !FileExist(aiFile.c_str())) { + aotFileName.clear(); + } + return aotFileName; + } +}; +} // namespace panda::ecmascript +#endif \ No newline at end of file diff --git a/ecmascript/stubs/runtime_stubs-inl.h b/ecmascript/stubs/runtime_stubs-inl.h index f40ded12b4..afb265cfc5 100644 --- a/ecmascript/stubs/runtime_stubs-inl.h +++ b/ecmascript/stubs/runtime_stubs-inl.h @@ -2891,7 +2891,7 @@ JSTaggedValue RuntimeStubs::RuntimeOptConstructGeneric(JSThread *thread, JSHandl uint32_t size = preArgsSize + argsCount; CVector values; bool isCompiledCode = ctor->IsCompiledCode(); - if (!thread->IsWorker() && isCompiledCode) { + if (isCompiledCode) { if (ctor->IsCompiledFastCall()) { values.reserve(size + NUM_MANDATORY_JSFUNC_ARGS - 1); values.emplace_back(ctor.GetTaggedValue().GetRawData()); diff --git a/ecmascript/stubs/runtime_stubs.cpp b/ecmascript/stubs/runtime_stubs.cpp index 52076def62..e104957eae 100644 --- a/ecmascript/stubs/runtime_stubs.cpp +++ b/ecmascript/stubs/runtime_stubs.cpp @@ -3497,7 +3497,7 @@ void RuntimeStubs::SaveFrameToContext(JSThread *thread, JSHandleGetCallTarget(); - if (!thread->IsWorker() && func->IsCompiledCode()) { + if (func->IsCompiledCode()) { bool isFastCall = func->IsCompiledFastCall(); // get this flag before clear it uintptr_t entry = isFastCall ? thread->GetRTInterface(kungfu::RuntimeStubCSigns::ID_FastCallToAsmInterBridge) : thread->GetRTInterface(kungfu::RuntimeStubCSigns::ID_AOTCallToAsmInterBridge); -- Gitee