Bug 1115766 - SpiderMonkey: Don't give LMulI an extra non-use-at-start use when it doesn't need one r=bbouvier
authorDan Gohman <sunfish@mozilla.com>
Mon, 29 Dec 2014 22:15:30 -0800
changeset 247460 6fb6a530e25776d371f57bdeb1fb84273c5efc30
parent 247459 0bc70a92b047f4c3f3221c72cbab144b9261032a
child 247461 e6d8db11ed448a68b41005f20c853e1339208081
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1115766
milestone37.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 1115766 - SpiderMonkey: Don't give LMulI an extra non-use-at-start use when it doesn't need one r=bbouvier
js/src/jit/shared/Lowering-x86-shared.cpp
--- a/js/src/jit/shared/Lowering-x86-shared.cpp
+++ b/js/src/jit/shared/Lowering-x86-shared.cpp
@@ -150,19 +150,19 @@ LIRGeneratorX86Shared::lowerForBitAndAnd
     baab->setOperand(0, useRegisterAtStart(lhs));
     baab->setOperand(1, useRegisterOrConstantAtStart(rhs));
     add(baab, mir);
 }
 
 void
 LIRGeneratorX86Shared::lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs)
 {
-    // Note: lhs is used twice, so that we can restore the original value for the
-    // negative zero check.
-    LMulI *lir = new(alloc()) LMulI(useRegisterAtStart(lhs), useOrConstant(rhs), use(lhs));
+    // Note: If we need a negative zero check, lhs is used twice.
+    LAllocation lhsCopy = mul->canBeNegativeZero() ? use(lhs) : LAllocation();
+    LMulI *lir = new(alloc()) LMulI(useRegisterAtStart(lhs), useOrConstant(rhs), lhsCopy);
     if (mul->fallible())
         assignSnapshot(lir, Bailout_DoubleOutput);
     defineReuseInput(lir, mul, 0);
 }
 
 void
 LIRGeneratorX86Shared::lowerDivI(MDiv *div)
 {