v8/test/mjsunit/wasm/single-threaded-compilation.js
Andreas Haas 7fa695a2e4 [wasm] Fix --single-threaded for WebAssembly compilation
Due to the transition to the jobs API, WebAssembly compilation was using
background threads, even when --single-threaded and therefore
--wasm-num-compilation-tasks=0 was used. With this CL, the compilation
job is started with a maximum concurrency of 0 when
--wasm-num-compilation-tasks=0. To ensure compilation progress in
asynchronous compilation, the main thread waits for baseline compilation
to finish right after initializing all compilation units, and thereby
participates in the compilation.

R=clemensb@chromium.org

Bug: v8:11279
Change-Id: I85f93f82c00cdbd6afd46110599089a052101a00
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2599546
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71944}
2021-01-07 11:49:53 +00:00

28 lines
776 B
JavaScript

// Copyright 2020 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: --wasm-num-compilation-tasks=0
load('test/mjsunit/wasm/wasm-module-builder.js');
(function testSyncCompilation() {
print(arguments.callee.name);
const builder = new WasmModuleBuilder();
builder.addFunction("main", kSig_d_d)
.addBody([kExprLocalGet, 0])
.exportFunc();
const instance = builder.instantiate();
})();
(function testAsyncCompilation() {
print(arguments.callee.name);
const builder = new WasmModuleBuilder();
builder.addFunction("main", kSig_i_i)
.addBody([kExprLocalGet, 0])
.exportFunc();
const instance = builder.asyncInstantiate();
})();