Bug 864402 - OdinMonkey: int MAdd/MMul should be marked commutative (r=sstangl)
authorLuke Wagner <luke@mozilla.com>
Mon, 22 Apr 2013 16:31:41 -0700
changeset 140482 7037549c9fbba1d35b414f2e8c9f60ef0b09d8ea
parent 140481 221e325b028c1f4e6a8e044289cdafa7f054c8ca
child 140483 445e4da45a6f70cab06055c3159a150abc8565fc
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)
reviewerssstangl
bugs864402
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 864402 - OdinMonkey: int MAdd/MMul should be marked commutative (r=sstangl)
js/src/ion/MIR.h
--- a/js/src/ion/MIR.h
+++ b/js/src/ion/MIR.h
@@ -3023,18 +3023,20 @@ class MAdd : public MBinaryArithInstruct
     static MAdd *New(MDefinition *left, MDefinition *right) {
         return new MAdd(left, right);
     }
 
     static MAdd *NewAsmJS(MDefinition *left, MDefinition *right, MIRType type) {
         MAdd *add = new MAdd(left, right);
         add->specialization_ = type;
         add->setResultType(type);
-        if (type == MIRType_Int32)
+        if (type == MIRType_Int32) {
             add->setTruncated(true);
+            add->setCommutative();
+        }
         return add;
     }
     void analyzeTruncateBackward();
 
     double getIdentity() {
         return 0;
     }
 
@@ -3096,16 +3098,17 @@ class MMul : public MBinaryArithInstruct
         canBeNegativeZero_(true),
         mode_(mode)
     {
         if (mode == Integer) {
             // This implements the required behavior for Math.imul, which
             // can never fail and always truncates its output to int32.
             canBeNegativeZero_ = false;
             setTruncated(true);
+            setCommutative();
         }
         JS_ASSERT_IF(mode != Integer, mode == Normal);
 
         if (type != MIRType_Value)
             specialization_ = type;
         setResultType(type);
     }