Index: test/mjsunit/wasm/module-memory.js |
diff --git a/test/mjsunit/wasm/module-memory.js b/test/mjsunit/wasm/module-memory.js |
index 6707f0816410c0667e3711b78936226b2e0cf2be..a5e5f42488aad5c3dc0a9ab9673e2ca3229d1301 100644 |
--- a/test/mjsunit/wasm/module-memory.js |
+++ b/test/mjsunit/wasm/module-memory.js |
@@ -15,36 +15,33 @@ |
builder.addMemory(1, 1, true); |
builder.addFunction("main", kSig_i_i) |
.addBody([ |
- // main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0; |
- // TODO(titzer): this manual bytecode has a copy of test-run-wasm.cc |
- /**/ kExprLoop, kAstStmt, // -- |
- /* */ kExprGetLocal, 0, // -- |
- /* */ kExprIf, kAstStmt, // -- |
- /* */ kExprGetLocal, 0, // -- |
- /* */ kExprI32LoadMem, 0, 0, // -- |
- /* */ kExprIf, kAstStmt, // -- |
- /* */ kExprI8Const, 255, // -- |
- /* */ kExprReturn, // -- |
- /* */ kExprEnd, // -- |
- /* */ kExprGetLocal, 0, // -- |
- /* */ kExprI8Const, 4, // -- |
- /* */ kExprI32Sub, // -- |
- /* */ kExprSetLocal, 0, // -- |
- /* */ kExprBr, 1, // -- |
- /* */ kExprEnd, // -- |
- /* */ kExprEnd, // -- |
- /**/ kExprI8Const, 0 // -- |
+ // main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0; |
+ kExprLoop, |
+ kExprGetLocal,0, |
+ kExprIf, |
+ kExprGetLocal,0, |
+ kExprI32LoadMem,0,0, |
+ kExprIf, |
+ kExprI8Const,255, |
+ kExprReturn, kArity1, |
+ kExprEnd, |
+ kExprGetLocal,0, |
+ kExprI8Const,4, |
+ kExprI32Sub, |
+ kExprSetLocal,0, |
+ kExprBr, kArity1, 1, |
+ kExprEnd, |
+ kExprEnd, |
+ kExprI8Const,0 |
]) |
.exportFunc(); |
- var module = builder.instantiate(null, memory); |
- assertTrue(module.exports.memory instanceof WebAssembly.Memory); |
- if (memory != null) assertEquals(memory, module.exports.memory.buffer); |
- return module; |
+ |
+ return builder.instantiate(null, memory); |
} |
function testPokeMemory() { |
var module = genModule(null); |
- var buffer = module.exports.memory.buffer; |
+ var buffer = module.exports.memory; |
var main = module.exports.main; |
assertEquals(kMemSize, buffer.byteLength); |
@@ -69,13 +66,9 @@ |
testPokeMemory(); |
-function genAndGetMain(buffer) { |
- return genModule(buffer).exports.main; // to prevent intermediates living |
-} |
- |
function testSurvivalAcrossGc() { |
- var checker = genAndGetMain(null); |
- for (var i = 0; i < 3; i++) { |
+ var checker = genModule(null).exports.main; |
+ for (var i = 0; i < 5; i++) { |
print("gc run ", i); |
assertEquals(0, checker(kMemSize - 4)); |
gc(); |
@@ -117,8 +110,8 @@ |
function testOuterMemorySurvivalAcrossGc() { |
var buffer = new ArrayBuffer(kMemSize); |
- var checker = genAndGetMain(buffer); |
- for (var i = 0; i < 3; i++) { |
+ var checker = genModule(buffer).exports.main; |
+ for (var i = 0; i < 5; i++) { |
print("gc run ", i); |
assertEquals(0, checker(kMemSize - 4)); |
gc(); |
@@ -140,9 +133,7 @@ |
kExprGetLocal, 0, |
kExprGetLocal, 1, |
kExprI32LoadMem, 0, 0, |
- kExprI32StoreMem, 0, 0, |
- kExprGetLocal, 1, |
- kExprI32LoadMem, 0, 0, |
+ kExprI32StoreMem, 0, 0 |
]) |
.exportFunc(); |