Index: test/mjsunit/external-array.js |
diff --git a/test/mjsunit/external-array.js b/test/mjsunit/external-array.js |
index 3fcd544ab69a4b7807393d12eb8fc4bc5b3c98cf..ab5435e5d653a8fb2447a3cd3271f63b3dc15fb8 100644 |
--- a/test/mjsunit/external-array.js |
+++ b/test/mjsunit/external-array.js |
@@ -678,3 +678,37 @@ boo(built_in_array, 0, 2.5); |
assertEquals(2.5, goo(built_in_array, 0)); |
%ClearFunctionTypeFeedback(goo); |
%ClearFunctionTypeFeedback(boo); |
+ |
+// Check all int range edge cases |
+function checkRange() { |
+ var e32 = Math.pow(2,32); var e31 = Math.pow(2,31); |
+ var e16 = Math.pow(2,16); var e15 = Math.pow(2,15); |
+ var e8 = Math.pow(2,8); var e7 = Math.pow(2,7); |
+ var a7 = new Uint32Array(2); var a71 = new Int32Array(2); |
+ var a72 = new Uint16Array(2); var a73 = new Int16Array(2); |
+ var a74 = new Uint8Array(2); var a75 = new Int8Array(2); |
+ for (i = 1; i <= Math.pow(2,33); i *= 2) { |
+ var j = i-1; |
+ a7[0] = i; a71[0] = i; a72[0] = i; a73[0] = i; a74[0] = i; a75[0] = i; |
+ a7[1] = j; a71[1] = j; a72[1] = j; a73[1] = j; a74[1] = j; a75[1] = j; |
+ |
+ if (i < e32) { assertEquals(a7[0], i); } else { assertEquals(a7[0], 0); } |
+ if (j < e32) { assertEquals(a7[1], j); } else { assertEquals(a7[1],e32-1); } |
+ if (i < e31) { assertEquals(a71[0], i); } else { |
+ assertEquals(a71[0], (i < e32) ? -e31 : 0 ); } |
+ if (j < e31) { assertEquals(a71[1], j); } else { assertEquals(a71[1], -1); } |
+ |
+ if (i < e16) { assertEquals(a72[0], i); } else { assertEquals(a72[0], 0); } |
+ if (j < e16) { assertEquals(a72[1], j); } else { assertEquals(a72[1], e16-1); } |
+ if (i < e15) { assertEquals(a73[0], i); } else { |
+ assertEquals(a73[0], (i < e16) ? -e15 : 0 ); } |
+ if (j < e15) { assertEquals(a73[1], j); } else { assertEquals(a73[1], -1); } |
+ |
+ if (i < e8) { assertEquals(a74[0], i); } else { assertEquals(a74[0], 0); } |
+ if (j < e8) { assertEquals(a74[1], j); } else { assertEquals(a74[1], e8-1); } |
+ if (i < e7) { assertEquals(a75[0], i); } else { |
+ assertEquals(a75[0], (i < e8) ? -e7 : 0); } |
+ if (j < e7) { assertEquals(a75[1], j); } else { assertEquals(a75[1], -1); } |
+ } |
+} |
+checkRange(); |