Bug 1569799 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

We would like to divert the offthread IonBuilders 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:
1. Check for the callback in `StartOffThreadIonCompile(...)` [2] and if the callback exists, call `HelperThreadTaskCallback(builder)`. 

2. Ensure that IonBuilder runs its entire parallel job independently of HelperThread. This particularly pertains to sorting itself into the IonFinishedList and pinging the main thread after a job is finished [3]. This may require adding some kind of finish behavior to the RunnableTask interface (such as `RunnableTask::onThreadFinish()`), or moving these jobs so that they're handled inside `IonBuilder::runTask()`. 

Since IonBuilders then get placed into the IonFinishedList, the tasks shouldn't have to worry about being self-destroying. However, if that were to change for any reason, note that IonBuilder will have to destroy itself as HelperThreadTaskHandler only forgets its task pointer and never attempts to destroy it.

[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#194
[3] https://searchfox.org/mozilla-central/rev/1eb05019f47069172ba81a6c108a584a409a24ea/js/src/vm/HelperThreads.cpp#2132
We would like to divert the offthread Ion compile work 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:
1. Check for the callback in `StartOffThreadIonCompile(...)` [2] and if the callback exists, call `HelperThreadTaskCallback(builder)`. 

2. Ensure that IonBuilder runs its entire parallel job independently of HelperThread. This particularly pertains to sorting itself into the IonFinishedList and pinging the main thread after a job is finished [3]. This may require adding some kind of finish behavior to the RunnableTask interface (such as `RunnableTask::onThreadFinish()`), or moving these jobs so that they're handled inside `IonBuilder::runTask()`. 

Since IonBuilders then get placed into the IonFinishedList, the tasks shouldn't have to worry about being self-destroying. However, if that were to change for any reason, note that IonBuilder will have to destroy itself as HelperThreadTaskHandler only forgets its task pointer and never attempts to destroy it.

[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#194
[3] https://searchfox.org/mozilla-central/rev/1eb05019f47069172ba81a6c108a584a409a24ea/js/src/vm/HelperThreads.cpp#2132

Back to Bug 1569799 Comment 0