Add central template for weak map marking




JavaScript: GC
10 months ago
3 months ago


(Reporter: mccr8, Unassigned)



Firefox Tracking Flags

(Not tracked)




10 months ago
We have at least three copies of the logic for weak map marking (GC, plus two for the CC). It isn't that complex, but it is a little fiddly, so it would be nice if we had some way to let them all use the same core logic, via some template.

Comment 1

10 months ago
(In reply to Andrew McCreight [:mccr8] from comment #0)
This is a great idea.  I'm not sure exactly what form you had in mind though... like some kind of truth table?  It might be difficult to make the implementation use this (the GC weak map marking code is a little convoluted) but the fixup code and any checks certainly could.
Blocks: 1317672

Comment 2

10 months ago
I'm not familiar with how the GC marking code works. Maybe this isn't practical.
I would guess that it's practical and a good idea for everything *but* the GC marking code. There's a major difference between the GC marking case and all others: the GC marking case doesn't know yet what maps are alive. All other cases do (well, they know a conservative estimate of what's alive, anyway).

When doing GC marking, you can't just say eg "mark the value if both the map and the key are marked", because either you're doing this when marking the map (and the key may not have been marked *yet*), or when marking the key (and either the map may not have been marked yet, or you're doing the first fast marking phase which does not check whether some random object is a key).
Keywords: triage-deferred
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.