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

Unified Diff: test/mjsunit/regress/regress-2294.js

Issue 10831409: Fix rounding in Uint8ClampedArray setter. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix manual rounding Created 8 years, 4 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 | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698