[wasm] Fix background compilation thread in predictable mode

GetMaxBackgroundTasks should return 0 in predictable mode, since
compilation is done in the foreground.

R=clemensh@chromium.org

Change-Id: I4a617cadb53ca91ee21e40c46a93d54e2a1ceb8b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1789301
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63600}
This commit is contained in:
Thibaud Michaud 2019-09-06 15:54:43 +02:00 committed by Commit Bot
parent ffa9f163e6
commit 1904dd69ea

View File

@ -2209,11 +2209,9 @@ bool AsyncStreamingProcessor::Deserialize(Vector<const uint8_t> module_bytes,
}
int GetMaxBackgroundTasks() {
if (NeedsDeterministicCompile()) return 1;
if (NeedsDeterministicCompile()) return 0;
int num_worker_threads = V8::GetCurrentPlatform()->NumberOfWorkerThreads();
int num_compile_tasks =
std::min(FLAG_wasm_num_compilation_tasks, num_worker_threads);
return std::max(1, num_compile_tasks);
return std::min(FLAG_wasm_num_compilation_tasks, num_worker_threads);
}
CompilationStateImpl::CompilationStateImpl(
@ -2227,7 +2225,7 @@ CompilationStateImpl::CompilationStateImpl(
? CompileMode::kTiering
: CompileMode::kRegular),
async_counters_(std::move(async_counters)),
max_background_tasks_(GetMaxBackgroundTasks()),
max_background_tasks_(std::max(GetMaxBackgroundTasks(), 1)),
compilation_unit_queues_(max_background_tasks_),
available_task_ids_(max_background_tasks_) {
for (int i = 0; i < max_background_tasks_; ++i) {