Closed Bug 1215752 Opened 7 years ago Closed 7 years ago

Weakmap refactoring

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44

People

(Reporter: sfink, Assigned: sfink)

References

Details

Attachments

(1 file)

The weakmap code has too large an API surface and its own unique terminology.
Attempt to make the terminology fit in better. This is meant to be a pure refactoring, but I merged some functions together that make it non-obvious. Try is still green, though!

I'm not sure if I'm using "mark" and "trace" according to the latest meanings everywhere. Also, this patch is referring to "implicit edges", the idea being that objects have explicit edges (their properties and things) as well as implicit edges (eg they are used as keys that map to values, and their liveness affects the values' liveness.) Whether I can fit WeakRefs into that naming scheme, I'm not entirely sure yet. I have an upcoming patch that moves somewhat in that direction. I think.
Attachment #8675206 - Flags: review?(terrence)
Comment on attachment 8675206 [details] [diff] [review]
Weakmap refactoring

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

Nice! All the r+.

::: js/src/jsweakmap.h
@@ +43,1 @@
>  class WeakMapBase : public mozilla::LinkedListElement<WeakMapBase>

\o/

@@ +261,5 @@
> +                markedAny = true;
> +            }
> +
> +            if (keyIsMarked) {
> +                if (markValue(trc, &e.front().value()))

Oh, hey! Everything in markValue is now templatized -- we used to need it because MarkValueUnbarriered vs MarkObjectUnbarriered -- so it would probably be clearer to inline it here now that there is only one callsite.

@@ -349,5 @@
>  
> -    /* Rekey an entry when moved, ensuring we do not trigger barriers. */
> -    void entryMoved(Enum& e, const Key& k) {
> -        e.rekeyFront(k);
> -    }

Thanks!
Attachment #8675206 - Flags: review?(terrence) → review+
This landed yesterday - https://hg.mozilla.org/mozilla-central/rev/bde9f8e215c2
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.