Remove Debugger::QueryScript::delazifyScripts()
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox83 | --- | fixed |
People
(Reporter: tcampbell, Assigned: tcampbell)
References
Details
Attachments
(3 files)
Due to syntax parsing, we may have js::BaseScript instances without full
bytecode. (Previously these had a distinct type called js::LazyScript). A
syntax-parsed script doesn't not have all the information that the Debugger
would normally like to query (such as detailed line-number info). Instead, for
these queries the Debugger first calls QueryScript::delazifyScripts[1] to fully
compile all BaseScript in a given Realm.
This compilation is a blunt operation that we would like to avoid if possible.
Instead of forcing compilation first, we should be able to do it as we go by
calling JSFunction::getOrCreateScript().
The specific examples we need to handle are in [2]. It is important to note
that we cannot call getOrCreateScript() while under IterateScripts so these
will need to be done in two phases. First, collect the best results using the
current system, then (if necessary) iterate over the vector expanding inner
functions and updating results.
[1] https://searchfox.org/mozilla-central/rev/6cd54550a27e2f6ca0755a25328f769e41e524f4/js/src/debugger/Debugger.cpp#5030-5035
[2] https://searchfox.org/mozilla-central/rev/6cd54550a27e2f6ca0755a25328f769e41e524f4/js/src/debugger/Debugger.cpp#5245,5265-5266
| Assignee | ||
Updated•6 years ago
|
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 1•5 years ago
|
||
| Assignee | ||
Comment 2•5 years ago
|
||
Instead of tracking the innermost script under the CellIter, collect the
results as though innermost was not specified and then do the filtering at
the end. This allows us to modify how line-matching works in later patches.
The tradeoff is that enclosing functions get collected in a vector
temporarily this is a very small cost compared to everything else that
happens in findScripts. Note that the "innermost" query is only used in
tests now.
Depends on D93036
| Assignee | ||
Comment 3•5 years ago
|
||
Querying a specific line number in the Debugger requires candidate scripts to
have bytecode in order to known the ending line number. Previously we would
delazify all scripts in a Realm before performing such queries. In this patch
we instead gather partial matches during the CellIter<BaseScript> visit and
do post-processing to delazify recursively if it may contain matches. This
system does no more compilations than before and since we visit every script
in the gc::Zone regardless, there is no additional impact.
In this new system we use the CellIter to collect all scripts that have been
exposed to script that are partial query matches. This includes scripts with
bytecode and lazy scripts with non-lazy parents. This handles cases where
enclosing scripts (such as in an eval) are GC'd but inner functions remain
live.
After the CellIter completes, we take the lazy scripts that are partial
matches, delazify them, and check if they still match with full information.
There inner lazy functions can then be recursively added to the work queue.
This gives the same results as before but without Realm-wide impact.
Depends on D93037
Comment 5•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/3bfe5441e543
https://hg.mozilla.org/mozilla-central/rev/4fdf553cb952
https://hg.mozilla.org/mozilla-central/rev/099a480f50a2
Description
•