Commit c7d68161 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[d8] Add no-wait-for-wasm flag

The flag lets d8 wait for async compilation of WebAssembly to finish
before d8 shuts down.

R=clemensh@chromium.org
CC=​kimanh@google.com

Change-Id: I4cf59a1f35cc5a0ecaf769d2745df5e2e14eb509
Reviewed-on: https://chromium-review.googlesource.com/966031
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51999}
parent 82ad20c3
......@@ -2804,6 +2804,11 @@ bool Shell::SetOptions(int argc, char* argv[]) {
} else if (strcmp(argv[i], "--omit-quit") == 0) {
options.omit_quit = true;
argv[i] = nullptr;
} else if (strcmp(argv[i], "--no-wait-for-wasm") == 0) {
// TODO(herhut) Remove this flag once wasm compilation is fully
// isolate-independent.
options.wait_for_wasm = false;
argv[i] = nullptr;
} else if (strcmp(argv[i], "-f") == 0) {
// Ignore any -f flags for compatibility with other stand-alone
// JavaScript engines.
......@@ -3018,7 +3023,8 @@ void Shell::CompleteMessageLoop(Isolate* isolate) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::wasm::CompilationManager* wasm_compilation_manager =
i_isolate->wasm_engine()->compilation_manager();
bool should_wait = wasm_compilation_manager->HasRunningCompileJob() ||
bool should_wait = (options.wait_for_wasm &&
wasm_compilation_manager->HasRunningCompileJob()) ||
isolate_status_[isolate];
return should_wait ? platform::MessageLoopBehavior::kWaitForWork
: platform::MessageLoopBehavior::kDoNotWait;
......
......@@ -292,6 +292,7 @@ class ShellOptions {
send_idle_notification(false),
invoke_weak_callbacks(false),
omit_quit(false),
wait_for_wasm(true),
stress_opt(false),
stress_deopt(false),
stress_runs(1),
......@@ -327,6 +328,7 @@ class ShellOptions {
bool send_idle_notification;
bool invoke_weak_callbacks;
bool omit_quit;
bool wait_for_wasm;
bool stress_opt;
bool stress_deopt;
int stress_runs;
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --wasm-async-compilation
// Flags: --expose-wasm --wasm-async-compilation --no-wait-for-wasm
load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
......
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