Add public APIs for CompilationStencil
Categories
(Core :: JavaScript Engine, task, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr78 | --- | unaffected |
| firefox86 | --- | unaffected |
| firefox87 | --- | fixed |
People
(Reporter: tcampbell, Assigned: tcampbell)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
The js::frontend::CompilationStencil is the main structure for representing parsed JS before it is turned into GC-scripts. To support the various Stencil objectives, we would like a fool-proof abstraction that can be manipulated from Gecko. This bug is about defining that API and resolving footguns.
| Assignee | ||
Comment 1•4 years ago
|
||
The CompilationStencil references the following external VM things:
SharedImmutableScriptDataScriptSource- AsmJS
WasmModule
These do not contain GC-things but a lightly coupled to the JSRuntime. These restrictions are minimal and we can reduce over time. In practice though, our domain of sharing would always have a common parent-runtime.
The CompilationStencil itself should have a ref-counting mode. A policy for mutation should be established. For example, if we are delazifying, can we update/append an existing stencil and how should this support threading.
Another important external reference is the XDRBuffer if we decoded the stencil directly from XDR. We should probably make a ref-counted XDRBuffer and have the stencil hold a strong reference if we rely on the data.
Another wrinkle now is the atom-cache that is part of CompilationInput.
| Assignee | ||
Comment 2•4 years ago
|
||
A rough design here might look like:
- Add
JS::Stenciltype in public that is alias ofjs::frontend::CompilationStencil - Add
refCountfield toCompilationStencil - Add public
JS::StencilAddRef/JS::StencilRelease - Use
RefPtrTraitsto allow opaque type to call the non-memberJS::StencilAddRef - The public
CompileToStencilcan then return thealready_AddRefed<CompilationStencil> - Use the
js/public/experimentaldirectory for now
The widget/gtk/GRefPtr.h is a rough example of this (where GObject is an opaque type implemented in external library).
| Assignee | ||
Comment 3•4 years ago
|
||
Store the max*DataLength values on the StencilDelazificationSet so that it
can be used for multiple instantiations. Separate out the preparation of the
stencil from the gc-output structure for the same reasons.
| Assignee | ||
Comment 4•4 years ago
|
||
Introduce an opaque JS::Stencil type for working with CompilationStencil via
the public API (such as in Gecko).
Depends on D104744
| Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 6•4 years ago
|
||
| bugherder | ||
| Assignee | ||
Updated•4 years ago
|
Description
•