Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: test/mjsunit/smi-ops.js

Issue 155281: X64: Fixed more bad smi operations. (Closed)
Patch Set: Different approach to unifying tests in count operations. Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/date-parse.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/smi-ops.js
diff --git a/test/mjsunit/smi-ops.js b/test/mjsunit/smi-ops.js
index 55203273ae68dc13ca27150d166368dfeb2ca517..284050d36c687da5e97af6b1e4d5c703448bf75e 100644
--- a/test/mjsunit/smi-ops.js
+++ b/test/mjsunit/smi-ops.js
@@ -56,15 +56,15 @@ function Add100Reversed(x) {
assertEquals(1, Add1(0)); // fast case
assertEquals(1, Add1Reversed(0)); // fast case
-assertEquals(SMI_MAX + ONE, Add1(SMI_MAX)); // overflow
-assertEquals(SMI_MAX + ONE, Add1Reversed(SMI_MAX)); // overflow
+assertEquals(SMI_MAX + ONE, Add1(SMI_MAX), "smimax + 1");
+assertEquals(SMI_MAX + ONE, Add1Reversed(SMI_MAX), "1 + smimax");
assertEquals(42 + ONE, Add1(OBJ_42)); // non-smi
assertEquals(42 + ONE, Add1Reversed(OBJ_42)); // non-smi
assertEquals(100, Add100(0)); // fast case
assertEquals(100, Add100Reversed(0)); // fast case
-assertEquals(SMI_MAX + ONE_HUNDRED, Add100(SMI_MAX)); // overflow
-assertEquals(SMI_MAX + ONE_HUNDRED, Add100Reversed(SMI_MAX)); // overflow
+assertEquals(SMI_MAX + ONE_HUNDRED, Add100(SMI_MAX), "smimax + 100");
+assertEquals(SMI_MAX + ONE_HUNDRED, Add100Reversed(SMI_MAX), " 100 + smimax");
assertEquals(42 + ONE_HUNDRED, Add100(OBJ_42)); // non-smi
assertEquals(42 + ONE_HUNDRED, Add100Reversed(OBJ_42)); // non-smi
@@ -148,8 +148,8 @@ assertEquals(21, Sar1(OBJ_42));
assertEquals(0, Shr1Reversed(OBJ_42));
assertEquals(0, Sar1Reversed(OBJ_42));
-assertEquals(6, Shr100(100));
-assertEquals(6, Sar100(100));
+assertEquals(6, Shr100(100), "100 >>> 100");
+assertEquals(6, Sar100(100), "100 >> 100");
assertEquals(12, Shr100Reversed(99));
assertEquals(12, Sar100Reversed(99));
assertEquals(201326592, Shr100(SMI_MIN));
@@ -201,17 +201,17 @@ assertEquals(0x16, x ^ y);
var v = 0;
assertEquals(-1, ~v);
v = SMI_MIN;
-assertEquals(0x3fffffff, ~v);
+assertEquals(0x3fffffff, ~v, "~smimin");
v = SMI_MAX;
-assertEquals(-0x40000000, ~v);
+assertEquals(-0x40000000, ~v, "~smimax");
// Overflowing ++ and --.
v = SMI_MAX;
v++;
-assertEquals(0x40000000, v);
+assertEquals(0x40000000, v, "smimax++");
v = SMI_MIN;
v--;
-assertEquals(-0x40000001, v);
+assertEquals(-0x40000001, v, "smimin--");
// Not actually Smi operations.
// Check that relations on unary ops work.
@@ -234,14 +234,14 @@ assertEquals(-2.25, -(v * v));
var x1 = 0x10000000;
var x2 = 0x40000002;
var x3 = 0x40000000;
-assertEquals(0x40000000, x1 << (x2 - x3));
+assertEquals(0x40000000, x1 << (x2 - x3), "0x10000000<<1(1)");
// Smi input to bitop gives non-smi result where the rhs could be overwritten
// if it were a float, but it isn't.
x1 = 0x10000000
x2 = 4
x3 = 2
-assertEquals(0x40000000, x1 << (x2 - x3));
+assertEquals(0x40000000, x1 << (x2 - x3), "0x10000000<<2(2)");
// Test shift operators on non-smi inputs, giving smi and non-smi results.
@@ -258,12 +258,12 @@ function testShiftNonSmis() {
assertEquals(neg_non_smi, (neg_non_smi) >> 0);
assertEquals(neg_non_smi + 0x100000000, (neg_non_smi) >>> 0);
assertEquals(neg_non_smi, (neg_non_smi) << 0);
- assertEquals(pos_smi, (pos_smi) >> 0);
- assertEquals(pos_smi, (pos_smi) >>> 0);
- assertEquals(pos_smi, (pos_smi) << 0);
- assertEquals(neg_smi, (neg_smi) >> 0);
- assertEquals(neg_smi + 0x100000000, (neg_smi) >>> 0);
- assertEquals(neg_smi, (neg_smi) << 0);
+ assertEquals(pos_smi, (pos_smi) >> 0, "possmi >> 0");
+ assertEquals(pos_smi, (pos_smi) >>> 0, "possmi >>>0");
+ assertEquals(pos_smi, (pos_smi) << 0, "possmi << 0");
+ assertEquals(neg_smi, (neg_smi) >> 0, "negsmi >> 0");
+ assertEquals(neg_smi + 0x100000000, (neg_smi) >>> 0, "negsmi >>> 0");
+ assertEquals(neg_smi, (neg_smi) << 0), "negsmi << 0";
assertEquals(pos_non_smi / 2, (pos_non_smi) >> 1);
assertEquals(pos_non_smi / 2, (pos_non_smi) >>> 1);
@@ -283,18 +283,22 @@ function testShiftNonSmis() {
assertEquals(-0x46536000, (pos_non_smi + 0.5) << 3);
assertEquals(0x73594000, (pos_non_smi + 0.5) << 4);
- assertEquals(neg_non_smi / 2, (neg_non_smi) >> 1);
- assertEquals(neg_non_smi / 2 + 0x100000000 / 2, (neg_non_smi) >>> 1);
+ assertEquals(neg_non_smi / 2, (neg_non_smi) >> 1, "negnonsmi >> 1");
+
+ assertEquals(neg_non_smi / 2 + 0x100000000 / 2, (neg_non_smi) >>> 1,
+ "negnonsmi >>> 1");
assertEquals(0x1194D800, (neg_non_smi) << 1);
assertEquals(neg_non_smi / 8, (neg_non_smi) >> 3);
assertEquals(neg_non_smi / 8 + 0x100000000 / 8, (neg_non_smi) >>> 3);
assertEquals(0x46536000, (neg_non_smi) << 3);
assertEquals(-0x73594000, (neg_non_smi) << 4);
assertEquals(neg_non_smi, (neg_non_smi - 0.5) >> 0);
- assertEquals(neg_non_smi + 0x100000000, (neg_non_smi - 0.5) >>> 0);
+ assertEquals(neg_non_smi + 0x100000000, (neg_non_smi - 0.5) >>> 0,
+ "negnonsmi.5 >>> 0");
assertEquals(neg_non_smi, (neg_non_smi - 0.5) << 0);
assertEquals(neg_non_smi / 2, (neg_non_smi - 0.5) >> 1);
- assertEquals(neg_non_smi / 2 + 0x100000000 / 2, (neg_non_smi - 0.5) >>> 1);
+ assertEquals(neg_non_smi / 2 + 0x100000000 / 2, (neg_non_smi - 0.5) >>> 1,
+ "negnonsmi.5 >>> 1");
assertEquals(0x1194D800, (neg_non_smi - 0.5) << 1);
assertEquals(neg_non_smi / 8, (neg_non_smi - 0.5) >> 3);
assertEquals(neg_non_smi / 8 + 0x100000000 / 8, (neg_non_smi - 0.5) >>> 3);
@@ -308,9 +312,9 @@ function testShiftNonSmis() {
assertEquals(pos_smi / 8, (pos_smi) >>> 3);
assertEquals(-0x2329b000, (pos_smi) << 3);
assertEquals(0x73594000, (pos_smi) << 5);
- assertEquals(pos_smi, (pos_smi + 0.5) >> 0);
- assertEquals(pos_smi, (pos_smi + 0.5) >>> 0);
- assertEquals(pos_smi, (pos_smi + 0.5) << 0);
+ assertEquals(pos_smi, (pos_smi + 0.5) >> 0, "possmi.5 >> 0");
+ assertEquals(pos_smi, (pos_smi + 0.5) >>> 0, "possmi.5 >>> 0");
+ assertEquals(pos_smi, (pos_smi + 0.5) << 0, "possmi.5 << 0");
assertEquals(pos_smi / 2, (pos_smi + 0.5) >> 1);
assertEquals(pos_smi / 2, (pos_smi + 0.5) >>> 1);
assertEquals(pos_non_smi, (pos_smi + 0.5) << 1);
@@ -326,9 +330,9 @@ function testShiftNonSmis() {
assertEquals(neg_smi / 8 + 0x100000000 / 8, (neg_smi) >>> 3);
assertEquals(0x46536000, (neg_smi) << 4);
assertEquals(-0x73594000, (neg_smi) << 5);
- assertEquals(neg_smi, (neg_smi - 0.5) >> 0);
- assertEquals(neg_smi + 0x100000000, (neg_smi - 0.5) >>> 0);
- assertEquals(neg_smi, (neg_smi - 0.5) << 0);
+ assertEquals(neg_smi, (neg_smi - 0.5) >> 0, "negsmi.5 >> 0");
+ assertEquals(neg_smi + 0x100000000, (neg_smi - 0.5) >>> 0, "negsmi.5 >>> 0");
+ assertEquals(neg_smi, (neg_smi - 0.5) << 0, "negsmi.5 << 0");
assertEquals(neg_smi / 2, (neg_smi - 0.5) >> 1);
assertEquals(neg_smi / 2 + 0x100000000 / 2, (neg_smi - 0.5) >>> 1);
assertEquals(neg_non_smi, (neg_smi - 0.5) << 1);
@@ -349,12 +353,12 @@ function testShiftNonSmis() {
assertEquals(neg_non_smi, (neg_32 + neg_non_smi) >> 0);
assertEquals(neg_non_smi + 0x100000000, (neg_32 + neg_non_smi) >>> 0);
assertEquals(neg_non_smi, (neg_32 + neg_non_smi) << 0);
- assertEquals(pos_smi, (two_32 + pos_smi) >> 0);
- assertEquals(pos_smi, (two_32 + pos_smi) >>> 0);
- assertEquals(pos_smi, (two_32 + pos_smi) << 0);
- assertEquals(neg_smi, (neg_32 + neg_smi) >> 0);
+ assertEquals(pos_smi, (two_32 + pos_smi) >> 0, "2^32+possmi >> 0");
+ assertEquals(pos_smi, (two_32 + pos_smi) >>> 0, "2^32+possmi >>> 0");
+ assertEquals(pos_smi, (two_32 + pos_smi) << 0, "2^32+possmi << 0");
+ assertEquals(neg_smi, (neg_32 + neg_smi) >> 0, "2^32+negsmi >> 0");
assertEquals(neg_smi + 0x100000000, (neg_32 + neg_smi) >>> 0);
- assertEquals(neg_smi, (neg_32 + neg_smi) << 0);
+ assertEquals(neg_smi, (neg_32 + neg_smi) << 0, "2^32+negsmi << 0");
assertEquals(pos_non_smi / 2, (two_32 + pos_non_smi) >> 1);
assertEquals(pos_non_smi / 2, (two_32 + pos_non_smi) >>> 1);
@@ -419,9 +423,9 @@ function testShiftNonSmis() {
assertEquals((neg_smi + 0x100000000) / 8, (neg_32 + neg_smi) >>> 3);
assertEquals(0x46536000, (neg_32 + neg_smi) << 4);
assertEquals(-0x73594000, (neg_32 + neg_smi) << 5);
- assertEquals(neg_smi, (neg_32 + neg_smi - 0.5) >> 0);
+ assertEquals(neg_smi, (neg_32 + neg_smi - 0.5) >> 0, "-2^32+negsmi.5 >> 0");
assertEquals(neg_smi + 0x100000000, (neg_32 + neg_smi - 0.5) >>> 0);
- assertEquals(neg_smi, (neg_32 + neg_smi - 0.5) << 0);
+ assertEquals(neg_smi, (neg_32 + neg_smi - 0.5) << 0, "-2^32+negsmi.5 << 0");
assertEquals(neg_smi / 2, (neg_32 + neg_smi - 0.5) >> 1);
assertEquals(neg_smi / 2 + 0x100000000 / 2, (neg_32 + neg_smi - 0.5) >>> 1);
assertEquals(neg_non_smi, (neg_32 + neg_smi - 0.5) << 1);
@@ -447,9 +451,9 @@ function testShiftNonSmis() {
assertEquals(pos_smi, (pos_smi) >> zero);
assertEquals(pos_smi, (pos_smi) >>> zero);
assertEquals(pos_smi, (pos_smi) << zero);
- assertEquals(neg_smi, (neg_smi) >> zero);
+ assertEquals(neg_smi, (neg_smi) >> zero, "negsmi >> zero");
assertEquals(neg_smi + 0x100000000, (neg_smi) >>> zero);
- assertEquals(neg_smi, (neg_smi) << zero);
+ assertEquals(neg_smi, (neg_smi) << zero, "negsmi << zero");
assertEquals(pos_non_smi / 2, (pos_non_smi) >> one);
assertEquals(pos_non_smi / 2, (pos_non_smi) >>> one);
@@ -543,9 +547,9 @@ function testShiftNonSmis() {
assertEquals(pos_smi, (pos_smi) >> zero);
assertEquals(pos_smi, (pos_smi) >>> zero);
assertEquals(pos_smi, (pos_smi) << zero);
- assertEquals(neg_smi, (neg_smi) >> zero);
+ assertEquals(neg_smi, (neg_smi) >> zero, "negsmi >> zero(2)");
assertEquals(neg_smi + 0x100000000, (neg_smi) >>> zero);
- assertEquals(neg_smi, (neg_smi) << zero);
+ assertEquals(neg_smi, (neg_smi) << zero, "negsmi << zero(2)");
assertEquals(pos_non_smi / 2, (pos_non_smi) >> one);
assertEquals(pos_non_smi / 2, (pos_non_smi) >>> one);
@@ -609,9 +613,9 @@ function testShiftNonSmis() {
assertEquals(neg_smi / 8 + 0x100000000 / 8, (neg_smi) >>> three);
assertEquals(0x46536000, (neg_smi) << four);
assertEquals(-0x73594000, (neg_smi) << five);
- assertEquals(neg_smi, (neg_smi - 0.5) >> zero);
+ assertEquals(neg_smi, (neg_smi - 0.5) >> zero, "negsmi.5 >> zero");
assertEquals(neg_smi + 0x100000000, (neg_smi - 0.5) >>> zero);
- assertEquals(neg_smi, (neg_smi - 0.5) << zero);
+ assertEquals(neg_smi, (neg_smi - 0.5) << zero, "negsmi.5 << zero");
assertEquals(neg_smi / 2, (neg_smi - 0.5) >> one);
assertEquals(neg_smi / 2 + 0x100000000 / 2, (neg_smi - 0.5) >>> one);
assertEquals(neg_non_smi, (neg_smi - 0.5) << one);
« no previous file with comments | « test/mjsunit/date-parse.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698