Bug 878433 - OdinMonkey: (signed % signed) should be intish, not int (r=bbouvier)
☠☠ backed out by 9786c829bf3c ☠ ☠
authorLuke Wagner <luke@mozilla.com>
Mon, 10 Jun 2013 16:23:44 -0700
changeset 134582 841ffd181e14667ea9a272ba169429db688caa8e
parent 134581 8e30d56cf29d43ed0a43d905767ed96987254df2
child 134583 1eff67ffe6b978c59bed371c0e3df7eb81bf8560
push id29283
push userlwagner@mozilla.com
push dateMon, 10 Jun 2013 23:42:33 +0000
treeherdermozilla-inbound@1eff67ffe6b9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs878433
milestone24.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 878433 - OdinMonkey: (signed % signed) should be intish, not int (r=bbouvier)
js/src/ion/AsmJS.cpp
js/src/jit-test/tests/asm.js/testExpressions.js
--- a/js/src/ion/AsmJS.cpp
+++ b/js/src/ion/AsmJS.cpp
@@ -3963,28 +3963,28 @@ CheckDivOrMod(FunctionCompiler &f, Parse
     }
 
     if (lhsType.isSigned() && rhsType.isSigned()) {
         if (expr->isKind(PNK_DIV)) {
             *def = f.binary<MDiv>(lhsDef, rhsDef, MIRType_Int32);
             *type = Type::Intish;
         } else {
             *def = f.binary<MMod>(lhsDef, rhsDef, MIRType_Int32);
-            *type = Type::Int;
+            *type = Type::Intish;
         }
         return true;
     }
 
     if (lhsType.isUnsigned() && rhsType.isUnsigned()) {
         if (expr->isKind(PNK_DIV)) {
             *def = f.binary<MAsmJSUDiv>(lhsDef, rhsDef);
             *type = Type::Intish;
         } else {
             *def = f.binary<MAsmJSUMod>(lhsDef, rhsDef);
-            *type = Type::Int;
+            *type = Type::Intish;
         }
         return true;
     }
 
     return f.failf(expr, "arguments to / or &% must both be double, signed, or unsigned, "
                    "%s and %s are given", lhsType.toChars(), rhsType.toChars());
 }
 
--- a/js/src/jit-test/tests/asm.js/testExpressions.js
+++ b/js/src/jit-test/tests/asm.js/testExpressions.js
@@ -17,16 +17,21 @@ assertAsmTypeFail(USE_ASM + "function f(
 assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0.0; return (i%j)|0 } return f");
 assertAsmTypeFail(USE_ASM + "function f() { var i=0.0,j=0; return (i%j)|0 } return f");
 assertAsmTypeFail(USE_ASM + "function f() { var i=0.0,j=0; return (i<j)|0 } return f");
 assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0.0; return (i<j)|0 } return f");
 assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0; return (i<j)|0 } return f");
 assertAsmTypeFail(USE_ASM + "function f() { var i=0.0; return (-i)|0 } return f");
 assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0; return (-(i+j))|0 } return f");
 
+assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0,k=0; k = (i|0)/(k|0) } return f");
+assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0,k=0; k = (i>>>0)/(k>>>0) } return f");
+assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0,k=0; k = (i|0)%(k|0) } return f");
+assertAsmTypeFail(USE_ASM + "function f() { var i=0,j=0,k=0; k = (i>>>0)%(k>>>0) } return f");
+
 const UINT32_MAX = Math.pow(2,32)-1;
 const INT32_MIN = -Math.pow(2,31);
 const INT32_MAX = Math.pow(2,31)-1;
 
 var f = asmLink(asmCompile(USE_ASM + "function f(i) { i=i|0; return (i*2)|0 } return f"));
 assertEq(f(0), 0);
 assertEq(f(INT32_MIN), (2*INT32_MIN)|0);
 assertEq(f(INT32_MAX), (2*INT32_MAX)|0);
@@ -157,17 +162,17 @@ assertEq(f(INT32_MAX, INT32_MAX), 1);
 assertEq(f(INT32_MAX, INT32_MIN), 0);
 assertEq(f(UINT32_MAX, INT32_MAX), 2);
 assertEq(f(INT32_MAX, UINT32_MAX), 0);
 assertEq(f(UINT32_MAX, UINT32_MAX), 1);
 assertEq(f(INT32_MIN, INT32_MAX), 1);
 assertEq(f(INT32_MIN, UINT32_MAX), 0);
 assertEq(f(INT32_MIN, INT32_MIN), 1);
 
-var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k = 0; k = (i|0)%(j|0); return k|0 } return f"));
+var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k = 0; k = (i|0)%(j|0)|0; return k|0 } return f"));
 assertEq(f(4,2), 0);
 assertEq(f(3,2), 1);
 assertEq(f(3,-2), 1);
 assertEq(f(-3,-2), -1);
 assertEq(f(0, -1), 0);
 assertEq(f(0, INT32_MAX), 0);
 assertEq(f(0, INT32_MIN), 0);
 assertEq(f(INT32_MAX, 0), 0);
@@ -176,27 +181,27 @@ assertEq(f(-1, INT32_MAX), -1);
 assertEq(f(-1, INT32_MIN), -1);
 assertEq(f(INT32_MAX, -1), 0);
 assertEq(f(INT32_MIN, -1), 0); // !!
 assertEq(f(INT32_MAX, INT32_MAX), 0);
 assertEq(f(INT32_MAX, INT32_MIN), INT32_MAX);
 assertEq(f(INT32_MIN, INT32_MAX), -1);
 assertEq(f(INT32_MIN, INT32_MIN), 0);
 
-var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k = 0; k = (i|0)%4; return k|0 } return f"));
+var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k = 0; k = (i|0)%4|0; return k|0 } return f"));
 assertEq(f(0), 0);
 assertEq(f(-1), -1);
 assertEq(f(-3), -3);
 assertEq(f(-4), 0);
 assertEq(f(INT32_MIN), 0);
 assertEq(f(3), 3);
 assertEq(f(4), 0);
 assertEq(f(INT32_MAX), 3);
 
-var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k = 0; k = (i>>>0)%(j>>>0); return k|0 } return f"));
+var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; var k = 0; k = (i>>>0)%(j>>>0)|0; return k|0 } return f"));
 assertEq(f(4,2), 0);
 assertEq(f(3,2), 1);
 assertEq(f(3,-2), 3);
 assertEq(f(-3,-2), -3);
 assertEq(f(0, -1), 0);
 assertEq(f(0, INT32_MAX), 0);
 assertEq(f(0, INT32_MIN), 0);
 assertEq(f(0, UINT32_MAX), 0);