@@ -29181,22 +29181,20 @@ Lowerer::LowerGeneratorHelper::InsertBailOutForElidedYield()
29181
29181
// Insert the bailoutnosave label somewhere along with a call to BailOutNoSave helper
29182
29182
if (bailOutNoSaveLabel != nullptr)
29183
29183
{
29184
- IR::Instr* exitPrevInstr = this->GetEpilogueForReturnStatements()->m_prev;
29185
- IR::LabelInstr* exitTargetInstr = this->GetEpilogueForBailOut();
29186
-
29187
29184
bailOutNoSaveLabel->m_hasNonBranchRef = true;
29188
29185
bailOutNoSaveLabel->isOpHelper = true;
29189
29186
29187
+ IR::Instr* exitPrevInstr = this->GetEpilogueForReturnStatements()->m_prev;
29190
29188
IR::Instr* bailOutCall = IR::Instr::New(Js::OpCode::Call, this->func);
29189
+ IR::Instr* branchToEpilogue = IR::BranchInstr::New(LowererMD::MDUncondBranchOpcode, this->GetEpilogueForBailOut(), this->func);
29191
29190
29192
- exitPrevInstr->InsertAfter(bailOutCall);
29193
- exitPrevInstr->InsertAfter(bailOutNoSaveLabel);
29191
+ exitPrevInstr->InsertBefore(bailOutNoSaveLabel);
29192
+ exitPrevInstr->InsertBefore(bailOutCall);
29193
+ exitPrevInstr->InsertBefore(branchToEpilogue);
29194
29194
29195
29195
IR::RegOpnd* frameRegOpnd = IR::RegOpnd::New(nullptr, LowererMD::GetRegFramePointer(), TyMachPtr, this->func);
29196
-
29197
29196
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);
29200
29198
29201
29199
this->func->m_bailOutNoSaveLabel = bailOutNoSaveLabel;
29202
29200
LABELNAMESET(bailOutNoSaveLabel, "GeneratorBailOutForElidedYield");
0 commit comments