зеркало из https://github.com/mozilla/gecko-dev.git
Bug 813671 - ModI should not clobber input register, r=jandem.
This commit is contained in:
Родитель
7e79e7771a
Коммит
e99b00147f
|
@ -798,10 +798,16 @@ CodeGeneratorX86Shared::visitModI(LModI *ins)
|
|||
Register remainder = ToRegister(ins->remainder());
|
||||
Register lhs = ToRegister(ins->lhs());
|
||||
Register rhs = ToRegister(ins->rhs());
|
||||
Register temp = ToRegister(ins->getTemp(0));
|
||||
|
||||
// Required to use idiv.
|
||||
JS_ASSERT(remainder == edx);
|
||||
JS_ASSERT(lhs == eax);
|
||||
JS_ASSERT(temp == eax);
|
||||
|
||||
if (lhs != temp) {
|
||||
masm.mov(lhs, temp);
|
||||
lhs = temp;
|
||||
}
|
||||
|
||||
// If rhs == 0, bailout, since result must be a double (NaN).
|
||||
masm.testl(rhs, rhs);
|
||||
|
|
|
@ -35,9 +35,10 @@ class LModI : public LBinaryMath<1>
|
|||
public:
|
||||
LIR_HEADER(ModI)
|
||||
|
||||
LModI(const LAllocation &lhs, const LAllocation &rhs) {
|
||||
LModI(const LAllocation &lhs, const LAllocation &rhs, const LDefinition &temp) {
|
||||
setOperand(0, lhs);
|
||||
setOperand(1, rhs);
|
||||
setTemp(0, temp);
|
||||
}
|
||||
|
||||
const LDefinition *remainder() {
|
||||
|
|
|
@ -88,7 +88,7 @@ LIRGeneratorX86Shared::lowerModI(MMod *mod)
|
|||
return assignSnapshot(lir) && defineReuseInput(lir, mod, 0);
|
||||
}
|
||||
}
|
||||
LModI *lir = new LModI(useFixed(mod->lhs(), eax), useRegister(mod->rhs()));
|
||||
LModI *lir = new LModI(useRegister(mod->lhs()), useRegister(mod->rhs()), tempFixed(eax));
|
||||
return assignSnapshot(lir) && defineFixed(lir, mod, LAllocation(AnyRegister(edx)));
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче