Skip to content

Commit 587f6ed

Browse files
committed
Use InsertBefore
1 parent 2135591 commit 587f6ed

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/Backend/Lower.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29181,22 +29181,20 @@ Lowerer::LowerGeneratorHelper::InsertBailOutForElidedYield()
2918129181
// Insert the bailoutnosave label somewhere along with a call to BailOutNoSave helper
2918229182
if (bailOutNoSaveLabel != nullptr)
2918329183
{
29184-
IR::Instr* exitPrevInstr = this->GetEpilogueForReturnStatements()->m_prev;
29185-
IR::LabelInstr* exitTargetInstr = this->GetEpilogueForBailOut();
29186-
2918729184
bailOutNoSaveLabel->m_hasNonBranchRef = true;
2918829185
bailOutNoSaveLabel->isOpHelper = true;
2918929186

29187+
IR::Instr* exitPrevInstr = this->GetEpilogueForReturnStatements()->m_prev;
2919029188
IR::Instr* bailOutCall = IR::Instr::New(Js::OpCode::Call, this->func);
29189+
IR::Instr* branchToEpilogue = IR::BranchInstr::New(LowererMD::MDUncondBranchOpcode, this->GetEpilogueForBailOut(), this->func);
2919129190

29192-
exitPrevInstr->InsertAfter(bailOutCall);
29193-
exitPrevInstr->InsertAfter(bailOutNoSaveLabel);
29191+
exitPrevInstr->InsertBefore(bailOutNoSaveLabel);
29192+
exitPrevInstr->InsertBefore(bailOutCall);
29193+
exitPrevInstr->InsertBefore(branchToEpilogue);
2919429194

2919529195
IR::RegOpnd* frameRegOpnd = IR::RegOpnd::New(nullptr, LowererMD::GetRegFramePointer(), TyMachPtr, this->func);
29196-
2919729196
this->lowererMD.LoadHelperArgument(bailOutCall, frameRegOpnd);
29198-
IR::Instr* call = this->lowererMD.ChangeToHelperCall(bailOutCall, IR::HelperNoSaveRegistersBailOutForElidedYield);
29199-
call->InsertAfter(IR::BranchInstr::New(LowererMD::MDUncondBranchOpcode, exitTargetInstr, this->func));
29197+
this->lowererMD.ChangeToHelperCall(bailOutCall, IR::HelperNoSaveRegistersBailOutForElidedYield);
2920029198

2920129199
this->func->m_bailOutNoSaveLabel = bailOutNoSaveLabel;
2920229200
LABELNAMESET(bailOutNoSaveLabel, "GeneratorBailOutForElidedYield");

0 commit comments

Comments
 (0)