[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 <clemensh@chromium.org> Reviewed-by: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#59341}
This commit is contained in:
parent
8a5c06747f
commit
ce6b350a4f
@ -257,9 +257,6 @@ class CompilationStateImpl {
|
||||
// the foreground thread.
|
||||
std::vector<CompilationState::callback_t> callbacks_;
|
||||
|
||||
CancelableTaskManager foreground_task_manager_;
|
||||
std::shared_ptr<v8::TaskRunner> 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<v8::Isolate*>(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<BackgroundCompileTask>(
|
||||
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));
|
||||
|
Loading…
Reference in New Issue
Block a user