Bug 939893 - IonMonkey: Handle x/x in lowerUDiv. r=bhackett

This commit is contained in:
Dan Gohman 2013-11-20 21:53:51 -08:00
parent b69f2731cd
commit e5eccb0398

View File

@ -209,7 +209,13 @@ LIRGeneratorX86Shared::visitAsmJSNeg(MAsmJSNeg *ins)
bool
LIRGeneratorX86Shared::lowerUDiv(MInstruction *div)
{
LUDivOrMod *lir = new LUDivOrMod(useFixed(div->getOperand(0), eax),
// Optimize x/x. The comments in lowerDivI apply here as well.
if (div->getOperand(0) == div->getOperand(1)) {
LDivSelfI *lir = new LDivSelfI(useRegisterAtStart(div->getOperand(0)));
return define(lir, div);
}
LUDivOrMod *lir = new LUDivOrMod(useFixedAtStart(div->getOperand(0), eax),
useRegister(div->getOperand(1)),
tempFixed(edx));
return defineFixed(lir, div, LAllocation(AnyRegister(eax)));