Commit 5895436b authored by Mike Stanton's avatar Mike Stanton Committed by V8 LUCI CQ

Better describe the meaning of a zombie AllocationSite

AllocationSites are strongly rooted in various places.
AllocationMementos, small heap objects immediately behind the
objects which AllocationSites tracks, are purposely left
unrooted. They do however, point to AllocationSites.

This leads to a situation where an AllocationSite may no longer
be seen to have strong roots at gc time, and yet new space is
still repleat with AllocationMementos which point to it.
The GC recognizes this, and marks the AllocationSite as a
"zombie," that is, an object which should be kept alive for
one more GC cycle because of the existence of those mementos
which point to it.

Change-Id: Ifa720c28f216dee2eaf7edd6f489b5c7427d4353
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2928500Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74866}
parent 3e64f2cf
......@@ -31,7 +31,7 @@ class AllocationSite : public Struct {
kDontTenure = 1,
kMaybeTenure = 2,
kTenure = 3,
kZombie = 4,
kZombie = 4, // See comment to IsZombie() for documentation.
kLastPretenureDecisionValue = kZombie
};
......@@ -102,10 +102,14 @@ class AllocationSite : public Struct {
inline int memento_create_count() const;
inline void set_memento_create_count(int count);
// The pretenuring decision is made during gc, and the zombie state allows
// us to recognize when an allocation site is just being kept alive because
// a later traversal of new space may discover AllocationMementos that point
// to this AllocationSite.
// A "zombie" AllocationSite is one which has no more strong roots to
// it, and yet must be maintained until the next GC. The reason is that
// it may be that in new space there are AllocationMementos hanging around
// which point to the AllocationSite. If we scavenge these AllocationSites
// too soon, those AllocationMementos will end up pointing to garbage
// addresses. The garbage collector marks such AllocationSites as zombies
// when it discovers there are no roots, allowing the subsequent collection
// pass to recognize zombies and discard them later.
inline bool IsZombie() const;
inline bool IsMaybeTenure() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment