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

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

Issue 12918028: Canonicalize NaNs on store to Fast(Float|Double) arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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/hydrogen-instructions.cc ('K') | « src/hydrogen-instructions.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-2596.js
diff --git a/test/mjsunit/compiler/regress-const.js b/test/mjsunit/regress/regress-2596.js
similarity index 73%
copy from test/mjsunit/compiler/regress-const.js
copy to test/mjsunit/regress/regress-2596.js
index aa55d0fd3ae17051a084a6bf28c2257f2abc8495..201b88ac99b31330b19951c58357ef6fa5432214 100644
--- a/test/mjsunit/compiler/regress-const.js
+++ b/test/mjsunit/regress/regress-2596.js
@@ -27,42 +27,30 @@
// Flags: --allow-natives-syntax
-// Test const initialization and assignments.
-function f() {
- var x = 42;
- while (true) {
- const y = x;
- if (--x == 0) return y;
- }
+var bytes = new Uint8Array([
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f]); // kHoleNaN
+var doubles = new Float64Array(bytes.buffer);
+assertTrue(isNaN(doubles[0]));
+
+var prototype = [2.5, 2.5];
+var array = [3.5, 3.5];
+array.__proto__ = prototype;
+assertTrue(%HasFastDoubleElements(array));
+
+function boom(index) {
+ array[index] = doubles[0];
+ return array[index];
}
-function g() {
- const x = 42;
- x += 1;
- return x;
-}
-
-for (var i = 0; i < 5; i++) {
- f();
- g();
-}
-
-%OptimizeFunctionOnNextCall(f);
-%OptimizeFunctionOnNextCall(g);
+assertTrue(isNaN(boom(0)));
+assertTrue(isNaN(boom(0)));
+assertTrue(isNaN(boom(0)));
-assertEquals(42, f());
-assertEquals(42, g());
-
-
-function h(a, b) {
- var r = a + b;
- const X = 42;
- return r + X;
-}
+// Test hydrogen
+%OptimizeFunctionOnNextCall(boom);
+assertTrue(isNaN(boom(0)));
+assertTrue(isNaN(boom(0)));
+assertTrue(isNaN(boom(0)));
-for (var i = 0; i < 5; i++) h(1,2);
-%OptimizeFunctionOnNextCall(h);
-assertEquals(45, h(1,2));
-assertEquals("foo742", h("foo", 7));
« src/hydrogen-instructions.cc ('K') | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698