From 7d8aed26a9944af3c6b2d6545d32378edcacc9e3 Mon Sep 17 00:00:00 2001 From: "tanzirui@huawei.com" Date: Wed, 9 Jul 2025 20:30:32 -0700 Subject: [PATCH] fix Signed-off-by: tanzirui@huawei.com Change-Id: I9de6b48eb177994fa18bf6b047c87f4c6e3510f5 --- ecmascript/compiler/bytecode_circuit_builder.cpp | 9 +++------ ecmascript/compiler/bytecode_circuit_builder.h | 2 +- ecmascript/compiler/frame_states.cpp | 5 +++++ ecmascript/compiler/frame_states.h | 1 + 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ecmascript/compiler/bytecode_circuit_builder.cpp b/ecmascript/compiler/bytecode_circuit_builder.cpp index 660fc98dd2..64bbad200c 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 1f89290364..be008f823f 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 719d88f378..f6a784e296 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 0e48ddeb9e..85ec9cf6f1 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); -- Gitee