Open Bug 1759123 Opened 1 year ago Updated 1 month ago

Remove helper thread JSContexts

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

People

(Reporter: jandem, Unassigned)

References

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

Details

(Whiteboard: [orb:m2])

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
Depends on: 1797024
Depends on: 1797183
Blocks: 1799960
Whiteboard: [orb:m1]
Depends on: 1804613
Depends on: 1804837
Depends on: 1805141
Depends on: 1805622
Depends on: 1805856
Depends on: 1806366
No longer depends on: 1806366
Depends on: 1806499
Depends on: 1806744
Depends on: 1807216
Depends on: 1808216
Depends on: 1808881
Whiteboard: [orb:m1] → [orb:m2]

The ORB M1 milestone can use existing parser APIs, so we can move this to M2 as potential performance work.

No longer blocks: 1773319
You need to log in before you can comment on or make changes to this bug.