Closed Bug 1273908 Opened 3 years ago Closed 3 years ago

Simplify adding new kinds of GC thing

Categories

(Core :: JavaScript: GC, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 file)

There are a bunch of places where the list of thing kinds is baked in.  These can be refactored using macros to construct them from a central source of information about GC things.
This turned out to be more far-reaching than I thought.  Mainly I put more information into FOR_EACH_ALLOCKIND (now split into two halves) and used this wherever possible.  I did the same for trace kinds too.
Attachment #8753944 - Flags: review?(terrence)
Comment on attachment 8753944 [details] [diff] [review]
simplify-adding-gc-thing

Review of attachment 8753944 [details] [diff] [review]:
-----------------------------------------------------------------

Yup, that's exactly what I had in mind. Thanks for taking this!

::: js/public/TraceKind.h
@@ +97,5 @@
>  // are designed for use as array keys via EnumeratedArray.
>  enum class RootKind : int8_t
>  {
>      // These map 1:1 with trace kinds.
> +#define EXPAND_ROOT_KIND(name, type, _) \

|type| is unused here. The style I settled on by accident is _N for unused expansions: e.g. EXPAND_ROOT_KIND(name, _0, _1). I'd also be fine with always specifying all the names even if unused.
Attachment #8753944 - Flags: review?(terrence) → review+
https://hg.mozilla.org/mozilla-central/rev/106f482c6670
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.