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

Unified Diff: test/mjsunit/wasm/instantiate-module-basic.js

Issue 2460773003: [wasm] make WebAssembly.Instance require a WebAssembly.Memory (Closed)
Patch Set: Created 4 years, 2 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 | « test/mjsunit/wasm/compiled-module-serialization.js ('k') | test/mjsunit/wasm/module-memory.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/instantiate-module-basic.js
diff --git a/test/mjsunit/wasm/instantiate-module-basic.js b/test/mjsunit/wasm/instantiate-module-basic.js
index dd5871f13f62bf3640781e5c4075efbd403d14c5..36f7429d96713a179d3c9ec5636133c36d881bc0 100644
--- a/test/mjsunit/wasm/instantiate-module-basic.js
+++ b/test/mjsunit/wasm/instantiate-module-basic.js
@@ -141,10 +141,10 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88)));
var module = new WebAssembly.Module(builder.toBuffer());
- var mem_1 = new ArrayBuffer(4);
- var mem_2 = new ArrayBuffer(4);
- var view_1 = new Int32Array(mem_1);
- var view_2 = new Int32Array(mem_2);
+ var mem_1 = new WebAssembly.Memory({initial: 1});
+ var mem_2 = new WebAssembly.Memory({initial: 1});
+ var view_1 = new Int32Array(mem_1.buffer);
+ var view_2 = new Int32Array(mem_2.buffer);
view_1[0] = 42;
view_2[0] = 1000;
@@ -199,10 +199,10 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88)));
kExprI32LoadMem, 0, 0
]).exportFunc();
- var mem_1 = new ArrayBuffer(65536);
- var mem_2 = new ArrayBuffer(65536);
- var view_1 = new Int32Array(mem_1);
- var view_2 = new Int32Array(mem_2);
+ var mem_1 = new WebAssembly.Memory({initial: 1});
+ var mem_2 = new WebAssembly.Memory({initial: 1});
+ var view_1 = new Int32Array(mem_1.buffer);
+ var view_2 = new Int32Array(mem_2.buffer);
view_1[0] = 1;
view_2[0] = 1000;
@@ -213,3 +213,9 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88)));
assertEquals(1, i1.exports.f());
assertEquals(1000, i2.exports.f());
})();
+
+(function MustBeMemory() {
+ var memory = new ArrayBuffer(65536);
+ var module = new WebAssembly.Module(buffer);
+ assertThrows(() => new WebAssembly.Instance(module, null, memory), TypeError);
+})();
« no previous file with comments | « test/mjsunit/wasm/compiled-module-serialization.js ('k') | test/mjsunit/wasm/module-memory.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698