Commit 0f3ce0c2 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] No parallel compilation if no background threads

Parallel compilation should only be chosen if there are background threads
available. Otherwise, the overhead of orchestrating (non-)parallel work
can be omitted by just compiling synchronously.

R=ahaas@chromium.org

Change-Id: I333fb87e07fdb3260ab4c9c2c1885a1df4c5e4ef
Reviewed-on: https://chromium-review.googlesource.com/513062Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45555}
parent 70de12b7
......@@ -663,8 +663,11 @@ class CompilationHelper {
if (!lazy_compile) {
size_t funcs_to_compile =
module_->functions.size() - module_->num_imported_functions;
if (!FLAG_trace_wasm_decoder && FLAG_wasm_num_compilation_tasks != 0 &&
funcs_to_compile > 1) {
bool compile_parallel =
!FLAG_trace_wasm_decoder && FLAG_wasm_num_compilation_tasks > 0 &&
funcs_to_compile > 1 &&
V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads() > 0;
if (compile_parallel) {
// Avoid a race condition by collecting results into a second vector.
std::vector<Handle<Code>> results(temp_instance->function_code);
CompileInParallel(&module_env, results, thrower);
......
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