Open Bug 1759123 Opened 7 months ago Updated 1 month ago

Remove helper thread JSContexts


(Core :: JavaScript Engine, task, P2)





(Reporter: jandem, Unassigned)


(Depends on 5 open bugs, Blocks 2 open bugs)


At this point helper threads only use a JSContext for the parse tasks. After Stencil, it should now be feasible to remove helper thread JSContexts completely. Remaining dependencies include things like:

  • Exception handling
  • Stack limit checks
  • TempAllocPolicy
  • cx->dtoaState

We could replace these uses with a stack-allocated class that contains just the data the frontend needs (ParseContext is already taken, let's call it FrontendContext for now). This would let us decouple the frontend from JSContext, very similar to how other Stencil changes decoupled the parser from the VM.

For the stack limit checks, we could copy the stack limit from the main thread's JSContext to the FrontendContext if we're parsing on the main thread. If we're parsing off-thread, we would do something similar to what we do now in JSContext::setHelperThread.

When parsing is finished, exceptions would be converted from the FrontendContext to an actual JS exception in JSContext. This will let us unify exception handling in the frontend (instead of having different code paths for main thread vs helper thread contexts).

Severity: normal → N/A
Priority: -- → P2
See Also: → 1761581

Bug 1770158 and bug 1771874 will take care of cx->dtoaState. (The remaining use is for non-base-10 double to string conversion and that's not used by the frontend.)

Depends on: 1770158, 1771874
Blocks: 1773319
Depends on: 1773324
Depends on: 1773335
Depends on: 1781008
Depends on: 1781255
Depends on: 1782569
Depends on: 1782571
Depends on: 1782573
Depends on: 1782706
Depends on: 1783935
Depends on: 1783951
Depends on: 1785762
Depends on: 1786117
Depends on: 1786819
Depends on: 1786834
Depends on: 1787528
You need to log in before you can comment on or make changes to this bug.