Bug 1202643 - bailout from udiv on nonzero remainder. r=nbp

This commit is contained in:
Lars T Hansen 2015-09-15 11:01:20 +02:00
Родитель b8fb04e7b8
Коммит 561e77b8d2
1 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -2450,12 +2450,26 @@ CodeGeneratorARM::visitUDiv(LUDiv* ins)
masm.ma_udiv(lhs, rhs, output);
// Check for large unsigned result - represent as double.
if (!ins->mir()->isTruncated()) {
MOZ_ASSERT(ins->mir()->fallible());
masm.ma_cmp(output, Imm32(0));
bailoutIf(Assembler::LessThan, ins->snapshot());
}
masm.bind(&done);
// Check for non-zero remainder if not truncating to int.
if (!ins->mir()->canTruncateRemainder()) {
MOZ_ASSERT(ins->mir()->fallible());
{
ScratchRegisterScope scratch(masm);
masm.ma_mul(rhs, output, scratch);
masm.ma_cmp(scratch, lhs);
}
bailoutIf(Assembler::NotEqual, ins->snapshot());
}
if (done.used())
masm.bind(&done);
}
void
@ -2470,12 +2484,15 @@ CodeGeneratorARM::visitUMod(LUMod* ins)
masm.ma_umod(lhs, rhs, output);
// Check for large unsigned result - represent as double.
if (!ins->mir()->isTruncated()) {
MOZ_ASSERT(ins->mir()->fallible());
masm.ma_cmp(output, Imm32(0));
bailoutIf(Assembler::LessThan, ins->snapshot());
}
masm.bind(&done);
if (done.used())
masm.bind(&done);
}
template<class T>