diff options
Diffstat (limited to 'deps/v8/test/mjsunit/wasm/module-memory.js')
-rw-r--r-- | deps/v8/test/mjsunit/wasm/module-memory.js | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/deps/v8/test/mjsunit/wasm/module-memory.js b/deps/v8/test/mjsunit/wasm/module-memory.js index ef85eb2357..a5e5f42488 100644 --- a/deps/v8/test/mjsunit/wasm/module-memory.js +++ b/deps/v8/test/mjsunit/wasm/module-memory.js @@ -13,19 +13,27 @@ function genModule(memory) { var builder = new WasmModuleBuilder(); builder.addMemory(1, 1, true); - builder.addFunction("main", [kAstI32, kAstI32]) + builder.addFunction("main", kSig_i_i) .addBody([ - kExprBlock,2, - kExprLoop,1, - kExprIf, + // main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0; + kExprLoop, + kExprGetLocal,0, + kExprIf, kExprGetLocal,0, - kExprBr, 0, - kExprIfElse, - kExprI32LoadMem,0,0,kExprGetLocal,0, - kExprBr,2, kExprI8Const, 255, - kExprSetLocal,0, - kExprI32Sub,kExprGetLocal,0,kExprI8Const,4, - kExprI8Const,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(); return builder.instantiate(null, memory); @@ -120,14 +128,16 @@ function testOOBThrows() { var builder = new WasmModuleBuilder(); builder.addMemory(1, 1, true); - builder.addFunction("geti", [kAstI32, kAstI32, kAstI32]) + builder.addFunction("geti", kSig_i_ii) .addBody([ - kExprI32StoreMem, 0, 0, kExprGetLocal, 0, kExprI32LoadMem, 0, 0, kExprGetLocal, 1 + kExprGetLocal, 0, + kExprGetLocal, 1, + kExprI32LoadMem, 0, 0, + kExprI32StoreMem, 0, 0 ]) .exportFunc(); var module = builder.instantiate(); - var offset; function read() { return module.exports.geti(0, offset); } |