Commit 84179d10 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[wasm] Use CreateJob instead of PostJob

We sometimes create jobs that initially hold no work. In those cases,
use CreateJob instead of PostJob.
New background threads will later be spawned when
NotifyConcurrencyIncrease is called.

R=etiennep@chromium.org

Bug: v8:13096
Change-Id: Ieb9f9e03d01af6a72fe5785be72c523a553d0f1d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3762578Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82060}
parent 4d96f732
...@@ -3035,7 +3035,9 @@ CompilationStateImpl::CompilationStateImpl( ...@@ -3035,7 +3035,9 @@ CompilationStateImpl::CompilationStateImpl(
void CompilationStateImpl::InitCompileJob() { void CompilationStateImpl::InitCompileJob() {
DCHECK_NULL(compile_job_); DCHECK_NULL(compile_job_);
compile_job_ = V8::GetCurrentPlatform()->PostJob( // Create the job, but don't spawn workers yet. This will happen on
// {NotifyConcurrencyIncrease}.
compile_job_ = V8::GetCurrentPlatform()->CreateJob(
TaskPriority::kUserVisible, std::make_unique<BackgroundCompileJob>( TaskPriority::kUserVisible, std::make_unique<BackgroundCompileJob>(
native_module_weak_, async_counters_)); native_module_weak_, async_counters_));
} }
...@@ -3863,7 +3865,7 @@ void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module, ...@@ -3863,7 +3865,7 @@ void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module,
auto job = auto job =
std::make_unique<CompileJSToWasmWrapperJob>(&queue, &compilation_units); std::make_unique<CompileJSToWasmWrapperJob>(&queue, &compilation_units);
if (FLAG_wasm_num_compilation_tasks > 0) { if (FLAG_wasm_num_compilation_tasks > 0) {
auto job_handle = V8::GetCurrentPlatform()->PostJob( auto job_handle = V8::GetCurrentPlatform()->CreateJob(
TaskPriority::kUserVisible, std::move(job)); TaskPriority::kUserVisible, std::move(job));
// Wait for completion, while contributing to the work. // Wait for completion, while contributing to the work.
......
...@@ -1566,7 +1566,7 @@ void InstanceBuilder::CompileImportWrappers( ...@@ -1566,7 +1566,7 @@ void InstanceBuilder::CompileImportWrappers(
auto compile_job_task = std::make_unique<CompileImportWrapperJob>( auto compile_job_task = std::make_unique<CompileImportWrapperJob>(
isolate_->counters(), native_module, &import_wrapper_queue, &cache_scope); isolate_->counters(), native_module, &import_wrapper_queue, &cache_scope);
auto compile_job = V8::GetCurrentPlatform()->PostJob( auto compile_job = V8::GetCurrentPlatform()->CreateJob(
TaskPriority::kUserVisible, std::move(compile_job_task)); TaskPriority::kUserVisible, std::move(compile_job_task));
// Wait for the job to finish, while contributing in this thread. // Wait for the job to finish, while contributing in this thread.
......
...@@ -657,7 +657,9 @@ bool NativeModuleDeserializer::Read(Reader* reader) { ...@@ -657,7 +657,9 @@ bool NativeModuleDeserializer::Read(Reader* reader) {
DeserializationQueue reloc_queue; DeserializationQueue reloc_queue;
std::unique_ptr<JobHandle> job_handle = V8::GetCurrentPlatform()->PostJob( // Create a new job without any workers; those are spawned on
// {NotifyConcurrencyIncrease}.
std::unique_ptr<JobHandle> job_handle = V8::GetCurrentPlatform()->CreateJob(
TaskPriority::kUserVisible, TaskPriority::kUserVisible,
std::make_unique<DeserializeCodeTask>(this, &reloc_queue)); std::make_unique<DeserializeCodeTask>(this, &reloc_queue));
......
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