Divert offthread parse 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 parse tasks to use the HelperThread pool. For this purpose, we've registered HelperThreadTaskCallback
to pass any RunnableTask* to the task handler [1].
The general way we can divert some offthread task to the callback is to send it to the callback function (when it exists) rather than sorting it into its respective worklist. For ParseTasks, it looks like this primarily happens during QueueOffThreadParseTask(...)
[2]. The StartOffThread* calls happen with different subtypes which eventually call the function which will enqueue them. In the case of ParseTasks which must wait on GC, it looks like the process of sending them to the XPCOM event queue can happen when js::EuqueuePendingParseTasksAfterGC
is called [3].
ParseTask workloads have some work that is not completed during ParseTask::runTask(). Specifically, invoking the callback and sorting the task into the finished list will need to be handled as a part of ParseTask::runTask()
. It is currently handled in HelperThread::HandleParseWorkload
[4].
[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#856
[3] https://searchfox.org/mozilla-central/rev/1eb05019f47069172ba81a6c108a584a409a24ea/js/src/vm/HelperThreads.cpp#1026
[4] https://searchfox.org/mozilla-central/rev/1eb05019f47069172ba81a6c108a584a409a24ea/js/src/vm/HelperThreads.cpp#2213-2218
Updated•6 years ago
|
Comment 1•4 years ago
|
||
The current plan is to switch over from using the internal pool to the external pool in one go, so I'm closing the bugs for individual task kinds.
Description
•