Bug 852140: IonMonkey: Backout bug 844452 and add testcase, r=nbp
authorHannes Verschore <hv1989@gmail.com>
Tue, 19 Mar 2013 23:49:49 +0100
changeset 125515 bbb0081483d995a95f9764bcf537e27170f6cb6b
parent 125514 0e41b1ed18c21752d09c3c0b6a02166982c81288
child 125516 1356923ff93edb11b68682f4836d631c39ce3908
push id24459
push useremorley@mozilla.com
push dateWed, 20 Mar 2013 11:46:36 +0000
treeherdermozilla-central@1d6fe70c79c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs852140, 844452
milestone22.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 852140: IonMonkey: Backout bug 844452 and add testcase, r=nbp
js/src/ion/TypePolicy.cpp
js/src/jit-test/tests/ion/bug852140.js
--- a/js/src/ion/TypePolicy.cpp
+++ b/js/src/ion/TypePolicy.cpp
@@ -155,36 +155,37 @@ ComparePolicy::adjustInputs(MInstruction
             def->replaceOperand(1, unbox);
         }
 
         JS_ASSERT(def->getOperand(0)->type() != MIRType_String);
         JS_ASSERT(def->getOperand(1)->type() == MIRType_String);
         return true;
     }
 
+    if (compare->compareType() == MCompare::Compare_Undefined ||
+        compare->compareType() == MCompare::Compare_Null)
+    {
+        // Nothing to do for undefined and null, lowering handles all types.
+        return true;
+    }
+
     // Convert all inputs to the right input type
     MIRType type = compare->inputType();
-
-    // Nothing to do for undefined and null, lowering handles all types.
-    if (type == MIRType_Undefined || type == MIRType_Null)
-        return true;
-
+    JS_ASSERT(type == MIRType_Int32 || type == MIRType_Double ||
+              type == MIRType_Object || type == MIRType_String);
     for (size_t i = 0; i < 2; i++) {
         MDefinition *in = def->getOperand(i);
         if (in->type() == type)
             continue;
 
         MInstruction *replace;
 
         // See BinaryArithPolicy::adjustInputs for an explanation of the following
-        if (in->type() == MIRType_Object || in->type() == MIRType_String ||
-            (in->type() == MIRType_Boolean && type != MIRType_Double && type != MIRType_Int32))
-        {
+        if (in->type() == MIRType_Object || in->type() == MIRType_String)
             in = boxAt(def, in);
-        }
 
         switch (type) {
           case MIRType_Double:
             replace = MToDouble::New(in);
             break;
           case MIRType_Int32:
             replace = MToInt32::New(in);
             break;
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug852140.js
@@ -0,0 +1,7 @@
+function reportCompare (expected, actual) {
+  if (expected != actual) {}
+}
+function exitFunc (funcName)
+  reportCompare(undefined, '');
+reportCompare('', '');
+exitFunc();