Closed Bug 1692577 Opened 1 year ago Closed 1 year ago

Consider using CompilationState directly from CompilationStencil during delazification

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: tcampbell, Assigned: arai)

References

(Blocks 1 open bug)

Details

Attachments

(16 files, 9 obsolete 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
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

The CompilationState structure is stack-allocated and used directly by parser to accumulate stencil data. We currently then convert this to the final stencil structure. In the case of delazification (and probably eval), if we aren't going to cache the stencil then we should just use the CompilationState directly. Since the CompilationStencil uses Spans, we can just point into the CompilationState similar to we do for XDR decode.

I have another idea about optimizing away the copy inside CompilationState::finish, in bug 1692648.

See Also: → 1692648

uh, sorry, I wrote wrong bug number :P

bug 1687095 patch achieves it, as part of making "merge" operation work.
https://phabricator.services.mozilla.com/D105154

that patch stack, including bug 1692648, moves stencil-related fields of CompilationState into Vector-variant of CompilationStencil,
and makes the instantiation logic compatible with it.

Assignee: tcampbell → arai.unmht

BorrowingCompilationStencil provides a CompilationStencil instance that
borrows all ExtensibleCompilationStencil data,

Depends on D105892

Make all classes to follow init() + compile() + stencil().
stencil() returns a reference to ExtensibleCompilationStencil, and consumer
can either use BorrowingCompilationStencil to create temporary
CompilationStencil from it, or use ExtensibleCompilationStencil::finish to
get non-temporary CompilationStencil.

Depends on D105895

To support instantiating without heap-allocate CompilationStencil, modify
CompileGlobalScriptToStencil to receive either CompilationStencil pointer or
CompilationGCOutput pointer, and if CompilationGCOutput pointer is passed,
instantiate it internally.

Depends on D105896

For the case the consumer needs heap-allocated ExtensibleCompilationStencil,
make CompileGlobalScriptToStencilAndMaybeInstantiate possible to also return
ExtensibleCompilationStencil.

Depends on D105897

Also cleanup JSRuntime::initSelfHosting not to reuse already-initialized
CompilationInput from decode to compile.

Depends on D105898

reflect_parse wasn't using CompilationStencil, but uses
ExtensibleCompilationStencil in CompilationState.

Depends on D105907

Attachment #9204456 - Attachment description: Bug 1692577 - Part 1: Add BorrowingCompilationStencil. → Bug 1692577 - Part 1: Add BorrowingCompilationStencil. r=tcampbell
Attachment #9204457 - Attachment description: Bug 1692577 - Part 2: Move finish to ExtensibleCompilationStencil. → Bug 1692577 - Part 2: Move finish to ExtensibleCompilationStencil. r=tcampbell
Attachment #9204458 - Attachment description: Bug 1692577 - Part 3: Make more CompilationStencil& parameter const. → Bug 1692577 - Part 3: Make more CompilationStencil& parameter const. r=tcampbell
Attachment #9204459 - Attachment description: Bug 1692577 - Part 4: Unify Compiler class interface. → Bug 1692577 - Part 4: Unify Compiler class interface. r=tcampbell
Attachment #9204463 - Attachment description: Bug 1692577 - Part 8: Add ExtensibleCompilationStencil::{sizeOfExcludingThis,sizeOfIncludingThis}. → Bug 1692577 - Part 8: Add ExtensibleCompilationStencil::{sizeOfExcludingThis,sizeOfIncludingThis}. r=tcampbell
Attachment #9204456 - Attachment description: Bug 1692577 - Part 1: Add BorrowingCompilationStencil. r=tcampbell → Bug 1692577 - Part 1: Add BorrowingCompilationStencil. r=tcampbell!
Attachment #9204457 - Attachment description: Bug 1692577 - Part 2: Move finish to ExtensibleCompilationStencil. r=tcampbell → Bug 1692577 - Part 2: Move finish to ExtensibleCompilationStencil. r=tcampbell!
Attachment #9204458 - Attachment description: Bug 1692577 - Part 3: Make more CompilationStencil& parameter const. r=tcampbell → Bug 1692577 - Part 3: Make more CompilationStencil& parameter const. r=tcampbell!
Attachment #9204459 - Attachment description: Bug 1692577 - Part 4: Unify Compiler class interface. r=tcampbell → Bug 1692577 - Part 4: Unify Compiler class interface. r=tcampbell!
Attachment #9204460 - Attachment description: Bug 1692577 - Part 5: Add CompileGlobalScriptToStencilAndMaybeInstantiate. → Bug 1692577 - Part 5: Add CompileGlobalScriptToStencilAndMaybeInstantiate. r=tcampbell
Attachment #9204461 - Attachment description: Bug 1692577 - Part 6: Add frontend::CompileGlobalScriptToExtensibleStencil. → Bug 1692577 - Part 6: Add frontend::CompileGlobalScriptToExtensibleStencil. r=tcampbell
Attachment #9204462 - Attachment description: Bug 1692577 - Part 7: Use frontend::CompileGlobalScriptToExtensibleStencil in self-hosting. → Bug 1692577 - Part 7: Cleanup JSRuntime::initSelfHosting. r=tcampbell
Attachment #9204463 - Attachment description: Bug 1692577 - Part 8: Add ExtensibleCompilationStencil::{sizeOfExcludingThis,sizeOfIncludingThis}. r=tcampbell → Bug 1692577 - Part 8: Add ExtensibleCompilationStencil::{sizeOfExcludingThis,sizeOfIncludingThis}. r=tcampbell!
Attachment #9204464 - Attachment description: Bug 1692577 - Part 9: Use ExtensibleCompilationStencil in off-thread script compilation task. → Bug 1692577 - Part 9: Use ExtensibleCompilationStencil in off-thread script compilation task. r=tcampbell
Attachment #9204465 - Attachment description: Bug 1692577 - Part 10: Add ParseModuleToStencilAndMaybeInstantiate. → Bug 1692577 - Part 10: Add ParseModuleToStencilAndMaybeInstantiate. r=tcampbell
Attachment #9204466 - Attachment description: Bug 1692577 - Part 11: Use ExtensibleCompilationStencil in off-thread module compilation task → Bug 1692577 - Part 11: Use ExtensibleCompilationStencil in off-thread module compilation task r=tcampbell
Attachment #9204467 - Attachment description: Bug 1692577 - Part 12: Add frontend::CompileLazyFunctionToExtensibleStencil. → Bug 1692577 - Part 12: Add frontend::CompileLazyFunctionToExtensibleStencil. r=tcampbell
Attachment #9204468 - Attachment description: Bug 1692577 - Part 13: Use frontend::CompileGlobalScriptToExtensibleStencil in CompileSourceBufferAndStartIncrementalEncoding. → Bug 1692577 - Part 13: Use frontend::CompileGlobalScriptToExtensibleStencil in CompileSourceBufferAndStartIncrementalEncoding. r=tcampbell
Attachment #9204469 - Attachment description: Bug 1692577 - Part 14: Use frontend::CompileGlobalScriptToExtensibleStencil in CompileStencilXDR. → Bug 1692577 - Part 14: Use frontend::CompileGlobalScriptToExtensibleStencil in CompileStencilXDR. r=tcampbell
Attachment #9204470 - Attachment description: Bug 1692577 - Part 15: Use frontend::CompileGlobalScriptToExtensibleStencil in DumpStencil. → Bug 1692577 - Part 15: Use frontend::CompileGlobalScriptToExtensibleStencil in DumpStencil. r=tcampbell
Attachment #9204471 - Attachment description: Bug 1692577 - Part 16: Remove unnecessary and redundant ExtensibleCompilationStencil::finish from reflect_parse. → Bug 1692577 - Part 16: Remove unnecessary and redundant ExtensibleCompilationStencil::finish from reflect_parse. r=tcampbell
Attachment #9204461 - Attachment description: Bug 1692577 - Part 6: Add frontend::CompileGlobalScriptToExtensibleStencil. r=tcampbell → Bug 1692577 - Part 6: Add frontend::CompileGlobalScriptToExtensibleStencil. r=tcampbell!
Attachment #9204465 - Attachment description: Bug 1692577 - Part 10: Add ParseModuleToStencilAndMaybeInstantiate. r=tcampbell → Bug 1692577 - Part 10: Add ParseModuleToStencilAndMaybeInstantiate. r=tcampbell!
Attachment #9204467 - Attachment description: Bug 1692577 - Part 12: Add frontend::CompileLazyFunctionToExtensibleStencil. r=tcampbell → Bug 1692577 - Part 12: Add frontend::CompileLazyFunctionToExtensibleStencil. r=tcampbell!
Attachment #9204460 - Attachment description: Bug 1692577 - Part 5: Add CompileGlobalScriptToStencilAndMaybeInstantiate. r=tcampbell → Bug 1692577 - Part 5: Add CompileGlobalScriptToStencilAndMaybeInstantiate. r=tcampbell!
Attachment #9204462 - Attachment description: Bug 1692577 - Part 7: Cleanup JSRuntime::initSelfHosting. r=tcampbell → Bug 1692577 - Part 7: Cleanup JSRuntime::initSelfHosting. r=tcampbell!
Attachment #9204464 - Attachment description: Bug 1692577 - Part 9: Use ExtensibleCompilationStencil in off-thread script compilation task. r=tcampbell → Bug 1692577 - Part 9: Use ExtensibleCompilationStencil in off-thread script compilation task. r=tcampbell!
Attachment #9204466 - Attachment description: Bug 1692577 - Part 11: Use ExtensibleCompilationStencil in off-thread module compilation task r=tcampbell → Bug 1692577 - Part 11: Use ExtensibleCompilationStencil in off-thread module compilation task r=tcampbell!
Attachment #9204467 - Attachment description: Bug 1692577 - Part 12: Add frontend::CompileLazyFunctionToExtensibleStencil. r=tcampbell! → Bug 1692577 - Part 12: Add frontend::CompileLazyFunction. r=tcampbell!
Attachment #9204468 - Attachment description: Bug 1692577 - Part 13: Use frontend::CompileGlobalScriptToExtensibleStencil in CompileSourceBufferAndStartIncrementalEncoding. r=tcampbell → Bug 1692577 - Part 13: Use frontend::CompileGlobalScriptToExtensibleStencil in CompileSourceBufferAndStartIncrementalEncoding. r=tcampbell!
Attachment #9204469 - Attachment description: Bug 1692577 - Part 14: Use frontend::CompileGlobalScriptToExtensibleStencil in CompileStencilXDR. r=tcampbell → Bug 1692577 - Part 14: Use frontend::CompileGlobalScriptToExtensibleStencil in CompileStencilXDR. r=tcampbell!
Attachment #9204470 - Attachment description: Bug 1692577 - Part 15: Use frontend::CompileGlobalScriptToExtensibleStencil in DumpStencil. r=tcampbell → Bug 1692577 - Part 15: Use frontend::CompileGlobalScriptToExtensibleStencil in DumpStencil. r=tcampbell!
Attachment #9204471 - Attachment description: Bug 1692577 - Part 16: Remove unnecessary and redundant ExtensibleCompilationStencil::finish from reflect_parse. r=tcampbell → Bug 1692577 - Part 16: Remove unnecessary and redundant ExtensibleCompilationStencil::finish from reflect_parse. r=tcampbell!
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/a21a62d5bb75
Part 1: Add BorrowingCompilationStencil. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/386088c6a895
Part 2: Move finish to ExtensibleCompilationStencil. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/a0aa13363ec0
Part 3: Make more CompilationStencil& parameter const. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/24c81af7409a
Part 4: Unify Compiler class interface. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/3ef7987a19b9
Part 5: Add CompileGlobalScriptToStencilAndMaybeInstantiate. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/82c26c5615f5
Part 6: Add frontend::CompileGlobalScriptToExtensibleStencil. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/55d1272f20fd
Part 7: Cleanup JSRuntime::initSelfHosting. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/80291c93484e
Part 8: Add ExtensibleCompilationStencil::{sizeOfExcludingThis,sizeOfIncludingThis}. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/c18e9015fe3b
Part 9: Use ExtensibleCompilationStencil in off-thread script compilation task. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/2ff79c45b786
Part 10: Add ParseModuleToStencilAndMaybeInstantiate. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/271602dcf18d
Part 11: Use ExtensibleCompilationStencil in off-thread module compilation task r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/954ab0b62640
Part 12: Add frontend::CompileLazyFunction. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/3f4ceb6458d7
Part 13: Use frontend::CompileGlobalScriptToExtensibleStencil in CompileSourceBufferAndStartIncrementalEncoding. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/b7676660de86
Part 14: Use frontend::CompileGlobalScriptToExtensibleStencil in CompileStencilXDR. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/eb0886f3a78a
Part 15: Use frontend::CompileGlobalScriptToExtensibleStencil in DumpStencil. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/6a1f9a908a97
Part 16: Remove unnecessary and redundant ExtensibleCompilationStencil::finish from reflect_parse. r=tcampbell
You need to log in before you can comment on or make changes to this bug.