diff --git a/ecmascript/compiler/aot_file/aot_file_manager.cpp b/ecmascript/compiler/aot_file/aot_file_manager.cpp index 6a5580849a739b2f62b6096a0ca5d23417606f84..7a0d08659860257d8c2bc9ebefe40a9da0d96af5 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 4f6e99abba9d1fc57cc88f6f8788b6a5b361f338..3b4b2e18ce087d5dc1af785de2698f368eaa33d7 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 d81b64acbae5b5234e9b9fc31d53c7461aac988f..600124afc8a9ad5d609293476b64dd7ace68beb8 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 cb6ec9034990c442b0e23109c570864d0a0e9ef9..72e9b1782877b3682e052e7e2c18677728665505 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 b413758d8476993219755b2594c68b04bd586e44..5fac3cb2a6918d0db960f0ceb695a7aecfa6c735 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 d2e56150f2c5a5d454435babdb897674b51bd378..c5c1682c6d3c48df5ea65414266de2fd8e228a74 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 68b261cb0a9d155f531cd0b56bc0cd1acead4bd1..53ab6f98257b4f6d3282c8d69daeb0bcff692d24 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 8b3ec4945e23e349610df9e7bfa82d27b13e48f4..95f1c1fdb7fc66fd4074e77093431bc0f7c84aca 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 7499ab40e9c3e94a41510ff7f437ae7c008308e7..c9678b0da1648c328061e8b63345240a785654c9 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 e683919d5e891c44f787a9f68c7fd32b07fdd969..0a841aba19c92f33839cf382b42c4fc1bd09fedd 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 11dab319a47aa54187ce77c2c36e0c33878d018b..ced7f3399d2593517c83cdcc196b51fe423dc77c 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 a12dcc155a7aead492614ef52d9217983d6f025e..ff5a217b997a1294f961a300c840ed7c76a677b7 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 dfcdfaa2bdff5e80348bc87dfae48c21f882a017..19e678bd245b25974819f7765efd7585b426966b 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 32f11fd21003982b34ab9a4dddc7ba507b3c1b7e..ca6545598ae973214ad45998a9a2c809894fdfa4 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 2daf5bde78045e506f2b870e650e98ca7e69af42..2c207bf557460e2091b89fa9cd46096b9b287aa2 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 0000000000000000000000000000000000000000..c94e6d69e484c89350e816d687264250bf31f367 --- /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 f40ded12b476add65857b89416e46c941cdfb4f8..afb265cfc55abf6709da308c9309bda4ad671d6e 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 52076def62e09c19d741ab2ce04ddcc923337e00..e104957eae4fdc04f01a1a56d7ad09e0444e00fa 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);