Files
electron/patches/node/fix_increase_concurrency_in_v8platform_postjob.patch
Shelley Vohr ef657bdc9d chore: remove wasm CompileJSToWasmWrapperJob patch (#37782)
chore: remove wasm CompileJSToWasmWrapperJob patch
2023-04-01 08:47:54 -04:00

33 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Fri, 31 Mar 2023 17:04:39 +0200
Subject: fix: increase concurrency in V8Platform::PostJob()
Refs https://chromium-review.googlesource.com/c/v8/v8/+/4347597/11
PostJob posts |job_task| to run in parallel, and so must call NotifyConcurrencyIncrease()
on the JobTask. In Node.js, the implementations of CreateJob and PostJob were identical,
meaning that PostJob calls could potentially never run all their tasks.
This was brought to our attention by the above linked V8 CL, which switched a call from
CreateJob to PostJob and caused a series of failures.
This should be upstreamed.
diff --git a/src/node_platform.cc b/src/node_platform.cc
index b3994c4398598c67c0029394d58e8f4dba032c5d..f004176d296c8a8ffbd12d44a917d9c7be7b6cf0 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -530,8 +530,10 @@ bool NodePlatform::FlushForegroundTasks(Isolate* isolate) {
std::unique_ptr<v8::JobHandle> NodePlatform::PostJob(v8::TaskPriority priority,
std::unique_ptr<v8::JobTask> job_task) {
- return v8::platform::NewDefaultJobHandle(
+ auto handle = v8::platform::NewDefaultJobHandle(
this, priority, std::move(job_task), NumberOfWorkerThreads());
+ handle->NotifyConcurrencyIncrease();
+ return handle;
}
std::unique_ptr<v8::JobHandle> NodePlatform::CreateJob(v8::TaskPriority priority,