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

Unified Diff: test/mjsunit/wasm/module-memory.js

Issue 2627763002: [wasm] JS APIs & memory (Closed)
Patch Set: Created 3 years, 11 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/js-api.js ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/module-memory.js
diff --git a/test/mjsunit/wasm/module-memory.js b/test/mjsunit/wasm/module-memory.js
index d7cc1297c92bca84d7985d6b28d2aeca5d94e71e..ff11465fe87d4a89930e6c566cb8acb0eecf4ff6 100644
--- a/test/mjsunit/wasm/module-memory.js
+++ b/test/mjsunit/wasm/module-memory.js
@@ -12,7 +12,8 @@ var kMemSize = 65536;
function genModule(memory) {
var builder = new WasmModuleBuilder();
- builder.addMemory(1, 1, true);
+ builder.addImportedMemory("", "memory", 1, 1);
+ builder.exportMemoryAs("memory");
builder.addFunction("main", kSig_i_i)
.addBody([
// main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0;
@@ -36,7 +37,7 @@ function genModule(memory) {
/**/ kExprI32Const, 0 // --
])
.exportFunc();
- var module = builder.instantiate(null, memory);
+ var module = builder.instantiate({"": {memory:memory}});
assertTrue(module.exports.memory instanceof WebAssembly.Memory);
if (memory != null) assertEquals(memory.buffer, module.exports.memory.buffer);
return module;
@@ -44,7 +45,7 @@ function genModule(memory) {
function testPokeMemory() {
print("testPokeMemory");
- var module = genModule(null);
+ var module = genModule(new WebAssembly.Memory({initial: 1}));
var buffer = module.exports.memory.buffer;
var main = module.exports.main;
assertEquals(kMemSize, buffer.byteLength);
@@ -75,7 +76,7 @@ function genAndGetMain(buffer) {
}
function testSurvivalAcrossGc() {
- var checker = genAndGetMain(null);
+ var checker = genAndGetMain(new WebAssembly.Memory({initial: 1}));
for (var i = 0; i < 3; i++) {
print("gc run ", i);
assertEquals(0, checker(kMemSize - 4));
« no previous file with comments | « test/mjsunit/wasm/js-api.js ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698