Fix type inference integration with localinc (bug 685982, r=bhackett).
authorDavid Anderson <danderson@mozilla.com>
Sat, 10 Sep 2011 19:26:34 -0700
changeset 105254 0c3090046c7aea1f4aaccc7d35ca0866c8f88b77
parent 105253 61cd956864cc6514a23698a77c6629df88315e1e
child 105255 af4ea34da9df9fa81e2c026d9076fd2512db0a7c
push id14706
push usereakhgari@mozilla.com
push dateTue, 11 Sep 2012 20:39:52 +0000
treeherdermozilla-inbound@d50bf1edaabe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs685982
milestone9.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
Fix type inference integration with localinc (bug 685982, r=bhackett).
js/src/ion/MIR.cpp
js/src/ion/TypeOracle.cpp
--- a/js/src/ion/MIR.cpp
+++ b/js/src/ion/MIR.cpp
@@ -574,35 +574,30 @@ MDiv::foldsTo(bool useValueNumbers)
         return lhs();
 
     return this;
 }
 
 void
 MBinaryArithInstruction::infer(const TypeOracle::Binary &b)
 {
-    if (b.lhs == MIRType_Int32 && b.rhs == MIRType_Int32) {
-        specialization_ = MIRType_Int32;
-        setIdempotent();
-        setCommutative();
-        setResultType(specialization_);
-    } else if (b.lhs == MIRType_Double && b.rhs == MIRType_Double) {
+    // Anything complex - strings and objects - are not specialized.
+    if (b.lhs >= MIRType_String || b.rhs >= MIRType_String) {
+        specialization_ = MIRType_None;
+        return;
+    }
+
+    if (CoercesToDouble(b.lhs) || CoercesToDouble(b.rhs))
         specialization_ = MIRType_Double;
-        setIdempotent();
-        setCommutative();
-        setResultType(specialization_);
-    } else if (b.lhs < MIRType_String && b.rhs < MIRType_String) {
-        specialization_ = MIRType_Any;
-        if (CoercesToDouble(b.lhs) || CoercesToDouble(b.rhs))
-            setResultType(MIRType_Double);
-        else
-            setResultType(MIRType_Int32);
-    } else {
-        specialization_ = MIRType_None;
-    }
+    else
+        specialization_ = MIRType_Int32;
+
+    setIdempotent();
+    setCommutative();
+    setResultType(specialization_);
 }
 
 void
 MCompare::infer(const TypeOracle::Binary &b)
 {
     // If neither operand is an object, then we are idempotent
     if (b.lhs != MIRType_Object && b.rhs != MIRType_Object)
         setIdempotent();
--- a/js/src/ion/TypeOracle.cpp
+++ b/js/src/ion/TypeOracle.cpp
@@ -91,21 +91,29 @@ TypeInferenceOracle::unaryOp(JSScript *s
     res.rval = getMIRType(script->analysis()->pushedTypes(pc, 0));
     return res;
 }
 
 TypeOracle::Binary
 TypeInferenceOracle::binaryOp(JSScript *script, jsbytecode *pc)
 {
     JS_ASSERT(script == this->script);
+    
+    JSOp op = (JSOp)*pc;
 
     Binary res;
-    res.lhs = getMIRType(script->analysis()->poppedTypes(pc, 1));
-    res.rhs = getMIRType(script->analysis()->poppedTypes(pc, 0));
-    res.rval = getMIRType(script->analysis()->pushedTypes(pc, 0));
+    if (js_CodeSpec[op].format & JOF_INCDEC) {
+        res.lhs = getMIRType(script->analysis()->poppedTypes(pc, 0));
+        res.rhs = MIRType_Int32;
+        res.rval = res.lhs;
+    } else {
+        res.lhs = getMIRType(script->analysis()->poppedTypes(pc, 1));
+        res.rhs = getMIRType(script->analysis()->poppedTypes(pc, 0));
+        res.rval = getMIRType(script->analysis()->pushedTypes(pc, 0));
+    }
     return res;
 }
 
 TypeSet *
 TypeInferenceOracle::thisTypeSet(JSScript *script)
 {
     JS_ASSERT(script == this->script);
     return TypeScript::ThisTypes(script);