Closed Bug 1570058 Opened 5 years ago Closed 3 years ago

Divert offthread SourceCompressionTasks to use the XPCOM helper thread pool

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1713335

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

Priority: -- → P2
Assignee: nobody → allstars.chh

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.

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.