Bug 862103 - Address review comments, r=jandem.
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 18 Apr 2013 07:39:33 -0600
changeset 140548 844053735e04dd797e511fd453cacdcdc4be0535
parent 140547 7bc766400b8117129e862eb8b9227d89ea301e18
child 140549 53dede16a03faa22cc6e401776e96bca6c7296d4
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)
reviewersjandem
bugs862103
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 862103 - Address review comments, r=jandem.
js/src/ion/BaselineInspector.cpp
js/src/ion/BaselineInspector.h
js/src/ion/MIR.cpp
--- a/js/src/ion/BaselineInspector.cpp
+++ b/js/src/ion/BaselineInspector.cpp
@@ -115,8 +115,33 @@ BaselineInspector::expectedResultType(js
         return MIRType_Double;
       case ICStub::BinaryArith_StringConcat:
       case ICStub::BinaryArith_StringObjectConcat:
         return MIRType_String;
       default:
         return MIRType_None;
     }
 }
+
+// Whether a baseline stub kind is suitable for a double comparison that
+// converts its operands to doubles.
+static bool
+CanUseDoubleCompare(ICStub::Kind kind)
+{
+    return kind == ICStub::Compare_Double || kind == ICStub::Compare_NumberWithUndefined;
+}
+
+MCompare::CompareType
+BaselineInspector::expectedCompareType(jsbytecode *pc)
+{
+    ICStub::Kind kind = monomorphicStubKind(pc);
+
+    if (CanUseDoubleCompare(kind))
+        return MCompare::Compare_Double;
+
+    ICStub::Kind first, second;
+    if (dimorphicStubKind(pc, &first, &second)) {
+        if (CanUseDoubleCompare(first) && CanUseDoubleCompare(second))
+            return MCompare::Compare_Double;
+    }
+
+    return MCompare::Compare_Unknown;
+}
--- a/js/src/ion/BaselineInspector.h
+++ b/js/src/ion/BaselineInspector.h
@@ -8,16 +8,17 @@
 #if !defined(jsion_baseline_inspector_h__) && defined(JS_ION)
 #define jsion_baseline_inspector_h__
 
 #include "jscntxt.h"
 #include "jscompartment.h"
 
 #include "BaselineJIT.h"
 #include "BaselineIC.h"
+#include "MIR.h"
 
 namespace js {
 namespace ion {
 
 class BaselineInspector;
 
 class ICInspector
 {
@@ -84,26 +85,27 @@ class BaselineInspector
         ICEntry *ent = NULL;
         if (hasBaselineScript()) {
             ent = &icEntryFromPC(pc);
             JS_ASSERT(ent->fallbackStub()->kind() == expectedFallbackKind);
         }
         return ICInspectorType(this, pc, ent);
     }
 
+    ICStub::Kind monomorphicStubKind(jsbytecode *pc);
+    bool dimorphicStubKind(jsbytecode *pc, ICStub::Kind *pfirst, ICStub::Kind *psecond);
+
   public:
     RawShape maybeMonomorphicShapeForPropertyOp(jsbytecode *pc);
 
     SetElemICInspector setElemICInspector(jsbytecode *pc) {
         return makeICInspector<SetElemICInspector>(pc, ICStub::SetElem_Fallback);
     }
 
-    ICStub::Kind monomorphicStubKind(jsbytecode *pc);
-    bool dimorphicStubKind(jsbytecode *pc, ICStub::Kind *pfirst, ICStub::Kind *psecond);
-
     MIRType expectedResultType(jsbytecode *pc);
+    MCompare::CompareType expectedCompareType(jsbytecode *pc);
 };
 
 } // namespace ion
 } // namespace js
 
 #endif
 
--- a/js/src/ion/MIR.cpp
+++ b/js/src/ion/MIR.cpp
@@ -1378,24 +1378,16 @@ MCompare::inputType()
       case Compare_Value:
         return MIRType_Value;
       default:
         JS_NOT_REACHED("No known conversion");
         return MIRType_None;
     }
 }
 
-// Whether a baseline stub kind is suitable for a double comparison that
-// converts its operands to doubles.
-static bool
-CanUseDoubleCompare(ICStub::Kind kind)
-{
-    return kind == ICStub::Compare_Double || kind == ICStub::Compare_NumberWithUndefined;
-}
-
 void
 MCompare::infer(JSContext *cx, BaselineInspector *inspector, jsbytecode *pc)
 {
     JS_ASSERT(operandMightEmulateUndefined());
 
     if (!MaybeEmulatesUndefined(cx, getOperand(0)) && !MaybeEmulatesUndefined(cx, getOperand(1)))
         markNoOperandEmulatesUndefined();
 
@@ -1500,32 +1492,18 @@ MCompare::infer(JSContext *cx, BaselineI
     }
 
     // Type information is not good enough to pick out a particular type of
     // comparison we can do here. Try to specialize based on any baseline
     // caches that have been generated for the opcode. These will cause the
     // instruction's type policy to insert fallible unboxes to the appropriate
     // input types.
 
-    if (!strictEq) {
-        ICStub::Kind kind = inspector->monomorphicStubKind(pc);
-
-        if (CanUseDoubleCompare(kind)) {
-            compareType_ = Compare_Double;
-            return;
-        }
-
-        ICStub::Kind first, second;
-        if (inspector->dimorphicStubKind(pc, &first, &second)) {
-            if (CanUseDoubleCompare(first) && CanUseDoubleCompare(second)) {
-                compareType_ = Compare_Double;
-                return;
-            }
-        }
-    }
+    if (!strictEq)
+        compareType_ = inspector->expectedCompareType(pc);
 }
 
 MBitNot *
 MBitNot::New(MDefinition *input)
 {
     return new MBitNot(input);
 }