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/regress/regress-2294.js

Issue 10831409: Fix rounding in Uint8ClampedArray setter. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« src/platform-win32.cc ('K') | « 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/compiler/inline-arity-mismatch.js b/test/mjsunit/regress/regress-2294.js
similarity index 62%
copy from test/mjsunit/compiler/inline-arity-mismatch.js
copy to test/mjsunit/regress/regress-2294.js
index 4a61fa3a62c36f8f53b12cde023f52bdb6e1abc7..40318a2d2149290e8fd89ccca3840c828b3e11f6 100644
--- a/test/mjsunit/compiler/inline-arity-mismatch.js
+++ b/test/mjsunit/regress/regress-2294.js
@@ -27,36 +27,40 @@
// Flags: --allow-natives-syntax
-// Test inlining at call sites with mismatched arity.
+var clampedArray = new Uint8ClampedArray(10);
-function f(a) {
- return a.x;
+function setElement(i, x) {
+ clampedArray[i] = x;
}
-function g(a, b) {
- return a.x;
+for (var i = 0; i < 2; i++) {
+ setElement(0, 0.499)
+ assertEquals(0, clampedArray[0]);
+ setElement(0, 0.5)
+ assertEquals(0, clampedArray[0]);
+ setElement(0, 0.501)
+ assertEquals(1, clampedArray[0]);
+ setElement(0, 1.499)
+ assertEquals(1, clampedArray[0]);
+ setElement(0, 1.5)
+ assertEquals(2, clampedArray[0]);
+ setElement(0, 1.501)
+ assertEquals(2, clampedArray[0]);
+ setElement(0, 2.5)
+ assertEquals(2, clampedArray[0]);
+ setElement(0, 3.5)
+ assertEquals(4, clampedArray[0]);
+ setElement(0, 252.5)
+ assertEquals(252, clampedArray[0]);
+ setElement(0, 253.5)
+ assertEquals(254, clampedArray[0]);
+ setElement(0, 254.5)
+ assertEquals(254, clampedArray[0]);
+ setElement(0, 256.5)
+ assertEquals(255, clampedArray[0]);
+ setElement(0, -0.5)
+ assertEquals(0, clampedArray[0]);
+ setElement(0, -1.5)
+ assertEquals(0, clampedArray[0]);
+ %OptimizeFunctionOnNextCall(setElement)
Yang 2012/08/22 07:57:07 setElement may be optimized before the first itera
ulan 2012/08/22 13:48:17 Done.
}
-
-function h1(a, b) {
- return f(a, a) * g(b);
-}
-
-function h2(a, b) {
- return f(a, a) * g(b);
-}
-
-
-var o = {x: 2};
-
-assertEquals(4, h1(o, o));
-assertEquals(4, h1(o, o));
-assertEquals(4, h2(o, o));
-assertEquals(4, h2(o, o));
-%OptimizeFunctionOnNextCall(h1);
-%OptimizeFunctionOnNextCall(h2);
-assertEquals(4, h1(o, o));
-assertEquals(4, h2(o, o));
-
-var u = {y:0, x:1};
-assertEquals(2, h1(u, o));
-assertEquals(2, h2(o, u));
« src/platform-win32.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698