Closed Bug 1522061 Opened 1 year ago Closed 1 year ago

Add more information for different concepts in JS_FOR_EACH_TRACEKIND


(Core :: JavaScript: GC, enhancement, P3)




Tracking Status
firefox68 --- fixed


(Reporter: allstars.chh, Assigned: allstars.chh)




(2 files)


In bug 1510607 we found that we are conflating too many concepts into one category, and this caused some regression.

So I file this as a separate bug to isolate the data stored in JS_FOR_EACH_TRACEKIND into different categories

Type: defect → enhancement

Hi mccr8
I'd like to ask do TraceKind::BaseShape and TraceKind::JitCode participate in CC?
CC reads this information in IsCCTraceKind (used to called AddToCCKind, as I changed the naming in bug 1478533)
but BaseShape and JitCode are not listed in this function.

And the comment in nsCycleCollector says CC will look at gray objects
and according to the table in JS_FOR_EACH_TRACEKIND, these two TraceKinds(BaseShape and JitCode) can be marked gray.
so does this mean CC will watch these two?


Flags: needinfo?(continuation)

I'm not sure what is going on with JitCode, but for shapes, they need to be marked grey by the GC, because the CC wants to trace through them, but the CC does not represent shapes in the CC graph. Instead, the outgoing edges from a shape will be attributed to any JS objects that hold onto that shape.

Flags: needinfo?(continuation)

Oh, that's right, GC things can be in one of 3 different categories:

  1. never part of a gray cycle, so don't need to participate at all in gray marking
  2. can be part of a gray cycle, but not represented in CC graph
  3. can be part of a gray cycle, represented by a node in the CC graph

For case (2), it's as mccr8 described: if you have the GC graph A -> B1 -> B2 -> B3 -> C, and all of the B nodes fall within case 2, then the CC graph will look like CC(A) -> CC(C).

It could be represented as 2 booleans, or a 3-way enumeration.

TypeParticipatesInCC is confusing, as this function is used to tell if a
TraceKind can be marked gray.

Pushed by
Part 1: rename to TraceKindCanBeGray. r=jonco
Part 2: implement isCCTraceKind with JS_FOR_EACH_TRACEKIND. r=jonco
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.