Modified: trunk/LayoutTests/fast/js/regress/script-tests/integer-modulo.js (141030 => 141031)
--- trunk/LayoutTests/fast/js/regress/script-tests/integer-modulo.js 2013-01-29 01:29:12 UTC (rev 141030)
+++ trunk/LayoutTests/fast/js/regress/script-tests/integer-modulo.js 2013-01-29 01:42:07 UTC (rev 141031)
@@ -1,8 +1,5 @@
-description(
-"Tests that modulo of various values do the right thing."
-);
+// This tests that integer modulo is appropriately optimized
-
function myMod(a, b) {
return a % b;
}
@@ -38,43 +35,48 @@
var y = -131071;
var z = 3;
+var result = 0;
+
// Use a loop to ensure we cover all three tiers of optimization.
-for (var i = 0; i < 200; ++i) {
- shouldBe("myMod(x, t)", "5");
- shouldBe("myMod(y, t)", "-1");
- shouldBe("myMod(x, z)", "0");
- shouldBe("myMod(y, z)", "-1");
- shouldBe("myModByPos2(x)", "1");
- shouldBe("myModByPos2(y)", "-1");
- shouldBe("myModByPos5(x)", "0");
- shouldBe("myModByPos5(y)", "-1");
- shouldBe("myModByPos8(x)", "7");
- shouldBe("myModByPos8(y)", "-7");
- shouldBe("myModByNeg1(x)", "0");
- shouldBe("myModByNeg1(y)", "-0");
- shouldBe("myModByNeg4(x)", "3");
- shouldBe("myModByNeg4(y)", "-3");
- shouldBe("myModByNeg81(x)", "6");
- shouldBe("myModByNeg81(y)", "-13");
+for (var i = 0; i < 2000; ++i) {
+ result += myMod(x, t);
+ result += myMod(y, t);
+ result += myMod(x, z);
+ result += myMod(y, z);
+ result += myModByPos2(x);
+ result += myModByPos2(y);
+ result += myModByPos5(x);
+ result += myModByPos5(y);
+ result += myModByPos8(x);
+ result += myModByPos8(y);
+ result += myModByNeg1(x);
+ result += myModByNeg1(y);
+ result += myModByNeg4(x);
+ result += myModByNeg4(y);
+ result += myModByNeg81(x);
+ result += myModByNeg81(y);
if (i > 100) {
v = x;
w = y;
}
- shouldBe("myMod(v, t)", i > 100 ? "5" : "2");
- shouldBe("myMod(w, t)", i > 100 ? "-1" : "4");
- shouldBe("myModByPos2(v)", i > 100 ? "1" : "0");
- shouldBe("myModByPos2(w)", i > 100 ? "-1" : "0");
- shouldBe("myModByPos5(v)", i > 100 ? "0" : "2");
- shouldBe("myModByPos5(w)", i > 100 ? "-1" : "4");
- shouldBe("myModByPos8(v)", i > 100 ? "7" : "2");
- shouldBe("myModByPos8(w)", i > 100 ? "-7" : "4");
- shouldBe("myModByNeg1(v)", i > 100 ? "0" : "0");
- shouldBe("myModByNeg1(w)", i > 100 ? "-0" : "0");
- shouldBe("myModByNeg4(v)", i > 100 ? "3" : "2");
- shouldBe("myModByNeg4(w)", i > 100 ? "-3" : "0");
- shouldBe("myModByNeg81(v)", i > 100 ? "6" : "2");
- shouldBe("myModByNeg81(w)", i > 100 ? "-13" : "4");
+ result += myMod(v, t);
+ result += myMod(w, t);
+ result += myModByPos2(v);
+ result += myModByPos2(w);
+ result += myModByPos5(v);
+ result += myModByPos5(w);
+ result += myModByPos8(v);
+ result += myModByPos8(w);
+ result += myModByNeg1(v);
+ result += myModByNeg1(w);
+ result += myModByNeg4(v);
+ result += myModByNeg4(w);
+ result += myModByNeg81(v);
+ result += myModByNeg81(w);
}
+if (result != -14970) {
+ throw "Bad result: " + result;
+}