Remove code-coverage dependence on JSScript::realm() during finalization
Categories
(Core :: JavaScript Engine, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox71 | --- | fixed |
People
(Reporter: tcampbell, Assigned: tcampbell)
References
Details
Attachments
(7 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 |
Bug 1575350 removed most of the uses of JSScript::realm() during JSScript finalization, but the lcov stuff still using a LCovRealm. This is currently complicating Bug 1568245.
Assignee | ||
Comment 1•6 years ago
|
||
The approach that I am going with it to replace ScriptNameMap with a HashMap<JSScript*, LCovSource*>. This moves the LCovSource allocation earlier, but simplifies what we do in the JSScript::finalizer. It will also stop us from cloning the filename for each inner function while running code coverage.
Assignee | ||
Comment 2•6 years ago
|
||
Split the GetCodeCoverageSummary API into a variant for a specific realm
vs checking all realms. This restores the original behaviour of the
getLcovInfo testing function to only return info on current realm. This
makes testing OOM behaviour much more predictable.
Assignee | ||
Comment 3•6 years ago
|
||
Avoid creating the ScriptNameMap in the off-thread parse zone. Instead
perform JSScript::initScriptName when merging the parse result to main
thread. This will avoid the need to migrate coverage initialization data
between Realms.
Depends on D46167
Assignee | ||
Comment 4•6 years ago
|
||
Save a little bit of memory when code coverage is not in use. Add a
collectCodeCoverage method to the realm so it can allocate LCovRealm on
demand. Also compute the realm name string from the constructor instead
of in the lookup code (this still happens at same time).
Depends on D46168
Assignee | ||
Comment 5•6 years ago
|
||
Now that LCovRealm is allocated on demand, use a Vector directly instead
of allocating that vector on demand. To ensure pointer stability of
LCovSources, allocated them in the LifoAlloc and only store pointers in
the sources vector. They are still fully owned by the LCovRealm.
Depends on D46169
Assignee | ||
Comment 6•6 years ago
|
||
To prepare for later patches, track writeScript OOMs as a flag inside
LCovSource. The objective is to be able to call LCovSource::writeScript
directly from the JSScript finalizer without needing access to the
current realm.
Depends on D46170
Assignee | ||
Comment 7•6 years ago
|
||
Remove LCovRealm::collectCodeCoverageInfo and directly call
LCovSource::writeScript from JSScript::finalize and others. In later
patches we will replace the script-name map with a LCovSource map.
Depends on D46171
Assignee | ||
Comment 8•6 years ago
|
||
Rename the ScriptNameMap to ScriptLCovMap and associate LCovSource* with
each script rather than a private clone of filename. This removes the
need for JSScript::finalize to need access to JSScript::realm().
Depends on D46172
Assignee | ||
Comment 9•6 years ago
|
||
The overall objective here is to remove the calls to JSScript::realm() from JSScript::finalize. The result of this patch stack is for a JSScript to be associated with an LCovSource* during initialization. During finalization, the coverage counts for a script are accumulated into the LCovSource.
The first patch (Add js::GetCodeCoverageSummaryAll API) fixes an issue where coverage/bug1214548.js would timeout. The issue was that js::GetCodeCoverageSummary was collecting coverage data beyond just the correct realm.
The second patch (Run JSScript::initScriptName on main-thread only) tries to avoid generating any of the coverage tables in the off-thread parse Zone and defers calling initScriptName until we merge the off-thread parse task back to main thread.
The rest of the patches cleanup LCovRealm/LCovSource so that having a LCovSource* is sufficient to finalize a script. I kept it in parts to make it easier to see progression, but I can also squash if that is clearer.
Assignee | ||
Updated•6 years ago
|
Comment 10•6 years ago
|
||
Comment 11•6 years ago
|
||
bugherder |
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Comment 12•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Comment 13•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/8d80982a429f
https://hg.mozilla.org/mozilla-central/rev/b194fe05c555
https://hg.mozilla.org/mozilla-central/rev/8a7f8a71391f
Description
•