[weakrefs] Rename JSFinalizationGroup's next field to next_dirty
R=ulan@chromium.org Bug: v8:8179 Change-Id: I9626bd070453ce1b7d4b91cf78b9f75b74dfddbe Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2051605 Commit-Queue: Shu-yu Guo <syg@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Cr-Commit-Position: refs/heads/master@{#66252}
This commit is contained in:
parent
3b48db40ad
commit
a44b20abe3
@ -1083,7 +1083,8 @@ void JSFinalizationGroup::JSFinalizationGroupVerify(Isolate* isolate) {
|
||||
if (cleared_cells().IsWeakCell()) {
|
||||
CHECK(WeakCell::cast(cleared_cells()).prev().IsUndefined(isolate));
|
||||
}
|
||||
CHECK(next().IsUndefined(isolate) || next().IsJSFinalizationGroup());
|
||||
CHECK(next_dirty().IsUndefined(isolate) ||
|
||||
next_dirty().IsJSFinalizationGroup());
|
||||
}
|
||||
|
||||
void JSFinalizationGroupCleanupIterator::
|
||||
|
@ -6075,13 +6075,13 @@ void Heap::AddDirtyJSFinalizationGroup(
|
||||
gc_notify_updated_slot) {
|
||||
DCHECK(!HasDirtyJSFinalizationGroups() ||
|
||||
dirty_js_finalization_groups_list().IsJSFinalizationGroup());
|
||||
DCHECK(finalization_group.next().IsUndefined(isolate()));
|
||||
DCHECK(finalization_group.next_dirty().IsUndefined(isolate()));
|
||||
DCHECK(!finalization_group.scheduled_for_cleanup());
|
||||
finalization_group.set_scheduled_for_cleanup(true);
|
||||
finalization_group.set_next(dirty_js_finalization_groups_list());
|
||||
finalization_group.set_next_dirty(dirty_js_finalization_groups_list());
|
||||
gc_notify_updated_slot(
|
||||
finalization_group,
|
||||
finalization_group.RawField(JSFinalizationGroup::kNextOffset),
|
||||
finalization_group.RawField(JSFinalizationGroup::kNextDirtyOffset),
|
||||
dirty_js_finalization_groups_list());
|
||||
set_dirty_js_finalization_groups_list(finalization_group);
|
||||
// dirty_js_finalization_groups_list is rescanned by ProcessWeakListRoots.
|
||||
@ -6092,8 +6092,9 @@ MaybeHandle<JSFinalizationGroup> Heap::TakeOneDirtyJSFinalizationGroup() {
|
||||
Handle<JSFinalizationGroup> finalization_group(
|
||||
JSFinalizationGroup::cast(dirty_js_finalization_groups_list()),
|
||||
isolate());
|
||||
set_dirty_js_finalization_groups_list(finalization_group->next());
|
||||
finalization_group->set_next(ReadOnlyRoots(isolate()).undefined_value());
|
||||
set_dirty_js_finalization_groups_list(finalization_group->next_dirty());
|
||||
finalization_group->set_next_dirty(
|
||||
ReadOnlyRoots(isolate()).undefined_value());
|
||||
return finalization_group;
|
||||
}
|
||||
return {};
|
||||
@ -6112,16 +6113,18 @@ void Heap::RemoveDirtyFinalizationGroupsOnContext(NativeContext context) {
|
||||
JSFinalizationGroup finalization_group = JSFinalizationGroup::cast(current);
|
||||
if (finalization_group.native_context() == context) {
|
||||
if (prev.IsUndefined(isolate)) {
|
||||
set_dirty_js_finalization_groups_list(finalization_group.next());
|
||||
set_dirty_js_finalization_groups_list(finalization_group.next_dirty());
|
||||
} else {
|
||||
JSFinalizationGroup::cast(prev).set_next(finalization_group.next());
|
||||
JSFinalizationGroup::cast(prev).set_next_dirty(
|
||||
finalization_group.next_dirty());
|
||||
}
|
||||
finalization_group.set_scheduled_for_cleanup(false);
|
||||
current = finalization_group.next();
|
||||
finalization_group.set_next(ReadOnlyRoots(isolate).undefined_value());
|
||||
current = finalization_group.next_dirty();
|
||||
finalization_group.set_next_dirty(
|
||||
ReadOnlyRoots(isolate).undefined_value());
|
||||
} else {
|
||||
prev = current;
|
||||
current = finalization_group.next();
|
||||
current = finalization_group.next_dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,14 +188,14 @@ struct WeakListVisitor<AllocationSite> {
|
||||
template <>
|
||||
struct WeakListVisitor<JSFinalizationGroup> {
|
||||
static void SetWeakNext(JSFinalizationGroup obj, Object next) {
|
||||
obj.set_next(next, UPDATE_WEAK_WRITE_BARRIER);
|
||||
obj.set_next_dirty(next, UPDATE_WEAK_WRITE_BARRIER);
|
||||
}
|
||||
|
||||
static Object WeakNext(JSFinalizationGroup obj) { return obj.next(); }
|
||||
static Object WeakNext(JSFinalizationGroup obj) { return obj.next_dirty(); }
|
||||
|
||||
static HeapObject WeakNextHolder(JSFinalizationGroup obj) { return obj; }
|
||||
|
||||
static int WeakNextOffset() { return JSFinalizationGroup::kNextOffset; }
|
||||
static int WeakNextOffset() { return JSFinalizationGroup::kNextDirtyOffset; }
|
||||
|
||||
static void VisitLiveObject(Heap*, JSFinalizationGroup, WeakObjectRetainer*) {
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ ACCESSORS(JSFinalizationGroup, active_cells, HeapObject, kActiveCellsOffset)
|
||||
ACCESSORS(JSFinalizationGroup, cleared_cells, HeapObject, kClearedCellsOffset)
|
||||
ACCESSORS(JSFinalizationGroup, key_map, Object, kKeyMapOffset)
|
||||
SMI_ACCESSORS(JSFinalizationGroup, flags, kFlagsOffset)
|
||||
ACCESSORS(JSFinalizationGroup, next, Object, kNextOffset)
|
||||
ACCESSORS(JSFinalizationGroup, next_dirty, Object, kNextDirtyOffset)
|
||||
CAST_ACCESSOR(JSFinalizationGroup)
|
||||
|
||||
void JSFinalizationGroup::Register(
|
||||
|
@ -31,8 +31,7 @@ class JSFinalizationGroup : public JSObject {
|
||||
DECL_ACCESSORS(cleared_cells, HeapObject)
|
||||
DECL_ACCESSORS(key_map, Object)
|
||||
|
||||
// For storing a list of JSFinalizationGroup objects in NativeContext.
|
||||
DECL_ACCESSORS(next, Object)
|
||||
DECL_ACCESSORS(next_dirty, Object)
|
||||
|
||||
DECL_INT_ACCESSORS(flags)
|
||||
|
||||
|
@ -10,7 +10,7 @@ extern class JSFinalizationGroup extends JSObject {
|
||||
key_map: Object;
|
||||
// For the linked list of FinalizationGroups that need cleanup. This link
|
||||
// is weak.
|
||||
next: Undefined|JSFinalizationGroup;
|
||||
next_dirty: Undefined|JSFinalizationGroup;
|
||||
flags: Smi;
|
||||
}
|
||||
|
||||
|
@ -257,11 +257,11 @@ class JSFinalizationGroup::BodyDescriptor final : public BodyDescriptorBase {
|
||||
template <typename ObjectVisitor>
|
||||
static inline void IterateBody(Map map, HeapObject obj, int object_size,
|
||||
ObjectVisitor* v) {
|
||||
IteratePointers(obj, JSObject::BodyDescriptor::kStartOffset, kNextOffset,
|
||||
v);
|
||||
IterateCustomWeakPointer(obj, kNextOffset, v);
|
||||
IterateJSObjectBodyImpl(map, obj, kNextOffset + kTaggedSize, object_size,
|
||||
v);
|
||||
IteratePointers(obj, JSObject::BodyDescriptor::kStartOffset,
|
||||
kNextDirtyOffset, v);
|
||||
IterateCustomWeakPointer(obj, kNextDirtyOffset, v);
|
||||
IterateJSObjectBodyImpl(map, obj, kNextDirtyOffset + kTaggedSize,
|
||||
object_size, v);
|
||||
}
|
||||
|
||||
static inline int SizeOf(Map map, HeapObject object) {
|
||||
|
Loading…
Reference in New Issue
Block a user