Bug 994716 - IonMonkey MIPS: Make TestOverflow functions compatible with shared code. r=nbp

This commit is contained in:
Branislav Rankov 2014-04-16 14:22:47 +02:00
Родитель 99a585bf8c
Коммит 9e125fb9f7
2 изменённых файлов: 10 добавлений и 11 удалений

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

@ -90,10 +90,12 @@ ICBinaryArith_Int32::Compiler::generateStubCode(MacroAssembler &masm)
case JSOP_ADD:
// We know R0.typeReg() already contains the integer tag. No boxing
// required.
masm.ma_addTestOverflow(R0.payloadReg(), R0.payloadReg(), R1.payloadReg(), &failure);
masm.ma_addTestOverflow(scratchReg, R0.payloadReg(), R1.payloadReg(), &failure);
masm.move32(scratchReg, R0.payloadReg());
break;
case JSOP_SUB:
masm.ma_subTestOverflow(R0.payloadReg(), R0.payloadReg(), R1.payloadReg(), &failure);
masm.ma_subTestOverflow(scratchReg, R0.payloadReg(), R1.payloadReg(), &failure);
masm.move32(scratchReg, R0.payloadReg());
break;
case JSOP_MUL: {
masm.ma_mul_branch_overflow(scratchReg, R0.payloadReg(), R1.payloadReg(), &failure);

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

@ -489,17 +489,16 @@ void
MacroAssemblerMIPS::ma_addTestOverflow(Register rd, Register rs, Register rt, Label *overflow)
{
Label goodAddition;
as_addu(SecondScratchReg, rs, rt);
as_addu(rd, rs, rt);
as_xor(ScratchRegister, rs, rt); // If different sign, no overflow
ma_b(ScratchRegister, Imm32(0), &goodAddition, Assembler::LessThan, ShortJump);
// If different sign, then overflow
as_xor(ScratchRegister, rs, SecondScratchReg);
as_xor(ScratchRegister, rs, rd);
ma_b(ScratchRegister, Imm32(0), overflow, Assembler::LessThan);
bind(&goodAddition);
ma_move(rd, SecondScratchReg);
}
void
@ -509,18 +508,17 @@ MacroAssemblerMIPS::ma_addTestOverflow(Register rd, Register rs, Imm32 imm, Labe
// Check for unsigned range because of as_xori
if (Imm16::isInSignedRange(imm.value) && Imm16::isInUnsignedRange(imm.value)) {
Label goodAddition;
as_addiu(SecondScratchReg, rs, imm.value);
as_addiu(rd, rs, imm.value);
// If different sign, no overflow
as_xori(ScratchRegister, rs, imm.value);
ma_b(ScratchRegister, Imm32(0), &goodAddition, Assembler::LessThan, ShortJump);
// If different sign, then overflow
as_xor(ScratchRegister, rs, SecondScratchReg);
as_xor(ScratchRegister, rs, rd);
ma_b(ScratchRegister, Imm32(0), overflow, Assembler::LessThan);
bind(&goodAddition);
ma_move(rd, SecondScratchReg);
} else {
ma_li(ScratchRegister, imm);
ma_addTestOverflow(rd, rs, ScratchRegister, overflow);
@ -557,17 +555,16 @@ MacroAssemblerMIPS::ma_subTestOverflow(Register rd, Register rs, Register rt, La
Label goodSubtraction;
// Use second scratch. The instructions generated by ma_b don't use the
// second scratch register.
ma_subu(SecondScratchReg, rs, rt);
ma_subu(rd, rs, rt);
as_xor(ScratchRegister, rs, rt); // If same sign, no overflow
ma_b(ScratchRegister, Imm32(0), &goodSubtraction, Assembler::GreaterThanOrEqual, ShortJump);
// If different sign, then overflow
as_xor(ScratchRegister, rs, SecondScratchReg);
as_xor(ScratchRegister, rs, rd);
ma_b(ScratchRegister, Imm32(0), overflow, Assembler::LessThan);
bind(&goodSubtraction);
ma_move(rd, SecondScratchReg);
}
void