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

Unified Diff: test/mjsunit/wasm/instantiate-module-basic.js

Issue 2345593003: [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures and TSAN races. Created 4 years, 3 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/instance-gc.js ('k') | test/mjsunit/wasm/module-memory.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « test/mjsunit/wasm/instance-gc.js ('k') | test/mjsunit/wasm/module-memory.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698