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

Unified Diff: test/mjsunit/compiler/truncating-store.js

Issue 758643003: [turbofan] Insert appropriate conversions for typed array stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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/compiler/js-typed-lowering.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/truncating-store.js
diff --git a/test/mjsunit/compiler/truncating-store.js b/test/mjsunit/compiler/truncating-store.js
index 2af9e3b5a67d8374da088186c0e60aa7c3cffec0..9e3dd381e01586e69069731ea96ab6eda9b41626 100644
--- a/test/mjsunit/compiler/truncating-store.js
+++ b/test/mjsunit/compiler/truncating-store.js
@@ -2,72 +2,97 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-var asm = (function Module(global, env, buffer) {
- "use asm";
-
- var i8 = new global.Int8Array(buffer);
- var u8 = new global.Uint8Array(buffer);
- var i16 = new global.Int16Array(buffer);
- var u16 = new global.Uint16Array(buffer);
- var i32 = new global.Int32Array(buffer);
- var u32 = new global.Uint32Array(buffer);
-
- var H = 0;
-
- function store_i8() {
- H = 4294967295;
- i8[0 >> 0]= H;
- return i8[0 >> 0];
- }
-
- function store_u8() {
- H = 4294967295;
- u8[0 >> 0]= H;
- return u8[0 >> 0];
- }
-
- function store_i16() {
- H = 4294967295;
- i16[0 >> 0]= H;
- return i16[0 >> 0];
- }
-
- function store_u16() {
- H = 4294967295;
- u16[0 >> 0]= H;
- return u16[0 >> 0];
- }
-
- function store_i32() {
- H = 4294967295;
- i32[0 >> 0]= H;
- return i32[0 >> 0];
- }
-
- function store_u32() {
- H = 4294967295;
- u32[0 >> 0]= H;
- return u32[0 >> 0];
- }
-
- return { store_i8: store_i8,
- store_u8: store_u8,
- store_i16: store_i16,
- store_u16: store_u16,
- store_i32: store_i32,
- store_u32: store_u32 };
-})({
- "Int8Array": Int8Array,
- "Uint8Array": Uint8Array,
- "Int16Array": Int16Array,
- "Uint16Array": Uint16Array,
- "Int32Array": Int32Array,
- "Uint32Array": Uint32Array
-}, {}, new ArrayBuffer(64 * 1024));
-
-assertEquals(-1, asm.store_i8());
-assertEquals(255, asm.store_u8());
-assertEquals(-1, asm.store_i16());
-assertEquals(65535, asm.store_u16());
-assertEquals(-1, asm.store_i32());
-assertEquals(4294967295, asm.store_u32());
+(function() {
+ var asm = (function Module(global, env, buffer) {
+ "use asm";
+
+ var i8 = new global.Int8Array(buffer);
+ var u8 = new global.Uint8Array(buffer);
+ var i16 = new global.Int16Array(buffer);
+ var u16 = new global.Uint16Array(buffer);
+ var i32 = new global.Int32Array(buffer);
+ var u32 = new global.Uint32Array(buffer);
+
+ var H = 0;
+
+ function store_i8() {
+ H = 4294967295;
+ i8[0 >> 0]= H;
+ return i8[0 >> 0];
+ }
+
+ function store_u8() {
+ H = 4294967295;
+ u8[0 >> 0]= H;
+ return u8[0 >> 0];
+ }
+
+ function store_i16() {
+ H = 4294967295;
+ i16[0 >> 0]= H;
+ return i16[0 >> 0];
+ }
+
+ function store_u16() {
+ H = 4294967295;
+ u16[0 >> 0]= H;
+ return u16[0 >> 0];
+ }
+
+ function store_i32() {
+ H = 4294967295;
+ i32[0 >> 0]= H;
+ return i32[0 >> 0];
+ }
+
+ function store_u32() {
+ H = 4294967295;
+ u32[0 >> 0]= H;
+ return u32[0 >> 0];
+ }
+
+ return { store_i8: store_i8,
+ store_u8: store_u8,
+ store_i16: store_i16,
+ store_u16: store_u16,
+ store_i32: store_i32,
+ store_u32: store_u32 };
+ })({
+ "Int8Array": Int8Array,
+ "Uint8Array": Uint8Array,
+ "Int16Array": Int16Array,
+ "Uint16Array": Uint16Array,
+ "Int32Array": Int32Array,
+ "Uint32Array": Uint32Array
+ }, {}, new ArrayBuffer(64 * 1024));
+
+ assertEquals(-1, asm.store_i8());
+ assertEquals(255, asm.store_u8());
+ assertEquals(-1, asm.store_i16());
+ assertEquals(65535, asm.store_u16());
+ assertEquals(-1, asm.store_i32());
+ assertEquals(4294967295, asm.store_u32());
+})();
+
+(function() {
+ var asm = (function Module(global, env, buffer) {
+ "use asm";
+
+ var i32 = new global.Int32Array(buffer);
+
+ var H = 0;
+
+ // This is not valid asm.js, but we should still generate correct code.
+ function store_i32_from_string() {
+ H = "3";
+ i32[0 >> 0]= H;
+ return i32[0 >> 0];
+ }
+
+ return { store_i32_from_string: store_i32_from_string };
+ })({
+ "Int32Array": Int32Array
+ }, {}, new ArrayBuffer(64 * 1024));
+
+ assertEquals(3, asm.store_i32_from_string());
+})();
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698