Closed Bug 1570103 Opened 5 years ago Closed 3 years ago

Divert offthread parse 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 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

Priority: -- → P2

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.