Bug 814179 - Optimize BC ARM JSOP_URSH for a double type result. r=jandem

This commit is contained in:
Douglas Crosher 2013-04-19 22:40:28 +10:00
parent 1f69973369
commit 823802ad6d
2 changed files with 18 additions and 4 deletions

View File

@ -2498,7 +2498,8 @@ DoBinaryArithFallback(JSContext *cx, BaselineFrame *frame, ICBinaryArith_Fallbac
// TODO: unlink previous !allowDouble stub.
if (lhs.isInt32() && rhs.isInt32()) {
bool allowDouble = ret.isDouble();
IonSpew(IonSpew_BaselineIC, " Generating %s(Int32, Int32) stub", js_CodeName[op]);
IonSpew(IonSpew_BaselineIC, " Generating %s(Int32, Int32%s) stub", js_CodeName[op],
allowDouble ? " => Double" : "");
ICBinaryArith_Int32::Compiler compilerInt32(cx, op, allowDouble);
ICStub *int32Stub = compilerInt32.getStub(compilerInt32.getStubSpace(script));
if (!int32Stub)

View File

@ -178,9 +178,22 @@ ICBinaryArith_Int32::Compiler::generateStubCode(MacroAssembler &masm)
masm.ma_and(Imm32(0x1F), R1.payloadReg(), scratchReg);
masm.ma_lsr(scratchReg, R0.payloadReg(), scratchReg);
masm.ma_cmp(scratchReg, Imm32(0));
masm.j(Assembler::LessThan, &failure);
// Move result for return.
masm.mov(scratchReg, R0.payloadReg());
if (allowDouble_) {
Label toUint;
masm.j(Assembler::LessThan, &toUint);
// Move result and box for return.
masm.mov(scratchReg, R0.payloadReg());
EmitReturnFromIC(masm);
masm.bind(&toUint);
masm.convertUInt32ToDouble(scratchReg, ScratchFloatReg);
masm.boxDouble(ScratchFloatReg, R0);
} else {
masm.j(Assembler::LessThan, &failure);
// Move result for return.
masm.mov(scratchReg, R0.payloadReg());
}
break;
default:
JS_NOT_REACHED("Unhandled op for BinaryArith_Int32.");