Use a weak map to store the DebugScript associated with a JSScript
Categories
(Core :: JavaScript: GC, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox88 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Currently DebugScripts are problematic for concurrent marking because to trace the DebugScript associated with a JSScript it must be looked up in a hash table that can also be modified by the main thread.
Instead we could store these in a weak map, using the existing WeakMap class. This would move marking of DebugScripts to the weak marking part of collection. This would require wrapping each DebugScript in a JSObject as WeakMap doesn't support non-GC thing values.
Assignee | ||
Comment 1•4 years ago
|
||
This changes Zone::debugScriptMap to be a WeakMap rather than having its entries marked from BaseScript::traceChildren.
This simplifies script marking and removes some code from Zone.cpp. Unfortunately it does also adds a couple of complications:
-
We need to wrap DebugScript in a JSObject so we can use it as a WeakMap value. That leads to:
-
We need to do a bunch of extra rooting whenever we might create a DebugScript.
I tried making WeakMaps allow non-GC thing values but that also got complicated as marking relies on comparing the mark state of the key to that of the value (and the map) and this would require tracing the value and then combining the mark state of child pointers.
Comment 2•4 years ago
|
||
(In reply to Jon Coppeard (:jonco) from comment #1)
I tried making WeakMaps allow non-GC thing values but that also got complicated as marking relies on comparing the mark state of the key to that of the value (and the map) and this would require tracing the value and then combining the mark state of child pointers.
Huh. Isn't this just a matter of iterating over the breakpoints and or-ing their scripts' mark bits? Well, I guess if the code was gnarly, that's all there is to it.
Comment 4•4 years ago
|
||
bugherder |
Description
•