Don't mark certainly alive event listeners gray, but trace them via JS_AddExtraGCRootsTracer callback

RESOLVED INACTIVE

Status

()

Core
DOM
RESOLVED INACTIVE
3 years ago
4 days ago

People

(Reporter: smaug, Unassigned, NeedInfo)

Tracking

36 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

3 years ago
Created attachment 8631785 [details] [diff] [review]
wip

The patch should do it, but that seems to increase the initial GC slice a bit, and I don't think we want that. (Very unscientific comparison using javascript.options.mem.log information and running http://videos.mozilla.org/serv/mozhacks/flight-of-the-navigator/)

Could we incrementalize marking some more?

Doing less gray marking would speed up forgetSkippable phases - and in general should lead to doing less work. Currently GC marks tons of stuff gray, and then forgetSkippable unmarks most of it.
(Reporter)

Comment 1

3 years ago
Also most of the message manager tracing could happen similar way.

Would it be possible to have separate slices for "black marking".
Flags: needinfo?(jcoppeard)
(In reply to Olli Pettay [:smaug] from comment #1)
Yes, incrementalising root marking is already on our radar for decreasing pause times.  This work is about incrementalising the roots marked by the embedding via callbacks.

One issue is that you will need to ensure the snapshot invariant: everything that was live at the start of the GC eventually gets marked.  I don't know how event listeners work but this may involve adding a write barrier or some other approach.
(Reporter)

Comment 3

3 years ago
It should be fine to mark listeners as alive if they were alive when GC started.
If nothing from C++ actually keeps them alive later, the next GC will just collect them, or at least 
mark them gray.

forgetSkippable anyhow unmarks-gray tons of stuff, if at some point before CC actually runs the js stuff is kept alive by certainly alive C++. To collect such stuff CC needs GC to run and do the gray marking again, and if C++ isn't anymore certainly alive, unmarking won't happen and CC will trace through the gray JS.
Yes, the weird thing about these CC optimizations is that they can be done on a "best effort" basis. If we somehow mess up and fail to mark them black, it is okay because we're going to mark them as gray later.

Comment 5

4 days ago
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Last Resolved: 4 days ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.