Skip to content

Commit

Permalink
Spill EAX before bailIn on x86
Browse files Browse the repository at this point in the history
  • Loading branch information
rhuanjl committed Apr 19, 2021
1 parent d3ce892 commit 1e4632d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/Backend/LinearScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3339,6 +3339,16 @@ LinearScan::KillImplicitRegs(IR::Instr *instr)
return;
}
#endif
#ifdef _M_IX86
if (instr->m_opcode == Js::OpCode::GeneratorBailInLabel)
{
this->SpillReg(this->bailIn->regs[0]);
this->tempRegs.Clear(this->bailIn->regs[0]);

this->RecordLoopUse(nullptr, this->bailIn->regs[0]);
return;
}
#endif

this->TrackInlineeArgLifetimes(instr);

Expand Down Expand Up @@ -5246,6 +5256,7 @@ void LinearScan::GeneratorBailIn::InsertRestoreSymbols(BailInInsertionPoint& ins
insertionPoint.instrInsertStackSym = instr;
}

#ifndef _M_IX86 // on x86 we spill EAX before BailIn and so this logic is unnecessary
if (lifetime->reg == interpreterFrameRegOpnd->GetReg())
{
// Ensure rax is restored last
Expand All @@ -5265,6 +5276,7 @@ void LinearScan::GeneratorBailIn::InsertRestoreSymbols(BailInInsertionPoint& ins

insertionPoint.raxRestoreInstr = instr;
}
#endif

this->linearScan->RecordDef(lifetime, instr, 0);
}
Expand Down

0 comments on commit 1e4632d

Please sign in to comment.