Commit ed2605f0 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[d8][wasm] Test wasm compilation completion

d8 was recently changed to keep running until wasm compilation has
completed. This adds a message test to test that.

R=ahaas@chromium.org

Change-Id: I73af53b6df4ee5f9a6afd26cf2d71a269140465f
Reviewed-on: https://chromium-review.googlesource.com/966184Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52008}
parent 200872db
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --no-stress-opt
load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// Test that d8 does not terminate until wasm compilation has finished and the
// promise was resolved.
var builder = new WasmModuleBuilder();
// Add a few functions so it takes some time to compile.
for (var i = 0; i < 2000; ++i) {
builder.addFunction('fun' + i, kSig_i_v)
.addBody([...wasmI32Const(i)])
.exportFunc();
}
builder.asyncInstantiate()
.then(({module, instance}) => instance.exports.fun1155())
.then(res => print('Result of executing fun1155: ' + res));
Result of executing fun1155: 1155
......@@ -683,6 +683,10 @@ class WasmModuleBuilder {
return instance;
}
asyncInstantiate(ffi) {
return WebAssembly.instantiate(this.toBuffer(), ffi);
}
toModule(debug = false) {
return new WebAssembly.Module(this.toBuffer(debug));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment