Open Bug 1662110 (progressive-stencil) Opened 4 years ago Updated 1 year ago

[meta] Support progressive compilation of CompilationStencil

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

ASSIGNED

People

(Reporter: tcampbell, Assigned: nbp)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Keywords: meta)

SpiderMonkey's JS parser typically performs a syntax-only initial parse, followed by on-demand delazification parses as different JS functions try to run. Currently this means delazification is part of main-thread and cannot be done eagerly. We should instead support taking a CompilationStencil and allow further compilation to add more bytecode without ever allocating to the GC and running the script.

The intent of syntax-only initial parse is to reduce the latency to first execution by performing required early-error checks and little more. By design, it also saves memory by not generating all bytecode when many JS functions are never executed in a page. The latency saving is largely due to not generating the AST (and saving a lot of allocation/memory traffic as a result) as well as not generating detailed bytecode.

With the progressive-stencil proposal, we would allow making use wait time between when initial stencil is first generated, and when the scripts is actually executed to generate bytecode speculatively. This process would have the same Document-agnostic characteristics of parsing to stencil and could run on any thread. This would generate a vector of stencil-updates that augment the ScriptStencil with bytecode. Thanks to the design of BaseScript, there is almost no repeated data.

If at the end of loading, we determine that some of these updates are for functions that were never executed, we can directly discard the data without worrying about generated GC things that may be entrained and hard to collect. As a result, we can try speculating without the original long-lived memory concern we had when syntax parsing was first added.

Blocks: 1663955
No longer blocks: stencil
See Also: → 1664475
See Also: → 1667903
See Also: → 1686775
Assignee: nobody → nicolas.b.pierron
Status: NEW → ASSIGNED
Depends on: 1715966
Depends on: 1715972
Depends on: 1715976
Blocks: 1597522
Depends on: 1718102
Depends on: 1719194
Depends on: 1739627
Depends on: 1751233
Depends on: 1753709
Depends on: 1754443
Depends on: 1754444
Depends on: 1755999
Depends on: 1756003
Depends on: 1760333
Depends on: 1760334
Depends on: 1764276
Depends on: 1764280
Depends on: 1766283
Depends on: 1766841
Depends on: 1768630
Depends on: 1769871
Depends on: 1770096
Depends on: 1770167
Depends on: 1773682
Depends on: 1774796
Depends on: 1776205
Depends on: 1779292
Depends on: 1779940
Regressions: 1780426
Depends on: 1780829
Depends on: 1791504
You need to log in before you can comment on or make changes to this bug.