[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/+/3762578 Reviewed-by: Thibaud Michaud <thibaudm@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/main@{#82060}
This commit is contained in:
parent
4d96f7328e
commit
84179d10cc
@ -3035,7 +3035,9 @@ CompilationStateImpl::CompilationStateImpl(
|
||||
|
||||
void CompilationStateImpl::InitCompileJob() {
|
||||
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>(
|
||||
native_module_weak_, async_counters_));
|
||||
}
|
||||
@ -3863,7 +3865,7 @@ void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module,
|
||||
auto job =
|
||||
std::make_unique<CompileJSToWasmWrapperJob>(&queue, &compilation_units);
|
||||
if (FLAG_wasm_num_compilation_tasks > 0) {
|
||||
auto job_handle = V8::GetCurrentPlatform()->PostJob(
|
||||
auto job_handle = V8::GetCurrentPlatform()->CreateJob(
|
||||
TaskPriority::kUserVisible, std::move(job));
|
||||
|
||||
// Wait for completion, while contributing to the work.
|
||||
|
@ -1566,7 +1566,7 @@ void InstanceBuilder::CompileImportWrappers(
|
||||
|
||||
auto compile_job_task = std::make_unique<CompileImportWrapperJob>(
|
||||
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));
|
||||
|
||||
// Wait for the job to finish, while contributing in this thread.
|
||||
|
@ -657,7 +657,9 @@ bool NativeModuleDeserializer::Read(Reader* reader) {
|
||||
|
||||
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,
|
||||
std::make_unique<DeserializeCodeTask>(this, &reloc_queue));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user