Index: test/mjsunit/regress/regress-2294.js |
diff --git a/test/mjsunit/regress/regress-2110.js b/test/mjsunit/regress/regress-2294.js |
similarity index 61% |
copy from test/mjsunit/regress/regress-2110.js |
copy to test/mjsunit/regress/regress-2294.js |
index d7f78d26a7b4d16c4217d2b0ac136e52e4542eb1..43ba10df03012600cbae0dc937e99aa9b9011209 100644 |
--- a/test/mjsunit/regress/regress-2110.js |
+++ b/test/mjsunit/regress/regress-2294.js |
@@ -27,27 +27,44 @@ |
// Flags: --allow-natives-syntax |
-var uint8 = new Uint8Array(1); |
+var clampedArray = new Uint8ClampedArray(10); |
function test() { |
- uint8[0] = 0x800000aa; |
- assertEquals(0xaa, uint8[0]); |
+ clampedArray[0] = 0.499; |
+ assertEquals(0, clampedArray[0]); |
+ clampedArray[0] = 0.5; |
+ assertEquals(0, clampedArray[0]); |
+ clampedArray[0] = 0.501; |
+ assertEquals(1, clampedArray[0]); |
+ clampedArray[0] = 1.499; |
+ assertEquals(1, clampedArray[0]); |
+ clampedArray[0] = 1.5; |
+ assertEquals(2, clampedArray[0]); |
+ clampedArray[0] = 1.501; |
+ assertEquals(2, clampedArray[0]); |
+ clampedArray[0] = 2.5; |
+ assertEquals(2, clampedArray[0]); |
+ clampedArray[0] = 3.5; |
+ assertEquals(4, clampedArray[0]); |
+ clampedArray[0] = 252.5; |
+ assertEquals(252, clampedArray[0]); |
+ clampedArray[0] = 253.5; |
+ assertEquals(254, clampedArray[0]); |
+ clampedArray[0] = 254.5; |
+ assertEquals(254, clampedArray[0]); |
+ clampedArray[0] = 256.5; |
+ assertEquals(255, clampedArray[0]); |
+ clampedArray[0] = -0.5; |
+ assertEquals(0, clampedArray[0]); |
+ clampedArray[0] = -1.5; |
+ assertEquals(0, clampedArray[0]); |
+ clampedArray[0] = 1000000000000; |
+ assertEquals(255, clampedArray[0]); |
+ clampedArray[0] = -1000000000000; |
+ assertEquals(0, clampedArray[0]); |
} |
test(); |
test(); |
-test(); |
%OptimizeFunctionOnNextCall(test); |
test(); |
- |
-var uint32 = new Uint32Array(1); |
- |
-function test2() { |
- uint32[0] = 0x80123456789abcde; |
- assertEquals(0x789ac000, uint32[0]); |
-} |
- |
-test2(); |
-test2(); |
-%OptimizeFunctionOnNextCall(test2); |
-test2(); |