diff --git a/ecmascript/compiler/bytecode_circuit_builder.cpp b/ecmascript/compiler/bytecode_circuit_builder.cpp index 660fc98dd213268a3e3f02cf0f4f2282d8ebf083..64bbad200cda7318bb0830a022a8106f2a558e78 100644 --- a/ecmascript/compiler/bytecode_circuit_builder.cpp +++ b/ecmascript/compiler/bytecode_circuit_builder.cpp @@ -785,17 +785,14 @@ void BytecodeCircuitBuilder::BuildOSRArgs() BuildFrameArgs(); } -GateRef BytecodeCircuitBuilder::NewDeopt(BytecodeRegion &bb) +GateRef BytecodeCircuitBuilder::NewDeopt(BytecodeRegion &bb, FrameLiveOut *liveOut) { ASSERT(bb.succs.empty()); auto &iterator = bb.GetBytecodeIterator(); const BytecodeInfo &bytecodeInfo = iterator.GetBytecodeInfo(); GateRef state = frameStateBuilder_.GetCurrentState(); GateRef depend = frameStateBuilder_.GetCurrentDepend(); - GateRef frameState = gateAcc_.FindNearestFrameState(depend); - if (bytecodeInfo.NeedFrameStateInPlace()) { - frameState = frameStateBuilder_.GetBcFrameStateCache(); - } + GateRef frameState = frameStateBuilder_.BuildFrameStatePublic(liveOut, bb.GetBytecodeIterator().Index()); std::string comment = Deoptimizier::DisplayItems(DeoptType::INSUFFICIENTPROFILE); GateRef type = circuit_->GetConstantGate(MachineType::I64, static_cast(DeoptType::INSUFFICIENTPROFILE), GateType::NJSValue()); @@ -1090,7 +1087,7 @@ void BytecodeCircuitBuilder::NewByteCode(BytecodeRegion &bb) GateRef gate = Circuit::NullGate(); if (bytecodeInfo.IsInsufficientProfile()) { // handle general ecma.* bytecodes - NewDeopt(bb); + NewDeopt(bb, liveout); } else if (bytecodeInfo.IsSetConstant()) { // handle bytecode command to get constants gate = NewConst(bytecodeInfo); diff --git a/ecmascript/compiler/bytecode_circuit_builder.h b/ecmascript/compiler/bytecode_circuit_builder.h index 1f89290364b77d1f9b7181269cfd7fc02813221d..be008f823f32801cee1baf78dc30cff0f27b2691 100644 --- a/ecmascript/compiler/bytecode_circuit_builder.h +++ b/ecmascript/compiler/bytecode_circuit_builder.h @@ -657,7 +657,7 @@ private: void BuildCircuitArgs(); void BuildOSRArgs(); std::vector CreateGateInList(const BytecodeInfo &info, const GateMetaData *meta); - GateRef NewDeopt(BytecodeRegion &bb); + GateRef NewDeopt(BytecodeRegion &bb, FrameLiveOut *liveOut); GateRef NewConst(const BytecodeInfo &info); void NewJSGate(BytecodeRegion &bb); void NewJump(BytecodeRegion &bbd); diff --git a/ecmascript/compiler/frame_states.cpp b/ecmascript/compiler/frame_states.cpp index 719d88f378f41b24bc24535c33807c06b604aecf..f6a784e296f3dc56d8a95a8fd322f881d3dc7cca 100644 --- a/ecmascript/compiler/frame_states.cpp +++ b/ecmascript/compiler/frame_states.cpp @@ -1427,6 +1427,11 @@ void FrameStateBuilder::DumpLiveState() } } +GateRef FrameStateBuilder::BuildFrameStatePublic(FrameLiveOut *liveOut, size_t bcIndex) +{ + return BuildFrameState(liveContext_, liveOut, bcIndex); +} + GateRef FrameStateBuilder::BuildFrameState(FrameContext* frameContext, FrameLiveOut* liveout, size_t bcIndex) { auto pcOffset = bcBuilder_->GetPcOffset(bcIndex); diff --git a/ecmascript/compiler/frame_states.h b/ecmascript/compiler/frame_states.h index 0e48ddeb9ea97c6a3db0532ce147b0a53b6959e5..85ec9cf6f128ea50dcea8b74f6089b8a68b9611e 100644 --- a/ecmascript/compiler/frame_states.h +++ b/ecmascript/compiler/frame_states.h @@ -125,6 +125,7 @@ public: Circuit *circuit, const MethodLiteral *literal); ~FrameStateBuilder(); + GateRef BuildFrameStatePublic(FrameLiveOut *liveOut, size_t bcIndex); void DoBytecodeAnalysis(); void AnalyzeLiveness(); void AdvanceToNextBc(const BytecodeInfo &bytecodeInfo, FrameLiveOut* liveout, uint32_t bcId);