Bug 814179 - Optimize BC ARM JSOP_URSH for a double type result. r=jandem
authorDouglas Crosher <dtc-moz@scieneer.com>
Fri, 19 Apr 2013 22:40:28 +1000
changeset 129666 068fa0fc90642854c2e82d6e6d295408ab7bdea1
parent 129665 8e57ba27d6dd53136fd239d024af0333c900d498
child 129667 24644ba49ce594832745a12100734573a8e94d9a
push id24585
push userryanvm@gmail.com
push dateWed, 24 Apr 2013 00:49:33 +0000
treeherdermozilla-central@fef5f202b2dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs814179
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 814179 - Optimize BC ARM JSOP_URSH for a double type result. r=jandem
js/src/ion/BaselineIC.cpp
js/src/ion/arm/BaselineIC-arm.cpp
--- a/js/src/ion/BaselineIC.cpp
+++ b/js/src/ion/BaselineIC.cpp
@@ -2493,17 +2493,18 @@ DoBinaryArithFallback(JSContext *cx, Bas
           default:
             break;
         }
     }
 
     // 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)
             return false;
         stub->addNewStub(int32Stub);
         return true;
     }
 
--- a/js/src/ion/arm/BaselineIC-arm.cpp
+++ b/js/src/ion/arm/BaselineIC-arm.cpp
@@ -173,19 +173,32 @@ ICBinaryArith_Int32::Compiler::generateS
       case JSOP_RSH:
         masm.ma_and(Imm32(0x1F), R1.payloadReg(), R1.payloadReg());
         masm.ma_asr(R1.payloadReg(), R0.payloadReg(), R0.payloadReg());
         break;
       case JSOP_URSH:
         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.");
         return false;
     }
 
     EmitReturnFromIC(masm);