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