diff --git a/ecmascript/compiler/baseline/baseline_call_signature.cpp b/ecmascript/compiler/baseline/baseline_call_signature.cpp index 0e760cc3620b3456bdd4ce70ff15ad0a894daf90..8fd78db60df0e73409d09c05c69c103dc6000281 100644 --- a/ecmascript/compiler/baseline/baseline_call_signature.cpp +++ b/ecmascript/compiler/baseline/baseline_call_signature.cpp @@ -852,7 +852,7 @@ DEF_CALL_SIGNATURE(BaselineIstrue) CallSignature signature("BaselineIstrue", 0, 2, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); *callSign = signature; - // 1 : 1 input parameters + // 2 : 2 input parameters std::array params = { VariableType::NATIVE_POINTER(), VariableType::JS_ANY(), @@ -1306,10 +1306,10 @@ DEF_CALL_SIGNATURE(BaselineDefineclasswithbufferImm8Id16Id16Imm16V8) std::array params = { VariableType::NATIVE_POINTER(), VariableType::NATIVE_POINTER(), - VariableType::INT32(), + VariableType::INT16(), + VariableType::INT16(), VariableType::INT16(), VariableType::INT8(), - VariableType::INT32(), }; BASELINE_STUB_CALL_SIGNATURE_COMMON_SET(); } diff --git a/ecmascript/compiler/baseline/baseline_call_signature.h b/ecmascript/compiler/baseline/baseline_call_signature.h index 12e023d14cc7199c968bd27eba35529ae5046e21..5e3d1ea5402bdbfda53287b92802dcfdb096fbbd 100644 --- a/ecmascript/compiler/baseline/baseline_call_signature.h +++ b/ecmascript/compiler/baseline/baseline_call_signature.h @@ -245,7 +245,7 @@ DEFINE_PARAMETER_INDEX(BaselineStthisbyvalueImm16V8, DEFINE_PARAMETER_INDEX(BaselineDynamicimport, GLUE, SP) DEFINE_PARAMETER_INDEX(BaselineDefineclasswithbufferImm8Id16Id16Imm16V8, - GLUE, SP, METHOD_LITERIAL_ID, LENGTH, V0, SLOT_ID) + GLUE, SP, METHOD_ID, LITERRAL_ID, LENGTH, V0) DEFINE_PARAMETER_INDEX(BaselineDefineclasswithbufferImm16Id16Id16Imm16V8, GLUE, SP, METHOD_LITERIAL_ID, COUNT_SUPERCLASS_ID, SLOT_ID) DEFINE_PARAMETER_INDEX(BaselineResumegenerator, diff --git a/ecmascript/compiler/baseline/baseline_compiler.cpp b/ecmascript/compiler/baseline/baseline_compiler.cpp index e505813c3b7aadc4459e0d38e633166a018793e7..fc6c209765b9d8cf569ebb3f265b58de2bac6fc8 100644 --- a/ecmascript/compiler/baseline/baseline_compiler.cpp +++ b/ecmascript/compiler/baseline/baseline_compiler.cpp @@ -2534,7 +2534,6 @@ BYTECODE_BASELINE_HANDLER_IMPLEMENT(DEFINEGETTERSETTERBYVALUE_V8_V8_V8_V8) BYTECODE_BASELINE_HANDLER_IMPLEMENT(DEFINECLASSWITHBUFFER_IMM8_ID16_ID16_IMM16_V8) { - uint8_t slotId = READ_INST_8_0(); int16_t methodId = READ_INST_16_1(); int16_t literalId = READ_INST_16_3(); int16_t count = READ_INST_16_5(); @@ -2548,11 +2547,10 @@ BYTECODE_BASELINE_HANDLER_IMPLEMENT(DEFINECLASSWITHBUFFER_IMM8_ID16_ID16_IMM16_V std::vector parameters; parameters.emplace_back(BaselineSpecialParameter::GLUE); parameters.emplace_back(BaselineSpecialParameter::SP); - uint32_t methodAndLiteralId = static_cast(methodId) | (static_cast(literalId) << TWO_BYTE_SIZE); - parameters.emplace_back(static_cast(methodAndLiteralId)); + parameters.emplace_back(methodId); + parameters.emplace_back(literalId); parameters.emplace_back(count); parameters.emplace_back(v0); - parameters.emplace_back(static_cast(slotId)); GetBaselineAssembler().CallBuiltin(builtinAddress, parameters); GetBaselineAssembler().SaveResultIntoAcc(); } diff --git a/ecmascript/compiler/baseline/baseline_stubs-inl.h b/ecmascript/compiler/baseline/baseline_stubs-inl.h index ad1f1d46131c17d45bfb6b7e7208e5c8eecf81df..cb91e11276a6e301f8c0451cde421c8dcfa18e96 100644 --- a/ecmascript/compiler/baseline/baseline_stubs-inl.h +++ b/ecmascript/compiler/baseline/baseline_stubs-inl.h @@ -17,7 +17,6 @@ #define ECMASCRIPT_COMPILER_BASELINE_BASELINE_STUBS_INL_H #include "ecmascript/compiler/baseline/baseline_stubs.h" -#include "ecmascript/compiler/new_object_stub_builder.h" #include "ecmascript/js_function.h" #include "ecmascript/js_generator_object.h" #include "ecmascript/js_async_generator_object.h" @@ -345,49 +344,6 @@ GateRef BaselineStubBuilder::GetLastLeaveFrame(GateRef glue) GateRef spOffset = IntPtr(JSThread::GlueData::GetLeaveFrameOffset(isArch32)); return LoadPrimitive(VariableType::NATIVE_POINTER(), glue, spOffset); } - -void BaselineStubBuilder::UpdateProfileTypeInfoCellToFunction(GateRef glue, GateRef function, - GateRef profileTypeInfo, GateRef slotId) -{ - auto env = GetEnvironment(); - Label subEntry(env); - env->SubCfgEntry(&subEntry); - - Label profileTypeInfoNotUndefined(env); - Label slotValueUpdate(env); - Label slotValueNotUndefined(env); - Label slotValueNotHole(env); - Label profileTypeInfoEnd(env); - NewObjectStubBuilder newBuilder(this); - BRANCH(TaggedIsUndefined(profileTypeInfo), &profileTypeInfoEnd, &profileTypeInfoNotUndefined); - Bind(&profileTypeInfoNotUndefined); - { - GateRef slotValue = GetValueFromTaggedArray(glue, profileTypeInfo, slotId); - BRANCH_UNLIKELY(TaggedIsUndefined(slotValue), &slotValueUpdate, &slotValueNotUndefined); - Bind(&slotValueUpdate); - { - GateRef newProfileTypeInfoCell = newBuilder.NewProfileTypeInfoCell(glue, Undefined()); - SetValueToTaggedArray(VariableType::JS_ANY(), glue, profileTypeInfo, slotId, newProfileTypeInfoCell, - MemoryAttribute::NeedNotShareBarrier()); - SetRawProfileTypeInfoToFunction(glue, function, newProfileTypeInfoCell, - MemoryAttribute::NeedNotShareBarrier()); - Jump(&profileTypeInfoEnd); - } - Bind(&slotValueNotUndefined); - BRANCH_UNLIKELY(TaggedIsHole(slotValue), &profileTypeInfoEnd, &slotValueNotHole); - Bind(&slotValueNotHole); - { - UpdateProfileTypeInfoCellType(glue, slotValue); - SetRawProfileTypeInfoToFunction(glue, function, slotValue, MemoryAttribute::NeedNotShareBarrier()); - TryToBaselineJitReuseCompiledFunc(glue, function, slotValue); - } - Jump(&profileTypeInfoEnd); - } - Bind(&profileTypeInfoEnd); - - env->SubCfgExit(); -} - } #endif // ECMASCRIPT_COMPILER_BASELINE_BASELINE_STUBS_INL_H diff --git a/ecmascript/compiler/baseline/baseline_stubs.cpp b/ecmascript/compiler/baseline/baseline_stubs.cpp index 5b0e98a7a3d69d5c47b6e70fc80a40fa9b2f487d..7e7aa7e5fe9226e566ec8f19f7b805735ff2a1c3 100644 --- a/ecmascript/compiler/baseline/baseline_stubs.cpp +++ b/ecmascript/compiler/baseline/baseline_stubs.cpp @@ -1530,10 +1530,7 @@ void BaselineDefinefuncImm8Id16Imm8StubBuilder::GenerateCircuit() GateRef currentFunc = GetFunctionFromFrame(glue, frame); SetModuleToFunction(glue, result, GetModuleFromFunction(glue, currentFunc)); SetHomeObjectToFunction(glue, result, GetHomeObjectFromFunction(glue, currentFunc)); -#if ECMASCRIPT_ENABLE_IC - UpdateProfileTypeInfoCellToFunction(glue, result, profileTypeInfo, slotId); callback.ProfileDefineClass(result); -#endif Return(result); } } @@ -1564,10 +1561,7 @@ void BaselineDefinefuncImm16Id16Imm8StubBuilder::GenerateCircuit() GateRef currentFunc = GetFunctionFromFrame(glue, frame); SetModuleToFunction(glue, result, GetModuleFromFunction(glue, currentFunc)); SetHomeObjectToFunction(glue, result, GetHomeObjectFromFunction(glue, currentFunc)); -#if ECMASCRIPT_ENABLE_IC - UpdateProfileTypeInfoCellToFunction(glue, result, profileTypeInfo, slotId); callback.ProfileDefineClass(result); -#endif Return(result); } } @@ -2033,22 +2027,21 @@ void BaselineDefineclasswithbufferImm8Id16Id16Imm16V8StubBuilder::GenerateCircui { GateRef glue = PtrArgument(PARAM_INDEX(BaselineDefineclasswithbufferImm8Id16Id16Imm16V8, GLUE)); GateRef sp = PtrArgument(PARAM_INDEX(BaselineDefineclasswithbufferImm8Id16Id16Imm16V8, SP)); - GateRef methodLiteralId = - Int32Argument(PARAM_INDEX(BaselineDefineclasswithbufferImm8Id16Id16Imm16V8, METHOD_LITERIAL_ID)); + GateRef methodId = Int32Argument(PARAM_INDEX(BaselineDefineclasswithbufferImm8Id16Id16Imm16V8, METHOD_ID)); + GateRef literalId = Int32Argument(PARAM_INDEX(BaselineDefineclasswithbufferImm8Id16Id16Imm16V8, LITERRAL_ID)); GateRef length = Int32Argument(PARAM_INDEX(BaselineDefineclasswithbufferImm8Id16Id16Imm16V8, LENGTH)); GateRef v0 = Int32Argument(PARAM_INDEX(BaselineDefineclasswithbufferImm8Id16Id16Imm16V8, V0)); - GateRef slotId = Int32Argument(PARAM_INDEX(BaselineDefineclasswithbufferImm8Id16Id16Imm16V8, SLOT_ID)); - GateRef methodId = Int32And(methodLiteralId, Int32(TWO_BYTE_ALL_ONE)); - GateRef literalId = Int32And(Int32LSR(methodLiteralId, Int32(TWO_BYTE_SIZE)), Int32(TWO_BYTE_ALL_ONE)); - DEFINE_PROFILE_CALLBACK(glue, sp, slotId); + ProfileOperation callback; GateRef proto = GetVregValue(glue, sp, ZExtInt8ToPtr(v0)); - GateRef method = GetMethodFromFunction(glue, curFunc); + GateRef frame = GetFrame(sp); + GateRef currentFunc = GetFunctionFromFrame(glue, frame); + GateRef method = GetMethodFromFunction(glue, currentFunc); GateRef constpool = GetConstpoolFromMethod(glue, method); auto env = GetEnvironment(); GateRef lexicalEnv = GetEnvFromFrame(glue, frame); - GateRef module = GetModuleFromFunction(glue, curFunc); + GateRef module = GetModuleFromFunction(glue, currentFunc); GateRef res = CallRuntime(glue, RTSTUB_ID(CreateClassWithBuffer), { proto, lexicalEnv, constpool, Int16ToTaggedInt(methodId), @@ -2065,10 +2058,7 @@ void BaselineDefineclasswithbufferImm8Id16Id16Imm16V8StubBuilder::GenerateCircui Return(acc); } Bind(&isNotException); -#if ECMASCRIPT_ENABLE_IC - UpdateProfileTypeInfoCellToFunction(glue, res, profileTypeInfo, slotId); callback.ProfileDefineClass(res); -#endif Return(res); } @@ -2109,10 +2099,7 @@ void BaselineDefineclasswithbufferImm16Id16Id16Imm16V8StubBuilder::GenerateCircu Return(res); } Bind(&isNotException); -#if ECMASCRIPT_ENABLE_IC - UpdateProfileTypeInfoCellToFunction(glue, res, profileTypeInfo, slotId); callback.ProfileDefineClass(res); -#endif Return(res); } @@ -5946,12 +5933,9 @@ void BaselineUpdateHotnessStubBuilder::GenerateCircuit() varHotnessCounter = Int32(EcmaInterpreter::METHOD_HOTNESS_THRESHOLD); Label initialized(env); Label callRuntime(env); - BRANCH(Int8Equal(interruptsFlag, Int8(VmThreadControl::VM_NEED_SUSPENSION)), &callRuntime, &initialized); - Bind(&initialized); - ProfilerStubBuilder profiler(this); - profiler.TryJitCompile(glue, { offset, 0, false }, func, profileTypeInfo); - Jump(&exitLabel); - + BRANCH(BitOr(TaggedIsUndefined(*varProfileTypeInfo), + Int8Equal(interruptsFlag, Int8(VmThreadControl::VM_NEED_SUSPENSION))), + &callRuntime, &initialized); Bind(&callRuntime); varProfileTypeInfo = CallRuntime(glue, RTSTUB_ID(UpdateHotnessCounterWithProf), { func }); @@ -5962,6 +5946,10 @@ void BaselineUpdateHotnessStubBuilder::GenerateCircuit() DISPATCH_LAST(); Return(); } + Bind(&initialized); + ProfilerStubBuilder profiler(this); + profiler.TryJitCompile(glue, { offset, 0, false }, func, profileTypeInfo); + Jump(&exitLabel); } Bind(&exitLabel); SetHotnessCounter(glue, method, *varHotnessCounter); diff --git a/ecmascript/compiler/baseline/baseline_stubs.h b/ecmascript/compiler/baseline/baseline_stubs.h index e9056117eefac7f1051780d806c6afc50934dcf2..59a2b037cd68be1aa357b090ab7e9bd2b58cd665 100644 --- a/ecmascript/compiler/baseline/baseline_stubs.h +++ b/ecmascript/compiler/baseline/baseline_stubs.h @@ -63,8 +63,6 @@ public: inline GateRef GetResumeModeFromAsyncGeneratorObject(GateRef obj); inline GateRef GetLastLeaveFrame(GateRef glue); inline GateRef CallBaselineStub(GateRef glue, int index, const std::initializer_list& args); - inline void UpdateProfileTypeInfoCellToFunction(GateRef glue, GateRef function, - GateRef profileTypeInfo, GateRef slotId); }; #define DECLARE_STUB_CLASS(name) \ diff --git a/ecmascript/compiler/builtins/builtins_function_stub_builder.cpp b/ecmascript/compiler/builtins/builtins_function_stub_builder.cpp index 8e29d8859bc29aa10e9f35973a1969b24c5e1f0c..e4070bd091be1b615390b7a164541ca6c24986ac 100644 --- a/ecmascript/compiler/builtins/builtins_function_stub_builder.cpp +++ b/ecmascript/compiler/builtins/builtins_function_stub_builder.cpp @@ -708,7 +708,6 @@ void BuiltinsFunctionStubBuilder::InitializeFunctionWithMethod(GateRef glue, SetBitFieldToFunction(glue, func, Int32(0)); SetMachineCodeToFunction(glue, func, Undefined(), MemoryAttribute::NoBarrier()); - SetBaselineJitCodeToFunction(glue, func, Undefined(), MemoryAttribute::NoBarrier()); Label isNativeMethod(env); Label checkAotStatus(env); diff --git a/ecmascript/compiler/call_signature.cpp b/ecmascript/compiler/call_signature.cpp index 780f27c774f3a50076937041e5a850f35da00352..faff89b72dbcc7b2d74567d243a7a60e56b143d9 100644 --- a/ecmascript/compiler/call_signature.cpp +++ b/ecmascript/compiler/call_signature.cpp @@ -2156,31 +2156,6 @@ DEF_CALL_SIGNATURE(CallReturnWithArgv) PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(CallReturnWithArgv) } -DEF_CALL_SIGNATURE(CallGetterToBaseline) -{ - PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(CallGetterToBaseline) -} - -DEF_CALL_SIGNATURE(CallSetterToBaseline) -{ - PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(CallSetterToBaseline) -} - -DEF_CALL_SIGNATURE(CallContainersArgs2ToBaseline) -{ - PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(CallContainersArgs2ToBaseline) -} - -DEF_CALL_SIGNATURE(CallContainersArgs3ToBaseline) -{ - PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(CallContainersArgs3ToBaseline) -} - -DEF_CALL_SIGNATURE(CallReturnWithArgvToBaseline) -{ - PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(CallReturnWithArgvToBaseline) -} - DEF_CALL_SIGNATURE(JSCallWithArgV) { // 5 : 5 input parameters diff --git a/ecmascript/compiler/call_signature.h b/ecmascript/compiler/call_signature.h index 09560526d6a673612ae8d9c2f6f0f212d23fdcca..a39c47be8a39ed7f25f24d0fcc1e284311acfb20 100644 --- a/ecmascript/compiler/call_signature.h +++ b/ecmascript/compiler/call_signature.h @@ -509,11 +509,6 @@ private: V(CallSetter) \ V(CallContainersArgs2) \ V(CallContainersArgs3) \ - V(CallGetterToBaseline) \ - V(CallSetterToBaseline) \ - V(CallContainersArgs2ToBaseline) \ - V(CallContainersArgs3ToBaseline) \ - V(CallReturnWithArgvToBaseline) \ V(JSCallWithArgV) \ V(JSFastCallWithArgV) \ V(JSFastCallWithArgVAndPushArgv) \ diff --git a/ecmascript/compiler/call_stub_builder.cpp b/ecmascript/compiler/call_stub_builder.cpp index 989f145d97b45627efb6310d1032e957778c67ca..a6ea8847bcdf61dec5e7c86ad0340027ca88a431 100644 --- a/ecmascript/compiler/call_stub_builder.cpp +++ b/ecmascript/compiler/call_stub_builder.cpp @@ -716,13 +716,16 @@ void CallStubBuilder::JSCallJSFunction(Label *exit, Label *noNeedCheckException) Bind(&funcHasBaselineCode); { GateRef res = result_->Value(); - JSCallAsmInterpreter(true, exit, noNeedCheckException); + JSCallAsmInterpreter(true, &methodNotAot, exit, noNeedCheckException); + if (!isForBaseline_) { + ASSERT(CheckResultValueChangedWithReturn(res)); + } (void) res; } Bind(&methodNotAot); { - JSCallAsmInterpreter(false, exit, noNeedCheckException); + JSCallAsmInterpreter(false, &methodNotAot, exit, noNeedCheckException); } } } @@ -849,7 +852,7 @@ void CallStubBuilder::CallBridge(GateRef code, GateRef expectedNum, Label *exit) Jump(exit); } -void CallStubBuilder::JSCallAsmInterpreter(bool hasBaselineCode, Label *exit, +void CallStubBuilder::JSCallAsmInterpreter(bool hasBaselineCode, Label *methodNotAot, Label *exit, Label *noNeedCheckException) { if (jumpSize_ != 0) { @@ -899,6 +902,8 @@ void CallStubBuilder::JSCallAsmInterpreter(bool hasBaselineCode, Label *exit, case JSCallMode::CALL_THIS_ARGV_WITH_RETURN: if (isForBaseline_) { *result_ = CallNGCRuntime(glue_, idxForAsmInterpreter, argsForAsmInterpreter); + } else if (hasBaselineCode) { + Jump(methodNotAot); } else { *result_ = CallNGCRuntime(glue_, idxForAsmInterpreter, argsForAsmInterpreter, hir_); Jump(exit); @@ -908,6 +913,7 @@ void CallStubBuilder::JSCallAsmInterpreter(bool hasBaselineCode, Label *exit, LOG_ECMA(FATAL) << "this branch is unreachable"; UNREACHABLE(); } + if (isForBaseline_) { if (noNeedCheckException != nullptr) { Jump(noNeedCheckException); @@ -1460,15 +1466,15 @@ int CallStubBuilder::PrepareIdxForAsmInterpreterForBaselineWithBaselineCode() case JSCallMode::SUPER_CALL_SPREAD_WITH_ARGV: return RTSTUB_ID(SuperCallAndCheckToBaselineFromBaseline); case JSCallMode::CALL_GETTER: - return RTSTUB_ID(CallGetterToBaseline); + return RTSTUB_ID(CallGetter); case JSCallMode::CALL_SETTER: - return RTSTUB_ID(CallSetterToBaseline); + return RTSTUB_ID(CallSetter); case JSCallMode::CALL_THIS_ARG2_WITH_RETURN: - return RTSTUB_ID(CallContainersArgs2ToBaseline); + return RTSTUB_ID(CallContainersArgs2); case JSCallMode::CALL_THIS_ARG3_WITH_RETURN: - return RTSTUB_ID(CallContainersArgs3ToBaseline); + return RTSTUB_ID(CallContainersArgs3); case JSCallMode::CALL_THIS_ARGV_WITH_RETURN: - return RTSTUB_ID(CallReturnWithArgvToBaseline); + return RTSTUB_ID(CallReturnWithArgv); default: LOG_ECMA(FATAL) << "this branch is unreachable"; UNREACHABLE(); @@ -1562,15 +1568,15 @@ int CallStubBuilder::PrepareIdxForAsmInterpreterWithBaselineCode() case JSCallMode::SUPER_CALL_SPREAD_WITH_ARGV: return RTSTUB_ID(SuperCallAndCheckToBaseline); case JSCallMode::CALL_GETTER: - return RTSTUB_ID(CallGetterToBaseline); + return RTSTUB_ID(CallGetter); case JSCallMode::CALL_SETTER: - return RTSTUB_ID(CallSetterToBaseline); + return RTSTUB_ID(CallSetter); case JSCallMode::CALL_THIS_ARG2_WITH_RETURN: - return RTSTUB_ID(CallContainersArgs2ToBaseline); + return RTSTUB_ID(CallContainersArgs2); case JSCallMode::CALL_THIS_ARG3_WITH_RETURN: - return RTSTUB_ID(CallContainersArgs3ToBaseline); + return RTSTUB_ID(CallContainersArgs3); case JSCallMode::CALL_THIS_ARGV_WITH_RETURN: - return RTSTUB_ID(CallReturnWithArgvToBaseline); + return RTSTUB_ID(CallReturnWithArgv); default: LOG_ECMA(FATAL) << "this branch is unreachable"; UNREACHABLE(); diff --git a/ecmascript/compiler/call_stub_builder.h b/ecmascript/compiler/call_stub_builder.h index b99e48736b20280ef217c80f4f598d90f0285163..312b26ee707d230f7a981b9297d7a5c391c9e7b3 100644 --- a/ecmascript/compiler/call_stub_builder.h +++ b/ecmascript/compiler/call_stub_builder.h @@ -220,7 +220,7 @@ private: void JSSlowAotCall(Label *exit); GateRef CallConstructorBridge(const int idxForAot, const std::vector &argsForAot); void CallBridge(GateRef code, GateRef expectedNum, Label *exit); - void JSCallAsmInterpreter(bool hasBaselineCode, Label *exit, Label *noNeedCheckException); + void JSCallAsmInterpreter(bool hasBaselineCode, Label *methodNotAot, Label *exit, Label *noNeedCheckException); int PrepareIdxForNative(); std::vector PrepareArgsForNative(); diff --git a/ecmascript/compiler/new_object_stub_builder.cpp b/ecmascript/compiler/new_object_stub_builder.cpp index 3f7c55329ac37c95a31018acbbe2773490618406..62b62f8ab2f5899f61600c54040895a5a7c73301 100644 --- a/ecmascript/compiler/new_object_stub_builder.cpp +++ b/ecmascript/compiler/new_object_stub_builder.cpp @@ -636,7 +636,6 @@ GateRef NewObjectStubBuilder::DefineFuncForJit(GateRef glue, GateRef method, Gat SetMethodToFunction(glue, func, method); SetBitFieldToFunction(glue, func, Int32(0), MemoryAttribute::NoBarrier()); SetMachineCodeToFunction(glue, func, Undefined(), MemoryAttribute::NoBarrier()); - SetBaselineJitCodeToFunction(glue, func, Undefined(), MemoryAttribute::NoBarrier()); SetCodeEntryToFunctionFromMethod(glue, func, method); Jump(&exit); Bind(&exit); @@ -2871,8 +2870,6 @@ GateRef NewObjectStubBuilder::NewProfileTypeInfoCell(GateRef glue, GateRef value SetValueToProfileTypeInfoCell(glue, *result, value); GateRef machineCodeOffset = IntPtr(ProfileTypeInfoCell::MACHINE_CODE_OFFSET); Store(VariableType::JS_POINTER(), glue, *result, machineCodeOffset, Hole()); - GateRef baselineCodeOffset = IntPtr(ProfileTypeInfoCell::BASELINE_CODE_OFFSET); - Store(VariableType::JS_POINTER(), glue, *result, baselineCodeOffset, Hole()); GateRef handleOffset = IntPtr(ProfileTypeInfoCell::HANDLE_OFFSET); Store(VariableType::JS_POINTER(), glue, *result, handleOffset, Undefined()); diff --git a/ecmascript/compiler/profiler_stub_builder.h b/ecmascript/compiler/profiler_stub_builder.h index 266ad710b873d89257bccf5e4255be1ff476b99a..e02ba7aaf6a3140dd01e78bfe9bef92380e46bfd 100644 --- a/ecmascript/compiler/profiler_stub_builder.h +++ b/ecmascript/compiler/profiler_stub_builder.h @@ -125,7 +125,6 @@ public: GateRef pc); GateRef IsCompiledOrTryCompile(GateRef glue, GateRef func, GateRef profileTypeInfo, GateRef pc); GateRef GetJitHotnessThreshold(GateRef profileTypeInfo); - GateRef GetBaselineJitHotnessThreshold(GateRef profileTypeInfo); void SetJitHotnessCnt(GateRef glue, GateRef profileTypeInfo, GateRef hotnessCnt); private: @@ -156,6 +155,7 @@ private: GateRef GetOsrHotnessThresholdOffset(GateRef profileTypeInfo); GateRef GetOsrHotnessThreshold(GateRef profileTypeInfo); GateRef GetBaselineJitHotnessThresholdOffset(GateRef profileTypeInfo); + GateRef GetBaselineJitHotnessThreshold(GateRef profileTypeInfo); GateRef GetOsrHotnessCntOffset(GateRef profileTypeInfo); GateRef GetOsrHotnessCnt(GateRef profileTypeInfo); void PGOProfiler(GateRef glue, GateRef func, GateRef profileTypeInfo, SlotIDInfo slotIdInfo, diff --git a/ecmascript/compiler/stub_builder-inl.h b/ecmascript/compiler/stub_builder-inl.h index 90bf40f9f4e4fb56e07263499f889d9c49a12984..6792a617fc7149d4c64cc25821f8d85d97bbcdb2 100644 --- a/ecmascript/compiler/stub_builder-inl.h +++ b/ecmascript/compiler/stub_builder-inl.h @@ -3670,13 +3670,6 @@ inline void StubBuilder::SetMachineCodeToFunction(GateRef glue, GateRef function Store(VariableType::JS_ANY(), glue, function, offset, value, mAttr); } -inline void StubBuilder::SetBaselineJitCodeToFunction(GateRef glue, GateRef function, GateRef value, - MemoryAttribute mAttr) -{ - GateRef offset = IntPtr(JSFunction::BASELINECODE_OFFSET); - Store(VariableType::JS_ANY(), glue, function, offset, value, mAttr); -} - inline GateRef StubBuilder::GetGlobalEnv(GateRef glue) { return env_->GetBuilder()->GetGlobalEnv(glue); diff --git a/ecmascript/compiler/stub_builder.cpp b/ecmascript/compiler/stub_builder.cpp index 048c22a6ca8a76c9b535932cf7fe7d834d53eb00..8fa490ea38750d37b0c9d5c251109e479b0fe10e 100644 --- a/ecmascript/compiler/stub_builder.cpp +++ b/ecmascript/compiler/stub_builder.cpp @@ -12592,49 +12592,6 @@ void StubBuilder::TryToJitReuseCompiledFunc(GateRef glue, GateRef jsFunc, GateRe env_->SubCfgExit(); } -// Used for baselinejit machine code reusing of inner functions have the same method to improve performance. -void StubBuilder::TryToBaselineJitReuseCompiledFunc(GateRef glue, GateRef jsFunc, GateRef profileTypeInfoCell) -{ - Label subEntry(env_); - env_->SubCfgEntry(&subEntry); - - Label machineCodeIsNotHole(env_); - Label exitPoint(env_); - Label hasNotDisable(env_); - GateRef weakMachineCode = Load(VariableType::JS_ANY(), glue, profileTypeInfoCell, - IntPtr(ProfileTypeInfoCell::BASELINE_CODE_OFFSET)); - BRANCH(TaggedIsHole(weakMachineCode), &exitPoint, &machineCodeIsNotHole); - Bind(&machineCodeIsNotHole); - { - GateRef profileTypeInfo = Load(VariableType::JS_ANY(), glue, profileTypeInfoCell, - IntPtr(ProfileTypeInfoCell::VALUE_OFFSET)); - GateRef baselineJitHotnessThreshold = ProfilerStubBuilder(env_).GetBaselineJitHotnessThreshold(profileTypeInfo); - BRANCH(Int32Equal(baselineJitHotnessThreshold, Int32(ProfileTypeInfo::JIT_DISABLE_FLAG)), - &exitPoint, &hasNotDisable); - Bind(&hasNotDisable); - { - Label machineCodeIsUndefine(env_); - Label machineCodeIsNotUndefine(env_); - BRANCH(TaggedIsUndefined(weakMachineCode), &machineCodeIsUndefine, &machineCodeIsNotUndefine); - Bind(&machineCodeIsUndefine); - { - ProfilerStubBuilder(env_).SetJitHotnessCnt(glue, profileTypeInfo, Int16(0)); - Store(VariableType::JS_POINTER(), glue, profileTypeInfoCell, - IntPtr(ProfileTypeInfoCell::BASELINE_CODE_OFFSET), Hole()); - Jump(&exitPoint); - } - Bind(&machineCodeIsNotUndefine); - { - GateRef machineCode = TaggedCastToIntPtr(RemoveTaggedWeakTag(weakMachineCode)); - SetBaselineJitCodeToFunction(glue, jsFunc, machineCode); - Jump(&exitPoint); - } - } - } - Bind(&exitPoint); - env_->SubCfgExit(); -} - GateRef StubBuilder::GetArgumentsElements(GateRef glue, GateRef argvTaggedArray, GateRef argv) { auto env = GetEnvironment(); diff --git a/ecmascript/compiler/stub_builder.h b/ecmascript/compiler/stub_builder.h index a909b492ca9d3d7ddb2f7f7a2846928b78b7300f..a90c86d3ce8668c5390d0f9fe308a0b3b9edf6c2 100644 --- a/ecmascript/compiler/stub_builder.h +++ b/ecmascript/compiler/stub_builder.h @@ -943,8 +943,6 @@ public: MemoryAttribute mAttr = MemoryAttribute::Default()); void SetMachineCodeToFunction(GateRef glue, GateRef function, GateRef value, MemoryAttribute mAttr = MemoryAttribute::Default()); - void SetBaselineJitCodeToFunction(GateRef glue, GateRef function, GateRef value, - MemoryAttribute mAttr = MemoryAttribute::Default()); void SetTypedArrayName(GateRef glue, GateRef typedArray, GateRef name, MemoryAttribute mAttr = MemoryAttribute::Default()); void SetContentType(GateRef glue, GateRef typedArray, GateRef type); @@ -1252,7 +1250,6 @@ public: GateRef LoadModuleNamespaceByIndex(GateRef glue, GateRef index, GateRef module); GateRef GetArgumentsElements(GateRef glue, GateRef argvTaggedArray, GateRef argv); void TryToJitReuseCompiledFunc(GateRef glue, GateRef jsFunc, GateRef profileTypeInfoCell); - void TryToBaselineJitReuseCompiledFunc(GateRef glue, GateRef jsFunc, GateRef profileTypeInfoCell); void StartTraceLoadDetail(GateRef glue, GateRef receiver, GateRef profileTypeInfo, GateRef slotId); void StartTraceLoadGetter(GateRef glue); void StartTraceLoadSlowPath(GateRef glue); diff --git a/ecmascript/compiler/trampoline/aarch64/asm_interpreter_call.cpp b/ecmascript/compiler/trampoline/aarch64/asm_interpreter_call.cpp index 0a38a55fb023e6143affaa76910277bbd0d9ad5a..ff7358cd2f83ba3dc76245b425b7c13ff9763492 100644 --- a/ecmascript/compiler/trampoline/aarch64/asm_interpreter_call.cpp +++ b/ecmascript/compiler/trampoline/aarch64/asm_interpreter_call.cpp @@ -1109,95 +1109,6 @@ void AsmInterpreterCall::CallReturnWithArgv(ExtendedAssembler *assembler) } } -// c++ calling convention -// X0 - glue -// X1 - callTarget -// X2 - method -// X3 - callField -// X4 - receiver -// X5 - value -void AsmInterpreterCall::CallGetterToBaseline(ExtendedAssembler *assembler) -{ - __ BindAssemblerStub(RTSTUB_ID(CallGetterToBaseline)); - Label target; - - PushAsmInterpBridgeFrame(assembler); - __ Bl(&target); - PopAsmInterpBridgeFrame(assembler); - __ Ret(); - __ Bind(&target); - { - JSCallCommonEntry(assembler, JSCallMode::CALL_GETTER, FrameTransitionType::OTHER_TO_BASELINE_CHECK); - } -} - -void AsmInterpreterCall::CallSetterToBaseline(ExtendedAssembler *assembler) -{ - __ BindAssemblerStub(RTSTUB_ID(CallSetterToBaseline)); - Label target; - PushAsmInterpBridgeFrame(assembler); - __ Bl(&target); - PopAsmInterpBridgeFrame(assembler); - __ Ret(); - __ Bind(&target); - { - JSCallCommonEntry(assembler, JSCallMode::CALL_SETTER, FrameTransitionType::OTHER_TO_BASELINE_CHECK); - } -} - -void AsmInterpreterCall::CallContainersArgs2ToBaseline(ExtendedAssembler *assembler) -{ - __ BindAssemblerStub(RTSTUB_ID(CallContainersArgs2ToBaseline)); - Label target; - PushAsmInterpBridgeFrame(assembler); - __ Bl(&target); - PopAsmInterpBridgeFrame(assembler); - __ Ret(); - __ Bind(&target); - { - JSCallCommonEntry(assembler, JSCallMode::CALL_THIS_ARG2_WITH_RETURN, - FrameTransitionType::OTHER_TO_BASELINE_CHECK); - } -} - -void AsmInterpreterCall::CallContainersArgs3ToBaseline(ExtendedAssembler *assembler) -{ - __ BindAssemblerStub(RTSTUB_ID(CallContainersArgs3ToBaseline)); - Label target; - PushAsmInterpBridgeFrame(assembler); - __ Bl(&target); - PopAsmInterpBridgeFrame(assembler); - __ Ret(); - __ Bind(&target); - { - JSCallCommonEntry(assembler, JSCallMode::CALL_THIS_ARG3_WITH_RETURN, - FrameTransitionType::OTHER_TO_BASELINE_CHECK); - } -} - -// c++ calling convention -// X0 - glue -// X1 - callTarget -// X2 - method -// X3 - callField -// X4 - arg0(argc) -// X5 - arg1(arglist) -// X6 - arg3(argthis) -void AsmInterpreterCall::CallReturnWithArgvToBaseline(ExtendedAssembler *assembler) -{ - __ BindAssemblerStub(RTSTUB_ID(CallReturnWithArgvToBaseline)); - Label target; - PushAsmInterpBridgeFrame(assembler); - __ Bl(&target); - PopAsmInterpBridgeFrame(assembler); - __ Ret(); - __ Bind(&target); - { - JSCallCommonEntry(assembler, JSCallMode::CALL_THIS_ARGV_WITH_RETURN, - FrameTransitionType::OTHER_TO_OTHER); - } -} - // preserve all the general registers, except x15 and callee saved registers/ // and call x15 void AsmInterpreterCall::PreserveMostCall(ExtendedAssembler* assembler) diff --git a/ecmascript/compiler/trampoline/aarch64/common_call.h b/ecmascript/compiler/trampoline/aarch64/common_call.h index 923fb9d8383ba3d04f508e3454f8a922f1b17584..2bb07bff4cc4620aa2c5485f9f29e4b00a644120 100644 --- a/ecmascript/compiler/trampoline/aarch64/common_call.h +++ b/ecmascript/compiler/trampoline/aarch64/common_call.h @@ -215,16 +215,6 @@ public: static void CallReturnWithArgv([[maybe_unused]]ExtendedAssembler *assembler); - static void CallGetterToBaseline(ExtendedAssembler *assembler); - - static void CallSetterToBaseline(ExtendedAssembler *assembler); - - static void CallContainersArgs2ToBaseline(ExtendedAssembler *assembler); - - static void CallContainersArgs3ToBaseline(ExtendedAssembler *assembler); - - static void CallReturnWithArgvToBaseline(ExtendedAssembler *assembler); - static void ASMFastWriteBarrier(ExtendedAssembler *assembler); static void ASMFastSharedWriteBarrier(ExtendedAssembler *assembler, Label& needCall); diff --git a/ecmascript/compiler/trampoline/x64/asm_interpreter_call.cpp b/ecmascript/compiler/trampoline/x64/asm_interpreter_call.cpp index 2df550b9d0421d13b259f52a5d00e83e4e4a8b80..aece3f6475eb9fa13817e751954e9bd12a01cb7d 100644 --- a/ecmascript/compiler/trampoline/x64/asm_interpreter_call.cpp +++ b/ecmascript/compiler/trampoline/x64/asm_interpreter_call.cpp @@ -1236,94 +1236,6 @@ void AsmInterpreterCall::CallContainersArgs3(ExtendedAssembler *assembler) } } -// c++ calling convention -// %rdi - glue -// %rsi - callTarget -// %rdx - method -// %rcx - callField -// %r8 - receiver -// %r9 - value -void AsmInterpreterCall::CallGetterToBaseline(ExtendedAssembler *assembler) -{ - __ BindAssemblerStub(RTSTUB_ID(CallGetterToBaseline)); - Label target; - - PushAsmInterpBridgeFrame(assembler); - __ Callq(&target); - PopAsmInterpBridgeFrame(assembler); - __ Ret(); - __ Bind(&target); - JSCallCommonEntry(assembler, JSCallMode::CALL_GETTER, FrameTransitionType::OTHER_TO_BASELINE_CHECK); -} - -void AsmInterpreterCall::CallSetterToBaseline(ExtendedAssembler *assembler) -{ - __ BindAssemblerStub(RTSTUB_ID(CallSetterToBaseline)); - Label target; - PushAsmInterpBridgeFrame(assembler); - __ Callq(&target); - PopAsmInterpBridgeFrame(assembler); - __ Ret(); - __ Bind(&target); - JSCallCommonEntry(assembler, JSCallMode::CALL_SETTER, FrameTransitionType::OTHER_TO_BASELINE_CHECK); -} - -// Input: glue - %rdi -// callTarget - %rsi -// method - %rdx -// callField - %rcx -// arg0(argc) - %r8 -// arg1(arglist) - %r9 -// argthis - stack -void AsmInterpreterCall::CallReturnWithArgvToBaseline(ExtendedAssembler *assembler) -{ - __ BindAssemblerStub(RTSTUB_ID(CallReturnWithArgvToBaseline)); - Label target; - PushAsmInterpBridgeFrame(assembler); - Register r13 = __ CppJSCallAvailableRegister1(); - __ Movq(Operand(rbp, FRAME_SLOT_SIZE), r13); - __ Callq(&target); - PopAsmInterpBridgeFrame(assembler); - __ Ret(); - __ Bind(&target); - { - JSCallCommonEntry(assembler, JSCallMode::CALL_THIS_ARGV_WITH_RETURN, - FrameTransitionType::OTHER_TO_BASELINE_CHECK); - } -} - -void AsmInterpreterCall::CallContainersArgs2ToBaseline(ExtendedAssembler *assembler) -{ - __ BindAssemblerStub(RTSTUB_ID(CallContainersArgs2ToBaseline)); - Label target; - PushAsmInterpBridgeFrame(assembler); - GetArgvAtStack(assembler); - __ Callq(&target); - PopAsmInterpBridgeFrame(assembler); - __ Ret(); - __ Bind(&target); - { - JSCallCommonEntry(assembler, JSCallMode::CALL_THIS_ARG2_WITH_RETURN, - FrameTransitionType::OTHER_TO_BASELINE_CHECK); - } -} - -void AsmInterpreterCall::CallContainersArgs3ToBaseline(ExtendedAssembler *assembler) -{ - __ BindAssemblerStub(RTSTUB_ID(CallContainersArgs3ToBaseline)); - Label target; - PushAsmInterpBridgeFrame(assembler); - GetArgvAtStack(assembler); - __ Callq(&target); - PopAsmInterpBridgeFrame(assembler); - __ Ret(); - __ Bind(&target); - { - JSCallCommonEntry(assembler, JSCallMode::CALL_THIS_ARG3_WITH_RETURN, - FrameTransitionType::OTHER_TO_BASELINE_CHECK); - } -} - // ResumeRspAndReturn(uintptr_t acc) // GHC calling convention // %r13 - acc diff --git a/ecmascript/compiler/trampoline/x64/common_call.h b/ecmascript/compiler/trampoline/x64/common_call.h index 832777454af21d42c66e31f6bed2fb2b9c5e460e..2143c13bc87333f60ae05d5ea9a8ea03bb28f8f7 100644 --- a/ecmascript/compiler/trampoline/x64/common_call.h +++ b/ecmascript/compiler/trampoline/x64/common_call.h @@ -178,16 +178,6 @@ public: static void CallReturnWithArgv(ExtendedAssembler *assembler); - static void CallGetterToBaseline(ExtendedAssembler *assembler); - - static void CallSetterToBaseline(ExtendedAssembler *assembler); - - static void CallContainersArgs2ToBaseline(ExtendedAssembler *assembler); - - static void CallContainersArgs3ToBaseline(ExtendedAssembler *assembler); - - static void CallReturnWithArgvToBaseline(ExtendedAssembler *assembler); - static void ResumeCaughtFrameAndDispatch(ExtendedAssembler *assembler); static void ResumeUncaughtFrameAndReturn(ExtendedAssembler *assembler); diff --git a/ecmascript/dfx/hprof/tests/js_metadata_test.cpp b/ecmascript/dfx/hprof/tests/js_metadata_test.cpp index b5955cbbc697f38c9f702ca18c504ed452ab73c4..fbfe726b5e4ab156256d7a34862885601a2bd5ed 100644 --- a/ecmascript/dfx/hprof/tests/js_metadata_test.cpp +++ b/ecmascript/dfx/hprof/tests/js_metadata_test.cpp @@ -365,12 +365,9 @@ public: {JSType::NATIVE_MODULE_FAILURE_INFO, {"ArkNativeModuleFailureInfo", "NATIVE_MODULE_FAILURE_INFO"}}, {JSType::PENDING_JOB, {"Job", "Arguments", "PENDING_JOB"}}, {JSType::PROFILE_TYPE_INFO, {"PROFILE_TYPE_INFO"}}, - {JSType::PROFILE_TYPE_INFO_CELL_0, {"Value", "MachineCode", "BaselineCode", "Handle", - "PROFILE_TYPE_INFO_CELL_0"}}, - {JSType::PROFILE_TYPE_INFO_CELL_1, {"Value", "MachineCode", "BaselineCode", "Handle", - "PROFILE_TYPE_INFO_CELL_1"}}, - {JSType::PROFILE_TYPE_INFO_CELL_N, {"Value", "MachineCode", "BaselineCode", "Handle", - "PROFILE_TYPE_INFO_CELL_N"}}, + {JSType::PROFILE_TYPE_INFO_CELL_0, {"Value", "MachineCode", "Handle", "PROFILE_TYPE_INFO_CELL_0"}}, + {JSType::PROFILE_TYPE_INFO_CELL_1, {"Value", "MachineCode", "Handle", "PROFILE_TYPE_INFO_CELL_1"}}, + {JSType::PROFILE_TYPE_INFO_CELL_N, {"Value", "MachineCode", "Handle", "PROFILE_TYPE_INFO_CELL_N"}}, {JSType::PROGRAM, {"MainFunction", "PROGRAM"}}, {JSType::PROMISE_CAPABILITY, {"Promise", "Resolve", "Reject", "PROMISE_CAPABILITY"}}, {JSType::PROMISE_ITERATOR_RECORD, {"Iterator", "PROMISE_ITERATOR_RECORD"}}, @@ -932,19 +929,16 @@ public: {JSType::PROFILE_TYPE_INFO_CELL_0, { ProfileTypeInfoCell::VALUE_OFFSET, ProfileTypeInfoCell::MACHINE_CODE_OFFSET, - ProfileTypeInfoCell::BASELINE_CODE_OFFSET, ProfileTypeInfoCell::HANDLE_OFFSET, ProfileTypeInfoCell::LAST_OFFSET - ProfileTypeInfoCell::VALUE_OFFSET}}, {JSType::PROFILE_TYPE_INFO_CELL_1, { ProfileTypeInfoCell::VALUE_OFFSET, ProfileTypeInfoCell::MACHINE_CODE_OFFSET, - ProfileTypeInfoCell::BASELINE_CODE_OFFSET, ProfileTypeInfoCell::HANDLE_OFFSET, ProfileTypeInfoCell::LAST_OFFSET - ProfileTypeInfoCell::VALUE_OFFSET}}, {JSType::PROFILE_TYPE_INFO_CELL_N, { ProfileTypeInfoCell::VALUE_OFFSET, ProfileTypeInfoCell::MACHINE_CODE_OFFSET, - ProfileTypeInfoCell::BASELINE_CODE_OFFSET, ProfileTypeInfoCell::HANDLE_OFFSET, ProfileTypeInfoCell::LAST_OFFSET - ProfileTypeInfoCell::VALUE_OFFSET}}, {JSType::PROGRAM, {Program::MAIN_FUNCTION_OFFSET, Program::SIZE - Program::MAIN_FUNCTION_OFFSET}}, @@ -1675,18 +1669,15 @@ public: {JSType::PROFILE_TYPE_INFO, {}}, {JSType::PROFILE_TYPE_INFO_CELL_0, { ProfileTypeInfoCell::MACHINE_CODE_OFFSET - ProfileTypeInfoCell::VALUE_OFFSET, - ProfileTypeInfoCell::BASELINE_CODE_OFFSET - ProfileTypeInfoCell::MACHINE_CODE_OFFSET, - ProfileTypeInfoCell::HANDLE_OFFSET - ProfileTypeInfoCell::BASELINE_CODE_OFFSET, + ProfileTypeInfoCell::HANDLE_OFFSET - ProfileTypeInfoCell::MACHINE_CODE_OFFSET, ProfileTypeInfoCell::LAST_OFFSET - ProfileTypeInfoCell::HANDLE_OFFSET}}, {JSType::PROFILE_TYPE_INFO_CELL_1, { ProfileTypeInfoCell::MACHINE_CODE_OFFSET - ProfileTypeInfoCell::VALUE_OFFSET, - ProfileTypeInfoCell::BASELINE_CODE_OFFSET - ProfileTypeInfoCell::MACHINE_CODE_OFFSET, - ProfileTypeInfoCell::HANDLE_OFFSET - ProfileTypeInfoCell::BASELINE_CODE_OFFSET, + ProfileTypeInfoCell::HANDLE_OFFSET - ProfileTypeInfoCell::MACHINE_CODE_OFFSET, ProfileTypeInfoCell::LAST_OFFSET - ProfileTypeInfoCell::HANDLE_OFFSET}}, {JSType::PROFILE_TYPE_INFO_CELL_N, { ProfileTypeInfoCell::MACHINE_CODE_OFFSET - ProfileTypeInfoCell::VALUE_OFFSET, - ProfileTypeInfoCell::BASELINE_CODE_OFFSET - ProfileTypeInfoCell::MACHINE_CODE_OFFSET, - ProfileTypeInfoCell::HANDLE_OFFSET - ProfileTypeInfoCell::BASELINE_CODE_OFFSET, + ProfileTypeInfoCell::HANDLE_OFFSET - ProfileTypeInfoCell::MACHINE_CODE_OFFSET, ProfileTypeInfoCell::LAST_OFFSET - ProfileTypeInfoCell::HANDLE_OFFSET}}, {JSType::PROGRAM, {Program::SIZE - Program::MAIN_FUNCTION_OFFSET}}, {JSType::PROMISE_CAPABILITY, { diff --git a/ecmascript/frames.cpp b/ecmascript/frames.cpp index 7d1d89d628f8bc071ec929f3b7c8476348a2b891..9c952c9ca4bc8e458a7c329ea166542e3c0163b9 100644 --- a/ecmascript/frames.cpp +++ b/ecmascript/frames.cpp @@ -17,7 +17,6 @@ #include "ecmascript/dfx/stackinfo/js_stackinfo.h" #include "ecmascript/stackmap/ark_stackmap_parser.h" -#include "ecmascript/stubs/runtime_stubs-inl.h" namespace panda::ecmascript { FrameIterator::FrameIterator(JSTaggedType *sp, const JSThread *thread) : current_(sp), thread_(thread) @@ -26,10 +25,6 @@ FrameIterator::FrameIterator(JSTaggedType *sp, const JSThread *thread) : current arkStackMapParser_ = const_cast(thread)->GetEcmaVM()->GetAOTFileManager()->GetStackMapParser(); } - if ((current_ != nullptr) && (GetFrameType() == FrameType::BASELINE_BUILTIN_FRAME)) { - auto frame = GetFrame(); - baselineNativePc_ = frame->GetReturnAddr(); - } } int FrameIterator::ComputeDelta(const Method *method) const @@ -176,7 +171,6 @@ void FrameIterator::Advance() optimizedCallSiteSp_ = 0; optimizedReturnAddr_ = 0; } - baselineNativePc_ = frame->GetReturnAddr(); current_ = frame->GetPrevFrameFp(); break; } @@ -548,19 +542,6 @@ uintptr_t FrameIterator::GetPrevFrameCallSiteSp() const return 0; } -uint32_t FrameIterator::GetBaselineBytecodeOffset() const -{ - ASSERT(baselineNativePc_ != 0); - LOG_BASELINEJIT(DEBUG) << "current native pc in UpFrame: " << std::hex << - reinterpret_cast(baselineNativePc_); - auto *frame = this->GetFrame(); - JSHandle funcVal = JSHandle(thread_, frame->function); - JSHandle func = JSHandle::Cast(funcVal); - uint32_t curBytecodePcOfst = RuntimeStubs::RuntimeGetBytecodePcOfstForBaseline( - const_cast(thread_), func, baselineNativePc_); - return curBytecodePcOfst; -} - uint32_t FrameIterator::GetBytecodeOffset() const { FrameType type = this->GetFrameType(); @@ -568,15 +549,9 @@ uint32_t FrameIterator::GetBytecodeOffset() const case FrameType::ASM_INTERPRETER_FRAME: case FrameType::INTERPRETER_CONSTRUCTOR_FRAME: { auto *frame = this->GetFrame(); - auto pc = frame->GetPc(); - if (reinterpret_cast(pc) == std::numeric_limits::max()) { - // for baselinejit - return GetBaselineBytecodeOffset(); - } else { - Method *method = ECMAObject::Cast(frame->function.GetTaggedObject())->GetCallTarget(thread_); - auto offset = pc - method->GetBytecodeArray(); - return static_cast(offset); - } + Method *method = ECMAObject::Cast(frame->function.GetTaggedObject())->GetCallTarget(thread_); + auto offset = frame->GetPc() - method->GetBytecodeArray(); + return static_cast(offset); } case FrameType::INTERPRETER_FRAME: case FrameType::INTERPRETER_FAST_NEW_FRAME: { diff --git a/ecmascript/frames.h b/ecmascript/frames.h index 0801b2cddab9a1d3fd888b802eb34e1f2351f9d5..d56d2b594958b56f7804d8e4beb9a86db183adff 100644 --- a/ecmascript/frames.h +++ b/ecmascript/frames.h @@ -2190,8 +2190,6 @@ public: } private: - uint32_t GetBaselineBytecodeOffset() const; - JSTaggedType *current_ {nullptr}; const JSThread *thread_ {nullptr}; const kungfu::ArkStackMapParser *arkStackMapParser_ {nullptr}; @@ -2206,7 +2204,6 @@ private: // cache current machine code, it's nonmovable JSTaggedType machineCode_ {JSTaggedValue::VALUE_UNDEFINED}; - uintptr_t baselineNativePc_ {0}; // For baselineJit upFrame }; } // namespace panda::ecmascript #endif // ECMASCRIPT_FRAMES_H diff --git a/ecmascript/ic/profile_type_info_cell.h b/ecmascript/ic/profile_type_info_cell.h index 93ef845de473ad9e4b788ca7b3c3f2f4c6229bda..160e9c81e868271a4bc403ca0261a7379b1540dd 100644 --- a/ecmascript/ic/profile_type_info_cell.h +++ b/ecmascript/ic/profile_type_info_cell.h @@ -33,8 +33,7 @@ public: static constexpr size_t VALUE_OFFSET = TaggedObjectSize(); ACCESSORS(Value, VALUE_OFFSET, MACHINE_CODE_OFFSET); - ACCESSORS(MachineCode, MACHINE_CODE_OFFSET, BASELINE_CODE_OFFSET); - ACCESSORS(BaselineCode, BASELINE_CODE_OFFSET, HANDLE_OFFSET); + ACCESSORS(MachineCode, MACHINE_CODE_OFFSET, HANDLE_OFFSET); ACCESSORS(Handle, HANDLE_OFFSET, LAST_OFFSET); DEFINE_ALIGN_SIZE(LAST_OFFSET); diff --git a/ecmascript/interpreter/frame_handler.cpp b/ecmascript/interpreter/frame_handler.cpp index 0025a658e11b9a26e09b2937694c1c230b307a0a..a30b62979cef42e9c29e774f62e97ed81f09d046 100644 --- a/ecmascript/interpreter/frame_handler.cpp +++ b/ecmascript/interpreter/frame_handler.cpp @@ -17,7 +17,6 @@ #include "ecmascript/interpreter/frame_handler.h" #include "ecmascript/jspandafile/program_object.h" -#include "ecmascript/stubs/runtime_stubs-inl.h" namespace panda::ecmascript { FrameHandler::FrameHandler(JSThread *thread) @@ -132,23 +131,9 @@ JSTaggedValue FrameHandler::GetAcc() const uint32_t FrameHandler::GetBytecodeOffset() const { ASSERT(IsInterpretedFrame()); - auto pc = GetPc(); - if (reinterpret_cast(pc) != std::numeric_limits::max()) { - // interpreter frame - Method *method = GetMethod(); - auto offset = pc - method->GetBytecodeArray(); - return static_cast(offset); - } else { - // baseline frame - uintptr_t curNativePc = GetBaselineNativePc(); - ASSERT(curNativePc != 0); - LOG_BASELINEJIT(DEBUG) << "current native pc in UpFrame: " << std::hex << - reinterpret_cast(curNativePc); - JSHandle funcVal = JSHandle(thread_, GetFunction()); - JSHandle func = JSHandle::Cast(funcVal); - uint32_t curBytecodePcOfst = RuntimeStubs::RuntimeGetBytecodePcOfstForBaseline(thread_, func, curNativePc); - return curBytecodePcOfst; - } + Method *method = GetMethod(); + auto offset = GetPc() - method->GetBytecodeArray(); + return static_cast(offset); } Method *FrameHandler::GetMethod() const diff --git a/ecmascript/jit/jit_task.cpp b/ecmascript/jit/jit_task.cpp index de0cb707ae60a37b53fd56df7f78b358c192c87d..c0ace54bd53735f11796908323fcd5fa32924fc9 100644 --- a/ecmascript/jit/jit_task.cpp +++ b/ecmascript/jit/jit_task.cpp @@ -378,7 +378,6 @@ void JitTask::InstallCodeByCompilerTier(JSHandle &machineCodeObj, ASSERT(compilerTier_.IsBaseLine()); methodHandle->SetDeoptThreshold(hostThread_->GetEcmaVM()->GetJSOptions().GetDeoptThreshold()); jsFunction_->SetBaselineCode(hostThread_, machineCodeObj); - jsFunction_->SetBaselineJitCodeCache(hostThread_, machineCodeObj); LOG_BASELINEJIT(DEBUG) <<"Install baseline jit machine code:" << GetMethodName(); } } diff --git a/ecmascript/js_function.cpp b/ecmascript/js_function.cpp index 0e84f8822c5903948982329a2737be1246e5797d..b29d0167a3959cd2c8326235755535a0c9ca920e 100644 --- a/ecmascript/js_function.cpp +++ b/ecmascript/js_function.cpp @@ -1192,16 +1192,6 @@ void JSFunction::SetJitMachineCodeCache(const JSThread *thread, const JSHandleSetMachineCode(thread, machineCode.GetTaggedValue().CreateAndGetWeakRef()); } -void JSFunction::SetBaselineJitCodeCache(const JSThread *thread, const JSHandle &machineCode) -{ - JSHandle handleRaw(thread, GetRawProfileTypeInfo(thread)); - if (handleRaw->IsEmptyProfileTypeInfoCell(thread)) { - LOG_BASELINEJIT(ERROR) << "skip set baselinejit cache, as profileTypeInfoCell is empty."; - return; - } - handleRaw->SetBaselineCode(thread, machineCode.GetTaggedValue().CreateAndGetWeakRef()); -} - JSTaggedValue JSFunctionBase::GetFunctionExtraInfo(const JSThread *thread) const { JSTaggedType hashField = Barriers::GetTaggedValue(thread, this, HASH_OFFSET); diff --git a/ecmascript/js_function.h b/ecmascript/js_function.h index 589958f4f8ae085cac71d0c3d7d9998d95e724b5..30b8ebafcd0a53281caf5c2a9d259dec965c7d77 100644 --- a/ecmascript/js_function.h +++ b/ecmascript/js_function.h @@ -377,7 +377,6 @@ public: static void UpdateProfileTypeInfoCell(JSThread *thread, JSHandle literalFunc, JSHandle targetFunc); void SetJitMachineCodeCache(const JSThread *thread, const JSHandle &machineCode); - void SetBaselineJitCodeCache(const JSThread *thread, const JSHandle &machineCode); void ClearMachineCode(const JSThread *thread); JSTaggedValue GetNativeFunctionExtraInfo(const JSThread *thread) const; diff --git a/ecmascript/js_type_metadata/profile_type_info_cell_0.json b/ecmascript/js_type_metadata/profile_type_info_cell_0.json index 557b43e8fa11726ca0720ad2bd9a90ad8b9012c3..0dc65df6c6053f14c91140cece0ff0000e584996 100644 --- a/ecmascript/js_type_metadata/profile_type_info_cell_0.json +++ b/ecmascript/js_type_metadata/profile_type_info_cell_0.json @@ -11,18 +11,13 @@ "offset": 8, "size": 8 }, - { - "name": "BaselineCode", - "offset": 16, - "size": 8 - }, { "name": "Handle", - "offset": 24, + "offset": 16, "size": 8 } ], - "end_offset": 32, + "end_offset": 24, "parents": [ "TAGGED_OBJECT" ] diff --git a/ecmascript/js_type_metadata/profile_type_info_cell_1.json b/ecmascript/js_type_metadata/profile_type_info_cell_1.json index edfdc477470ce5b14f1d17084dd30131733ced52..63d04f3254eb53237da84ec2baa5908682e85629 100644 --- a/ecmascript/js_type_metadata/profile_type_info_cell_1.json +++ b/ecmascript/js_type_metadata/profile_type_info_cell_1.json @@ -11,18 +11,13 @@ "offset": 8, "size": 8 }, - { - "name": "BaselineCode", - "offset": 16, - "size": 8 - }, { "name": "Handle", - "offset": 24, + "offset": 16, "size": 8 } ], - "end_offset": 32, + "end_offset": 24, "parents": [ "TAGGED_OBJECT" ] diff --git a/ecmascript/js_type_metadata/profile_type_info_cell_n.json b/ecmascript/js_type_metadata/profile_type_info_cell_n.json index ec9a87765b49db64700a17b9fa6af92c0acbbdc3..cc6ae0dee3a199eb339dc6a535d7e222bee7d99c 100644 --- a/ecmascript/js_type_metadata/profile_type_info_cell_n.json +++ b/ecmascript/js_type_metadata/profile_type_info_cell_n.json @@ -11,18 +11,13 @@ "offset": 8, "size": 8 }, - { - "name": "BaselineCode", - "offset": 16, - "size": 8 - }, { "name": "Handle", - "offset": 24, + "offset": 16, "size": 8 } ], - "end_offset": 32, + "end_offset": 24, "parents": [ "TAGGED_OBJECT" ] diff --git a/ecmascript/object_factory.cpp b/ecmascript/object_factory.cpp index 8286f0df9b24512ed8598dd4ca95ec2984c64721..85c280d6048f1c76636758a662b90d8c0679e207 100644 --- a/ecmascript/object_factory.cpp +++ b/ecmascript/object_factory.cpp @@ -5313,7 +5313,6 @@ JSHandle ObjectFactory::NewProfileTypeInfoCell(const JSHand JSHandle profileTypeInfoCell(thread_, header); profileTypeInfoCell->SetValue(thread_, value.GetTaggedValue()); profileTypeInfoCell->SetMachineCode(thread_, JSTaggedValue::Hole()); - profileTypeInfoCell->SetBaselineCode(thread_, JSTaggedValue::Hole()); profileTypeInfoCell->SetHandle(thread_, JSTaggedValue::Undefined()); return profileTypeInfoCell; } diff --git a/ecmascript/shared_object_factory.cpp b/ecmascript/shared_object_factory.cpp index 8d3077c3a4e2587462f1a6e87c5ad1e86c23a863..c11261b5d6aac483520ed90a99bb903adca2b6d6 100644 --- a/ecmascript/shared_object_factory.cpp +++ b/ecmascript/shared_object_factory.cpp @@ -591,7 +591,6 @@ JSHandle ObjectFactory::NewSEmptyProfileTypeInfoCell() JSHandle profileTypeInfoCell(thread_, header); profileTypeInfoCell->SetValue(thread_, JSTaggedValue::Undefined()); profileTypeInfoCell->SetMachineCode(thread_, JSTaggedValue::Hole()); - profileTypeInfoCell->SetBaselineCode(thread_, JSTaggedValue::Hole()); profileTypeInfoCell->SetHandle(thread_, JSTaggedValue::Undefined()); return profileTypeInfoCell; } diff --git a/ecmascript/stubs/runtime_stub_list.h b/ecmascript/stubs/runtime_stub_list.h index 993612e26ee989dd315873315e12a3d3ba2ff5cf..b51b764fdd372bf6d2ed3e6e8c377eaeffdff35a 100644 --- a/ecmascript/stubs/runtime_stub_list.h +++ b/ecmascript/stubs/runtime_stub_list.h @@ -56,11 +56,6 @@ namespace panda::ecmascript { V(CallContainersArgs2) \ V(CallContainersArgs3) \ V(CallReturnWithArgv) \ - V(CallGetterToBaseline) \ - V(CallSetterToBaseline) \ - V(CallContainersArgs2ToBaseline) \ - V(CallContainersArgs3ToBaseline) \ - V(CallReturnWithArgvToBaseline) \ V(ASMFastWriteBarrier) #define BASELINE_TRAMPOLINE_LIST(V) \