Closed Bug 1569802 Opened 5 years ago Closed 3 years ago

Divert PromiseHelper tasks to use the XPCOM helper thread pool

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1713335

People

(Reporter: KrisWright, Unassigned)

Details

We would like to divert the offthread PromiseHelperTasks to use the XPCOM thread pool, while retaining native behavior when running the standalone JS shell. To do this, we've registered HelperThreadTaskCallback to pass any RunnableTask* to the task handler [1].

From my understanding, we will need to check for the callback in StartOffThreadPromiseHelperTask(...) [2] and if the callback exists, call HelperThreadTaskCallback(task). Otherwise, promise helpers can execute as normal in the native thread pool.

Promise helpers appear to self-destroy at DispatchResolveAndDestroy() so no additional behavior should be needed after diverting the task to the new thread pool. The max number of promise helpers that can run at once appears to be equivalent to ThreadCount when JS is not simulating oom, so I don't believe any additional behavior for checking for max tasks is needed at this time either.

[1] https://searchfox.org/mozilla-central/rev/1eb05019f47069172ba81a6c108a584a409a24ea/js/src/vm/Runtime.cpp#75
[2] https://searchfox.org/mozilla-central/rev/1eb05019f47069172ba81a6c108a584a409a24ea/js/src/vm/HelperThreads.cpp#2365,2386

Priority: -- → P2

The current plan is to switch over from using the internal pool to the external pool in one go, so bugs for individual task kinds are not required.

No longer blocks: 1559660
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.