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 b83e8131890a3f929165d42820178d0cb2054226..04fc903010db1b17935e374df2f72820d92488df 100644 |
--- a/test/mjsunit/wasm/instantiate-module-basic.js |
+++ b/test/mjsunit/wasm/instantiate-module-basic.js |
@@ -31,16 +31,13 @@ |
assertFalse(mem === null); |
assertFalse(mem === 0); |
assertEquals("object", typeof mem); |
- assertTrue(mem instanceof WebAssembly.Memory); |
- var buf = mem.buffer; |
- assertTrue(buf instanceof ArrayBuffer); |
- assertEquals(65536, buf.byteLength); |
- for (var i = 0; i < 4; i++) { |
+ assertTrue(mem instanceof ArrayBuffer); |
+ for (let i = 0; i < 4; i++) { |
instance.exports.memory = 0; // should be ignored |
- mem.buffer = 0; // should be ignored |
assertSame(mem, instance.exports.memory); |
- assertSame(buf, mem.buffer); |
} |
+ |
+ assertEquals(65536, instance.exports.memory.byteLength); |
// Check the properties of the main function. |
let main = instance.exports.main; |
@@ -64,7 +61,6 @@ |
// Negative tests. |
(function InvalidModules() { |
- print("InvalidModules..."); |
let invalid_cases = [undefined, 1, "", "a", {some:1, obj: "b"}]; |
let len = invalid_cases.length; |
for (var i = 0; i < len; ++i) { |
@@ -79,10 +75,9 @@ |
// Compile async an invalid blob. |
(function InvalidBinaryAsyncCompilation() { |
- print("InvalidBinaryAsyncCompilation..."); |
let builder = new WasmModuleBuilder(); |
builder.addFunction("f", kSig_i_i) |
- .addBody([kExprCallFunction, 0]); |
+ .addBody([kExprCallImport, kArity0, 0]); |
let promise = WebAssembly.compile(builder.toBuffer()); |
promise |
.then(compiled => |
@@ -92,7 +87,6 @@ |
// Multiple instances tests. |
(function ManyInstances() { |
- print("ManyInstances..."); |
let compiled_module = new WebAssembly.Module(buffer); |
let instance_1 = new WebAssembly.Instance(compiled_module); |
let instance_2 = new WebAssembly.Instance(compiled_module); |
@@ -100,7 +94,6 @@ |
})(); |
(function ManyInstancesAsync() { |
- print("ManyInstancesAsync..."); |
let promise = WebAssembly.compile(buffer); |
promise.then(compiled_module => { |
let instance_1 = new WebAssembly.Instance(compiled_module); |
@@ -110,7 +103,6 @@ |
})(); |
(function InstancesAreIsolatedFromEachother() { |
- print("InstancesAreIsolatedFromEachother..."); |
var builder = new WasmModuleBuilder(); |
builder.addMemory(1,1, true); |
var kSig_v_i = makeSig([kAstI32], []); |
@@ -120,13 +112,13 @@ |
builder.addFunction("main", kSig_i_i) |
.addBody([ |
+ kExprI32Const, 1, |
kExprGetLocal, 0, |
kExprI32LoadMem, 0, 0, |
- kExprI32Const, 1, |
- kExprCallIndirect, signature, |
+ kExprCallIndirect, kArity1, signature, |
kExprGetLocal,0, |
kExprI32LoadMem,0, 0, |
- kExprCallFunction, 0, |
+ kExprCallImport, kArity0, 0, |
kExprI32Add |
]).exportFunc(); |
@@ -135,8 +127,8 @@ |
builder.addFunction("_wrap_writer", signature) |
.addBody([ |
kExprGetLocal, 0, |
- kExprCallFunction, 1]); |
- builder.appendToTable([2, 3]); |
+ kExprCallImport, kArity1, 1]); |
+ builder.appendToTable([0, 1]); |
var module = new WebAssembly.Module(builder.toBuffer()); |
@@ -163,7 +155,6 @@ |
})(); |
(function GlobalsArePrivateToTheInstance() { |
- print("GlobalsArePrivateToTheInstance..."); |
var builder = new WasmModuleBuilder(); |
builder.addGlobal(kAstI32); |
builder.addFunction("read", kSig_i_v) |
@@ -188,7 +179,6 @@ |
(function InstanceMemoryIsIsolated() { |
- print("InstanceMemoryIsIsolated..."); |
var builder = new WasmModuleBuilder(); |
builder.addMemory(1,1, true); |