Batch all script initialization for a parse tree into a single operation
Categories
(Core :: JavaScript Engine, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox78 | --- | fixed |
People
(Reporter: mgaudet, Assigned: tcampbell)
References
Details
Attachments
(8 files, 2 obsolete files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
In order for us do JSScript initialization and all allocation on main thread we first will need to batch all the GC object allocation and script initialization for a parse task into a single place; this is what would be moved to main thread.
This will require changing the lifetime of some parse artifacts that are current LifoAlloc'd, and thus wouldn't have a lifetime long enough for batching.
Updated•5 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
This sets up for later patches that do batch script allocation.
Assignee | ||
Comment 2•4 years ago
|
||
This is called for each newly allocated JSFunction that will be exposed to
script via JSOp::Lambda/LambdaArrow in their enclosing script.
This must currently be performed before creating the script. For such
functions that are generating bytecode, we defer the call until the
BaseScript is created. For functions that are lazy, we batch the calls at the
end during CompilationInfo::finishFunctions.
Depends on D76547
Assignee | ||
Comment 3•4 years ago
|
||
Split the array of variants into an array of JSFunction and and array of
ScriptStencil. This will let use hold the Stencil from the BCE until the end.
In the future we will be able to remove the JSFunction array.
Depends on D76548
Assignee | ||
Comment 4•4 years ago
|
||
Stash the ScriptStencil when generated and at the end of bytecode emission
allocate the BaseScripts together.
Fix the FunctionBox::wasEmitted flag to handle standalone functions. We then
rely on this flag to know that a FunctionBox is actually live and wasn't
elided by the BCE. This can happen in pathological cases when an anonymous
function doesn't save its value.
Depends on D76549
Assignee | ||
Comment 5•4 years ago
|
||
Rename CompilationInfo::finishFunctions to instantiateStencils and include
the instantation of non-function stencil as well.
Depends on D76548
Assignee | ||
Comment 6•4 years ago
|
||
Absorb CompilationInfo::publishDeferredFunctions into instantiateStencils so
that it runs after BytecodeEmitter completes.
Depends on D76566
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 7•4 years ago
|
||
When we reparse, also rollback some deferred object creation records. This
will avoid creating junk data in the Stencil. We limit this to only the
FunctionBox list for now since that is what we traverse over.
Depends on D76549
Assignee | ||
Comment 8•4 years ago
|
||
Remove FunctionBox::exposeScript in favour of checking wasEmitted. AsmJS
functions are wasEmitted but not exposeScript so handle that case too.
Remove FunctionBox::emitLazy since the reparse rollback patch avoids us
seeing an incomplete FunctionBox. The lazy BaseScript allocation will
eventually be merged with other Stencil instantiation.
Note: During delazification, the JSFunctions already exist and as a result
publishDeferredFunctions has no work to do. The emitLazy flag was never set
for delazification.
Depends on D76765
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 9•4 years ago
|
||
The Inferred/Guessed atoms are computed by the BytecodeEmitter running on the
enclosing script. During initial compilation we have the name before we
allocate the JSFunction, but for delazification the inner functions already
have been allocated without a name. Use FunctionBox::finish to apply these
names.
Depends on D76568
Assignee | ||
Comment 10•4 years ago
|
||
Depends on D76767
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 11•4 years ago
|
||
Comment 12•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/cfefeb4ca74b
https://hg.mozilla.org/mozilla-central/rev/b24b6c32a6f7
https://hg.mozilla.org/mozilla-central/rev/3f5d11bc4142
https://hg.mozilla.org/mozilla-central/rev/347c4f6c2a7e
https://hg.mozilla.org/mozilla-central/rev/c1496d6074bc
https://hg.mozilla.org/mozilla-central/rev/9a60e9023397
https://hg.mozilla.org/mozilla-central/rev/4e1835470ba3
https://hg.mozilla.org/mozilla-central/rev/b4278438eaa6
Description
•