Move instantiation step out of off-thread compile/decode API
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox97 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
(Blocks 1 open bug)
Details
Attachments
(16 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
Bug 1734098 - Part 12: Replace shell offThreadDecodeScript with offThreadDecodeStencil. r?tcampbell!
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
Currently single-script off-thread API returns JSScript as the result of the task,
either by performing the instantiation off-thread/on-main-thread.
Once off-thread instantiation is removed by bug 1687973, we should be able to make the API fully based on stencil, and let the consumer instantiate as a separate step.
| Assignee | ||
Comment 1•4 years ago
|
||
Things to do:
- Rewrite
JS::CompileOffThreadconsumer to useJS::CompileToStencilOffThread - Add
JS::InstantiateGlobalStencilAndStartIncrementalEncodingAPI andrewriteJS::FinishOffThreadScriptAndStartIncrementalEncoding` consumer to use it - Remove
JS::CompileOffThreadand related APIs - Add Stencil variant of
JS::CompileOffThreadModuleand rewrite consumers - Remove
JS::CompileOffThreadModuleand related APIs - Add Stencil variant of
JS::DecodeOffThreadScriptand rewrite consumers - Remove
JS::DecodeOffThreadScriptand related APIs - Cleanup ParseTask methods/properties, by removing instantiation-specific part
| Assignee | ||
Comment 2•4 years ago
|
||
There's a problem around *StartIncrementalEncoding with CompilationStencil vs ExtensibleCompilationStencil.
currently, ScriptParseTask uses ExtensibleCompilationStencil for instantiation and incremental encoding, and there's no not-borrowing CompilationStencil.
current public API doesn't have a concept of "extensible or not" and ExtensibleCompilationStencil is not exposed.
that means, if we return stencil to the caller before starting incremental encoding,
CompilationStencil::steal is called when returning stencil from JS::FinishOffThreadCompileToStencil, and
then ExtensibleCompilationStencil::steal is called when starting incremental encoding, that performs 2 extra copies.
in term of performance, we'd better exposing ExtensibleCompilationStencil to public API as well, to reduce the possible copy,
but for simplicify, it's better having single type for stencil.
| Assignee | ||
Comment 3•4 years ago
|
||
Possible Options:
- expose
ExtensibleCompilationStencilin public API, and add "extensible" variable for some APIs, and addJS::StartIncrementalEncodingAPI - for "finish-off-thread-compilation + instantiate + start-incremental-encoding", keep using single compound API, given it's special case, but refactor the backend, by receiving
JS::InstantiateOptionsinstead carrying it fromParseTask
| Assignee | ||
Comment 4•4 years ago
|
||
maybe we can take the latter option, and revisit the design when we hit another instance that requires ExtensibleCompilationStencil in public API
| Assignee | ||
Comment 5•4 years ago
|
||
converting JS::FinishOffThreadScript to JS::FinishOffThreadCompileToStencil with JS::InstantiateGlobalStencil also requires 1 extra copy
| Assignee | ||
Comment 6•4 years ago
|
||
bug 1743357 will help the API design by avoid unnecessary copy
| Assignee | ||
Comment 7•4 years ago
|
||
with bug 1743357 fixed, we can return ExtensibleCompilationStencil without copy, by storing it in CompilationStencil.ownedBorrowStencil.
| Assignee | ||
Comment 8•4 years ago
|
||
There's another problem.
in the current JSScript-based off-thread API, we're performing frontend::PrepareForInstantiate off-main thread.
If we simply decouple the instantiation from the off-thread API, frontend::PrepareForInstantiate cannot be performed,
and the CompilationGCOutput allocation is moved to the main thread.
| Assignee | ||
Comment 9•4 years ago
|
||
If we're to move the body of the off-thread task to the embedding side, the preparation step should also be exposed.
so, in either case, we need a public struct that wraps CompilationGCOutput, or the buffer that can be stolen by CompilationGCOutput vectors.
| Assignee | ||
Comment 10•4 years ago
|
||
Make the stencil-based off-thread API names follow the convention:
- ...OffThread
- Finish...OffThread
- Cancel...OffThread
This patch stack adds more functions for module/decode, with the above naming
convention.
Depends on D133041
Updated•4 years ago
|
| Assignee | ||
Comment 11•4 years ago
|
||
This is to support incremental encoding with stencil-based off-thread API.
Depends on D133042
| Assignee | ||
Comment 12•4 years ago
|
||
Depends on D133043
| Assignee | ||
Comment 13•4 years ago
|
||
Now there's no code that uses laziness during instantiation, remove the
remaining check for the options
Depends on D133044
| Assignee | ||
Comment 14•4 years ago
|
||
Rewrite tests to use stencil-based testing functions:
- offThreadCompileScript => offThreadCompileToStencil
- runOffThreadScript => finishOffThreadCompileToStencil+evalStencil
Depends on D133045
| Assignee | ||
Comment 15•4 years ago
|
||
Depends on D133046
| Assignee | ||
Comment 16•4 years ago
|
||
Depends on D133047
| Assignee | ||
Comment 17•4 years ago
|
||
- offThreadCompileModule => offThreadCompileModuleToStencil
- finishOffThreadModule => finishOffThreadCompileModuleToStencil+instantiateModuleStencil
Depends on D133048
| Assignee | ||
Comment 18•4 years ago
|
||
Depends on D133049
| Assignee | ||
Comment 19•4 years ago
|
||
Depends on D133050
| Assignee | ||
Comment 20•4 years ago
|
||
Also make JS::CanDecodeOffThread to receive JS::DecodeOptions.
Depends on D133051
| Assignee | ||
Comment 21•4 years ago
|
||
- offThreadDecodeScript => offThreadDecodeStencil
- runOffThreadDecodedScript => finishOffThreadDecodeStencil+evalStencil
Depends on D133052
| Assignee | ||
Comment 22•4 years ago
|
||
Depends on D133053
| Assignee | ||
Comment 23•4 years ago
|
||
Depends on D133054
| Assignee | ||
Comment 24•4 years ago
|
||
- DecodeMultiOffThreadStencils => DecodeMultiStencilsOffThread
- FinishMultiOffThreadStencilDecoder => FinishDecodeMultiStencilsOffThread
- CancelMultiOffThreadScriptsDecoder => CancelDecodeMultiStencilsOffThread
Also make JS::DecodeMultiStencilsOffThread to receive JS::DecodeOptions,
and make ScriptPreloader to call JS::CanDecodeOffThread.
Depends on D133055
| Assignee | ||
Comment 25•4 years ago
|
||
Depends on D133056
Comment 26•4 years ago
|
||
Comment 27•4 years ago
•
|
||
Backed out (bug 1744178, bug 1734098) for causing leaks.
Affected platform Linux 18.04 x64 WebRender asan opt
Failure log for wd leaks
Failure log for bc leaks
Other jobs have the same failure log as bc leaks.
Also this V-swr bustages, failure log: https://treeherder.mozilla.org/logviewer?job_id=360715600&repo=autoland&lineNumber=71123
and
this py3 mch failures, failure log: https://treeherder.mozilla.org/logviewer?job_id=360720852&repo=autoland&lineNumber=181
Comment 28•4 years ago
|
||
| Assignee | ||
Updated•4 years ago
|
Comment 29•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/ce44063a7b80
https://hg.mozilla.org/mozilla-central/rev/03f97dcd2bc2
https://hg.mozilla.org/mozilla-central/rev/cd08744153c1
https://hg.mozilla.org/mozilla-central/rev/8c30710801e8
https://hg.mozilla.org/mozilla-central/rev/2e8c1adde5bb
https://hg.mozilla.org/mozilla-central/rev/fdbb03b6d16d
https://hg.mozilla.org/mozilla-central/rev/34f47b8fad24
https://hg.mozilla.org/mozilla-central/rev/b5604dcc16a4
https://hg.mozilla.org/mozilla-central/rev/0fb4e685ee60
https://hg.mozilla.org/mozilla-central/rev/46ffc06461cc
https://hg.mozilla.org/mozilla-central/rev/e05713ddea2b
https://hg.mozilla.org/mozilla-central/rev/d35d239bf1cf
https://hg.mozilla.org/mozilla-central/rev/4d15a17ce581
https://hg.mozilla.org/mozilla-central/rev/8de1c9e14cf3
https://hg.mozilla.org/mozilla-central/rev/1c2988344c44
https://hg.mozilla.org/mozilla-central/rev/1a07d4426d65
Description
•