Bug 1072881 - IonMonkey ARM: optimize Float32ToDouble to useAtStart its argument. r=mrosenberg
authorDouglas Crosher <dtc-moz@scieneer.com>
Sat, 27 Sep 2014 00:24:42 +1000
changeset 207639 22b5ded1d700e862aab8c66013658575356bd1f0
parent 207638 1da6f91145034e5312c9a6d9603b4b4bef860e64
child 207640 99b68a13246b91d61c81dde4c7685e8bd19f6dab
push id27564
push userryanvm@gmail.com
push dateMon, 29 Sep 2014 18:57:04 +0000
treeherdermozilla-central@ce9a0b34225e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrosenberg
bugs1072881
milestone35.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 1072881 - IonMonkey ARM: optimize Float32ToDouble to useAtStart its argument. r=mrosenberg
js/src/jit/LiveRangeAllocator.cpp
js/src/jit/Lowering.cpp
--- a/js/src/jit/LiveRangeAllocator.cpp
+++ b/js/src/jit/LiveRangeAllocator.cpp
@@ -796,20 +796,24 @@ LiveRangeAllocator<VREG, forLSRA>::build
                     if (use->policy() == LUse::REGISTER) {
                         if (use->usedAtStart()) {
                             if (!IsInputReused(*ins, use))
                                 hasUseRegisterAtStart = true;
                         } else {
                             hasUseRegister = true;
                         }
                     }
+                    JS_ASSERT(!(hasUseRegister && hasUseRegisterAtStart));
 
-                    JS_ASSERT_IF(hasUnaliasedDouble() && hasFloat32Def && vregs[use].type() == LDefinition::DOUBLE,
+                    // LSRA has issues with *AtStart, see bug 1039993.
+                    JS_ASSERT_IF(forLSRA && hasUnaliasedDouble() && hasFloat32Def
+                                 && vregs[use].type() == LDefinition::DOUBLE,
                                  !use->usedAtStart());
-                    JS_ASSERT_IF(hasMultiAlias() && hasDoubleDef && vregs[use].type() == LDefinition::FLOAT32,
+                    JS_ASSERT_IF(forLSRA && hasMultiAlias() && hasDoubleDef
+                                 && vregs[use].type() == LDefinition::FLOAT32,
                                  !use->usedAtStart());
 #endif
 
                     // Don't treat RECOVERED_INPUT uses as keeping the vreg alive.
                     if (use->policy() == LUse::RECOVERED_INPUT)
                         continue;
 
                     CodePosition to;
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -1773,24 +1773,28 @@ LIRGenerator::visitToDouble(MToDouble *c
       case MIRType_Int32:
       {
         LInt32ToDouble *lir = new(alloc()) LInt32ToDouble(useRegister(opd));
         return define(lir, convert);
       }
 
       case MIRType_Float32:
       {
-        // Bug 1039993: this used to be useRegisterAtStart, and theoreticall, it
+        LFloat32ToDouble *lir;
+#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS)
+        // Bug 1039993: this used to be useRegisterAtStart, and theoretically, it
         // should still be, however, there is a bug in LSRA's implementation of
         // *AtStart, which is quite fundamental. This should be reverted when that
         // is fixed, or lsra is deprecated.
-#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS)
-        LFloat32ToDouble *lir = new(alloc()) LFloat32ToDouble(useRegister(opd));
+        if (gen->optimizationInfo().registerAllocator() == RegisterAllocator_LSRA)
+            lir = new (alloc()) LFloat32ToDouble(useRegister(opd));
+        else
+            lir = new (alloc()) LFloat32ToDouble(useRegisterAtStart(opd));
 #else
-        LFloat32ToDouble *lir = new(alloc()) LFloat32ToDouble(useRegisterAtStart(opd));
+        lir = new (alloc()) LFloat32ToDouble(useRegisterAtStart(opd));
 #endif
         return define(lir, convert);
       }
 
       case MIRType_Double:
         return redefine(convert, opd);
 
       default: