Closed
Bug 1458878
Opened 7 years ago
Closed 7 years ago
Assert no GC in IterateScriptCallback
Categories
(Core :: JavaScript Engine, enhancement, P3)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla62
People
(Reporter: arai, Assigned: arai)
Details
Attachments
(1 file)
(deleted),
patch
|
jonco
:
review+
|
Details | Diff | Splinter Review |
IterateScriptCallback is the type of the callback function called by IterateScripts:
https://searchfox.org/mozilla-central/rev/ce9ff94ffed34dc17ec0bfa406156d489eaa8ee1/js/src/gc/PublicIterators.cpp#82-102
> void
> js::IterateScripts(JSContext* cx, JSCompartment* compartment,
> void* data, IterateScriptCallback scriptCallback)
> {
> ...
> scriptCallback(cx->runtime(), data, script);
> ...
> scriptCallback(cx->runtime(), data, script);
IterateScripts is called only from the Debugger, the following line:
https://searchfox.org/mozilla-central/rev/ce9ff94ffed34dc17ec0bfa406156d489eaa8ee1/js/src/vm/Debugger.cpp#4416
> class MOZ_STACK_CLASS Debugger::ScriptQuery
> {
> ...
> bool findScripts() {
> ...
> IterateScripts(cx, singletonComp, this, considerScript);
and Debugger::ScriptQuery::considerScript calls Debugger::ScriptQuery::consider, which doesn't GC.
https://searchfox.org/mozilla-central/rev/ce9ff94ffed34dc17ec0bfa406156d489eaa8ee1/js/src/vm/Debugger.cpp#4592-4682
> static void considerScript(JSRuntime* rt, void* data, JSScript* script) {
> ScriptQuery* self = static_cast<ScriptQuery*>(data);
> self->consider(script);
> }
>
> /*
> * If |script| matches this query, append it to |vector| or place it in
> * |innermostForCompartment|, as appropriate. Set |oom| if an out of memory
> * condition occurred.
> */
> void consider(JSScript* script) {
> ...
> }
We can assert that IterateScriptCallback doesn't GC, so that we can keep unrooted GCThing across IterateScripts call, which I'm about to do in bug 1434305.
Assignee | ||
Comment 1•7 years ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #0)
> We can assert that IterateScriptCallback doesn't GC, so that we can keep
> unrooted GCThing across IterateScripts call
this turns out to be false, since those 2 lines can GC...
https://searchfox.org/mozilla-central/rev/ce9ff94ffed34dc17ec0bfa406156d489eaa8ee1/js/src/gc/PublicIterators.cpp#87-88
> void
> js::IterateScripts(JSContext* cx, JSCompartment* compartment,
> void* data, IterateScriptCallback scriptCallback)
> {
> ...
> AutoEmptyNursery empty(cx);
> AutoPrepareForTracing prep(cx);
No longer blocks: 1434305
Updated•7 years ago
|
Priority: -- → P3
Assignee | ||
Comment 2•7 years ago
|
||
* Added AutoSuppressGCAnalysis to IterateScripts,
after AutoEmptyNursery and AutoPrepareForTracing which will GC
* Added AutoRequireNoGC to IterateScriptCallback
Attachment #8974598 -
Flags: review?(jcoppeard)
Comment 3•7 years ago
|
||
Comment on attachment 8974598 [details] [diff] [review]
Assert no GC in IterateScriptCallback.
Review of attachment 8974598 [details] [diff] [review]:
-----------------------------------------------------------------
Great, thanks.
Attachment #8974598 -
Flags: review?(jcoppeard) → review+
Assignee | ||
Comment 4•7 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/f011dbac793e72faba4e7bb46233c803458ddd52
Bug 1458878 - Assert no GC in IterateScriptCallback. r=jonco
Comment 5•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox62:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
Updated•7 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•