Divert PromiseHelper tasks to use the XPCOM helper thread pool
Categories
(Core :: JavaScript Engine, enhancement, P2)
Tracking
()
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
Updated•5 years ago
|
Comment 1•3 years ago
|
||
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.
Description
•