From ce6b350a4f17ddc7c51d44172cd26e2bde007c10 Mon Sep 17 00:00:00 2001 From: Clemens Hammacher Date: Mon, 4 Feb 2019 14:44:18 +0100 Subject: [PATCH] [wasm] No foreground tasks in compilation state This removes the last creation of foreground tasks in the compilation state. I think this logic can be removed completely, because a) the number of background tasks is already capped at {max(1, FLAG_wasm_num_compilation_tasks)}, and b) in order to get predictable timing you can use the --predictable flag which makes all background tasks execute synchronously with foreground tasks (from the same queue). R=ahaas@chromium.org CC=mstarzinger@chromium.org Bug: v8:8050, v8:8689 Change-Id: I142af6b42f9bb9befc7c7b7d6002192d72bd7677 Reviewed-on: https://chromium-review.googlesource.com/c/1451841 Commit-Queue: Clemens Hammacher Reviewed-by: Andreas Haas Cr-Commit-Position: refs/heads/master@{#59341} --- src/wasm/module-compiler.cc | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/wasm/module-compiler.cc b/src/wasm/module-compiler.cc index b67b119344..5f3d0efff3 100644 --- a/src/wasm/module-compiler.cc +++ b/src/wasm/module-compiler.cc @@ -257,9 +257,6 @@ class CompilationStateImpl { // the foreground thread. std::vector callbacks_; - CancelableTaskManager foreground_task_manager_; - std::shared_ptr foreground_task_runner_; - const size_t max_background_tasks_ = 0; }; @@ -1477,21 +1474,15 @@ CompilationStateImpl::CompilationStateImpl( async_counters_(std::move(async_counters)), max_background_tasks_(std::max( 1, std::min(FLAG_wasm_num_compilation_tasks, - V8::GetCurrentPlatform()->NumberOfWorkerThreads()))) { - v8::Isolate* v8_isolate = reinterpret_cast(isolate_); - v8::Platform* platform = V8::GetCurrentPlatform(); - foreground_task_runner_ = platform->GetForegroundTaskRunner(v8_isolate); -} + V8::GetCurrentPlatform()->NumberOfWorkerThreads()))) {} CompilationStateImpl::~CompilationStateImpl() { - DCHECK(foreground_task_manager_.canceled()); CompilationError* error = compile_error_.load(std::memory_order_acquire); if (error != nullptr) delete error; } void CompilationStateImpl::AbortCompilation() { Abort(); - foreground_task_manager_.CancelAndWait(); } void CompilationStateImpl::SetNumberOfFunctionsToCompile(size_t num_functions) { @@ -1596,13 +1587,6 @@ void CompilationStateImpl::RestartBackgroundCompileTask() { auto task = engine_->NewBackgroundCompileTask( background_compile_token_, async_counters_); - // If --wasm-num-compilation-tasks=0 is passed, do only spawn foreground - // tasks. This is used to make timing deterministic. - if (FLAG_wasm_num_compilation_tasks == 0) { - foreground_task_runner_->PostTask(std::move(task)); - return; - } - if (baseline_compilation_finished()) { V8::GetCurrentPlatform()->CallLowPriorityTaskOnWorkerThread( std::move(task));