Divert offthread SourceCompressionTasks to use the XPCOM helper thread pool
Categories
(Core :: JavaScript Engine, enhancement, P2)
Tracking
()
People
(Reporter: KrisWright, Assigned: allstars.chh)
Details
We would like to divert the offthread compression work to use the XPCOM helper 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].
Compression tasks are run a bit differently than most of the other offthread tasks, which enqueue to run using a js::StartOffThread* method. Rather, a scheduleCompressionTasks(...)
[2] method is called from GlobalHelperThreadState to move a task into the worklist (from my understanding, this appears to happen during a major GC). Rather than put them into a worklist for native HelperThreads, tasks could be diverted using the HelperThreadTaskCallback here to use the new thread pool, should the callback exist.
To preserve the behavior they have in native Spidermonkey when running on an XPCOM thread pool, any work done in HelperThread::handleCompressionWorkload
[3] will need to be handled in SourceCompressionTask::runTask()
instead. It looks like the main issue is making sure that they all get put into the compressionFinishedList.
[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#1591
[3] https://searchfox.org/mozilla-central/rev/1eb05019f47069172ba81a6c108a584a409a24ea/js/src/vm/HelperThreads.cpp#2230
Updated•5 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
The patches are in
https://phabricator.services.mozilla.com/D79686
https://phabricator.services.mozilla.com/D75777
https://phabricator.services.mozilla.com/D75539
https://phabricator.services.mozilla.com/D75778
But we want to wait until all issues are fixed before landing it.
Comment 2•3 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
•