diff --git a/ecmascript/compiler/interpreter_stub.cpp b/ecmascript/compiler/interpreter_stub.cpp index 2c84b9334baf76df1467daac9d0326d1b449b8fc..0b2f28ea1e92dc41911528796cfc7f7acd6e6964 100644 --- a/ecmascript/compiler/interpreter_stub.cpp +++ b/ecmascript/compiler/interpreter_stub.cpp @@ -41,6 +41,38 @@ void HandleLdInfinityPrefStub::GenerateCircuit(const CompilationConfig *cfg) Dispatch(glue, pc, sp, constpool, profileTypeInfo, *acc, hotnessCounter, GetArchRelateConstant(2)); } +void HandleLdUndefinedPrefStub::GenerateCircuit(const CompilationConfig *cfg) +{ + Stub::GenerateCircuit(cfg); + // auto env = GetEnvironment(); + GateRef glue = PtrArgument(0); + GateRef pc = PtrArgument(1); + GateRef sp = PtrArgument(2); /* 2 : 3rd parameter is value */ + GateRef constpool = TaggedPointerArgument(3); /* 3 : 4th parameter is value */ + GateRef profileTypeInfo = TaggedPointerArgument(4); /* 4 : 5rd parameter is value */ + DEFVARIABLE(acc, MachineType::TAGGED, TaggedArgument(5)); /* 5: 6th parameter is value */ + GateRef hotnessCounter = Int32Argument(6); /* 6 : 7th parameter is value */ + + acc = GetUndefinedConstant(); + Dispatch(glue, pc, sp, constpool, profileTypeInfo, *acc, hotnessCounter, GetArchRelateConstant(2)); +} + +void HandleLdNullPrefStub::GenerateCircuit(const CompilationConfig *cfg) +{ + Stub::GenerateCircuit(cfg); + // auto env = GetEnvironment(); + GateRef glue = PtrArgument(0); + GateRef pc = PtrArgument(1); + GateRef sp = PtrArgument(2); /* 2 : 3rd parameter is value */ + GateRef constpool = TaggedPointerArgument(3); /* 3 : 4th parameter is value */ + GateRef profileTypeInfo = TaggedPointerArgument(4); /* 4 : 5rd parameter is value */ + DEFVARIABLE(acc, MachineType::TAGGED, TaggedArgument(5)); /* 5: 6th parameter is value */ + GateRef hotnessCounter = Int32Argument(6); /* 6 : 7th parameter is value */ + + acc = GetNullConstant(); + Dispatch(glue, pc, sp, constpool, profileTypeInfo, *acc, hotnessCounter, GetArchRelateConstant(2)); +} + void SingleStepDebuggingStub::GenerateCircuit(const CompilationConfig *cfg) { Stub::GenerateCircuit(cfg); diff --git a/ecmascript/compiler/interpreter_stub_define.h b/ecmascript/compiler/interpreter_stub_define.h index f08b629fb93f5bd5999d2102d1c3760dd11eea48..356c3e88f25af8bdeb4e14c635f18ea17b35d393 100644 --- a/ecmascript/compiler/interpreter_stub_define.h +++ b/ecmascript/compiler/interpreter_stub_define.h @@ -10,6 +10,8 @@ namespace panda::ecmascript::kungfu { V(SingleStepDebugging, 7) \ V(HandleLdnanPref, 7) \ V(HandleLdInfinityPref, 7) \ + V(HandleLdUndefinedPref, 7) \ + V(HandleLdNullPref, 7) \ V(HandleLdaDyn, 7) \ V(HandleStaDyn, 7) \ V(HandleLdLexVarDynPrefImm4Imm4, 7) \ diff --git a/ecmascript/js_thread.cpp b/ecmascript/js_thread.cpp index afdb541b90db7f13219fef541e1ceca7fff2222f..c1a044c396d196a936ada56dd1e88d170f5d1d0f 100644 --- a/ecmascript/js_thread.cpp +++ b/ecmascript/js_thread.cpp @@ -233,6 +233,8 @@ void JSThread::LoadStubModule(const char *moduleFile) } bytecodeHandlers_[EcmaOpcode::LDNAN_PREF] = stubModule.GetStubEntry(kungfu::StubId::STUB_HandleLdnanPref); bytecodeHandlers_[EcmaOpcode::LDINFINITY_PREF] = stubModule.GetStubEntry(kungfu::StubId::STUB_HandleLdInfinityPref); + bytecodeHandlers_[EcmaOpcode::LDUNDEFINED_PREF] = stubModule.GetStubEntry(kungfu::StubId::STUB_HandleLdUndefinedPref); + bytecodeHandlers_[EcmaOpcode::LDNULL_PREF] = stubModule.GetStubEntry(kungfu::StubId::STUB_HandleLdNullPref); bytecodeHandlers_[EcmaOpcode::LDA_DYN_V8] = stubModule.GetStubEntry(kungfu::StubId::STUB_HandleLdaDyn); bytecodeHandlers_[EcmaOpcode::STA_DYN_V8] = stubModule.GetStubEntry(kungfu::StubId::STUB_HandleStaDyn); bytecodeHandlers_[EcmaOpcode::LDLEXVARDYN_PREF_IMM4_IMM4] =