Bug 869501 - Add an accessor to MCompare for testing whether the comparison is
authorDan Gohman <sunfish@google.com>
Wed, 08 May 2013 10:03:53 -0400
changeset 142205 6cea585acd2110a923f9c2ce958ff1d15b3b0111
parent 142204 0f990be99e7b2b8a5200ec6402bb191b76237333
child 142206 5da1839640f5497bc6cdaadce2faa4ce299daee9
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs869501
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 869501 - Add an accessor to MCompare for testing whether the comparison is any flavor of double comparison, and use it when testing whether to create LCompareAndBranch nodes. r=bhackett
js/src/ion/Lowering.cpp
js/src/ion/MIR.h
--- a/js/src/ion/Lowering.cpp
+++ b/js/src/ion/Lowering.cpp
@@ -654,17 +654,17 @@ LIRGenerator::visitTest(MTest *test)
             } else {
                 rhs = useRegister(right);
             }
             LCompareAndBranch *lir = new LCompareAndBranch(op, lhs, rhs, ifTrue, ifFalse);
             return add(lir, comp);
         }
 
         // Compare and branch doubles.
-        if (comp->compareType() == MCompare::Compare_Double) {
+        if (comp->isDoubleComparison()) {
             LAllocation lhs = useRegister(left);
             LAllocation rhs = useRegister(right);
             LCompareDAndBranch *lir = new LCompareDAndBranch(lhs, rhs, ifTrue, ifFalse);
             return add(lir, comp);
         }
 
         // Compare values.
         if (comp->compareType() == MCompare::Compare_Value) {
@@ -830,22 +830,18 @@ LIRGenerator::visitCompare(MCompare *com
             rhs = useAnyOrConstant(right);
         } else {
             rhs = useRegister(right);
         }
         return define(new LCompare(op, lhs, rhs), comp);
     }
 
     // Compare doubles.
-    if (comp->compareType() == MCompare::Compare_Double ||
-        comp->compareType() == MCompare::Compare_DoubleMaybeCoerceLHS ||
-        comp->compareType() == MCompare::Compare_DoubleMaybeCoerceRHS)
-    {
+    if (comp->isDoubleComparison())
         return define(new LCompareD(useRegister(left), useRegister(right)), comp);
-    }
 
     // Compare values.
     if (comp->compareType() == MCompare::Compare_Value) {
         LCompareV *lir = new LCompareV();
         if (!useBoxAtStart(lir, LCompareV::LhsInput, left))
             return false;
         if (!useBoxAtStart(lir, LCompareV::RhsInput, right))
             return false;
--- a/js/src/ion/MIR.h
+++ b/js/src/ion/MIR.h
@@ -1842,16 +1842,21 @@ class MCompare
     bool tryFold(bool *result);
     bool evaluateConstantOperands(bool *result);
     MDefinition *foldsTo(bool useValueNumbers);
 
     void infer(JSContext *cx, BaselineInspector *inspector, jsbytecode *pc);
     CompareType compareType() const {
         return compareType_;
     }
+    bool isDoubleComparison() const {
+        return compareType() == Compare_Double ||
+               compareType() == Compare_DoubleMaybeCoerceLHS ||
+               compareType() == Compare_DoubleMaybeCoerceRHS;
+    }
     void setCompareType(CompareType type) {
         compareType_ = type;
     }
     MIRType inputType();
 
     JSOp jsop() const {
         return jsop_;
     }