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

Unified Diff: test/mjsunit/external-array.js

Issue 9402008: Uniformly handle 'undefined' store to Float64Array and Float32Array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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/objects.cc ('K') | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/external-array.js
diff --git a/test/mjsunit/external-array.js b/test/mjsunit/external-array.js
index 72cfd8595638dce1e9e8f090e322d82b4984934b..15ff8e7caa7669a3ea168681e8d027543c0cc080 100644
--- a/test/mjsunit/external-array.js
+++ b/test/mjsunit/external-array.js
@@ -317,3 +317,43 @@ for (var t = 0; t < types.length; t++) {
%DeoptimizeFunction(array_load_set_smi_check2);
gc(); // Makes V8 forget about type information for array_load_set_smi_check.
}
+
+// Check handling of undefined in 32- and 64-bit external float arrays.
+
+function store_float32_undefined(ext_array) {
+ for (var i = 0; i < 8; i++) {
Michael Starzinger 2012/02/15 13:39:29 Is there a particular reason the assignment has to
danno 2012/02/16 07:55:40 Done.
+ ext_array[7] = undefined;
+ }
+}
+
+var float32_array = new Float32Array(8);
+// Make sure runtime does it right
+store_float32_undefined(float32_array);
+assertTrue(isNaN(float32_array[7]));
+// Make sure the ICs do it right
+store_float32_undefined(float32_array);
+assertTrue(isNaN(float32_array[7]));
+// Make sure that Cranskshft does it right.
+%OptimizeFunctionOnNextCall(store_float32_undefined);
+store_float32_undefined(float32_array);
+store_float32_undefined(float32_array);
Michael Starzinger 2012/02/15 13:39:29 Is there a particular reason the store function is
danno 2012/02/16 07:55:40 Done.
+assertTrue(isNaN(float32_array[7]));
+
+function store_float64_undefined(ext_array) {
+ for (var i = 0; i < 8; i++) {
Michael Starzinger 2012/02/15 13:39:29 Likewise.
danno 2012/02/16 07:55:40 Done.
+ ext_array[7] = undefined;
+ }
+}
+
+var float64_array = new Float64Array(8);
+// Make sure runtime does it right
+store_float64_undefined(float64_array);
+assertTrue(isNaN(float64_array[7]));
+// Make sure the ICs do it right
+store_float64_undefined(float64_array);
+assertTrue(isNaN(float64_array[7]));
+// Make sure that Cranskshft does it right.
+%OptimizeFunctionOnNextCall(store_float64_undefined);
+store_float64_undefined(float64_array);
+store_float64_undefined(float64_array);
Michael Starzinger 2012/02/15 13:39:29 Likewise.
danno 2012/02/16 07:55:40 Done.
+assertTrue(isNaN(float64_array[7]));
« src/objects.cc ('K') | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698