Commit 93b3c7e0 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Handle young large objects in global handles

Bug: chromium:852420
Change-Id: I9c86353734055ef08ab5b2d3c55bf5dd0a870335
Reviewed-on: https://chromium-review.googlesource.com/c/1463520
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59511}
parent cbd8f426
......@@ -8851,14 +8851,14 @@ void Isolate::VisitHandlesForPartialDependence(
PersistentHandleVisitor* visitor) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
i::DisallowHeapAllocation no_allocation;
isolate->global_handles()->IterateAllRootsInNewSpaceWithClassIds(visitor);
isolate->global_handles()->IterateAllYoungRootsWithClassIds(visitor);
}
void Isolate::VisitWeakHandles(PersistentHandleVisitor* visitor) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
i::DisallowHeapAllocation no_allocation;
isolate->global_handles()->IterateWeakRootsInNewSpaceWithClassIds(visitor);
isolate->global_handles()->IterateYoungWeakRootsWithClassIds(visitor);
}
void Isolate::SetAllowAtomicsWait(bool allow) {
......
This diff is collapsed.
......@@ -120,18 +120,18 @@ class GlobalHandles final {
void IterateStrongRoots(RootVisitor* v);
void IterateWeakRoots(RootVisitor* v);
void IterateAllRoots(RootVisitor* v);
void IterateAllNewSpaceRoots(RootVisitor* v);
void IterateAllYoungRoots(RootVisitor* v);
// Iterates over all handles that have embedder-assigned class ID.
void IterateAllRootsWithClassIds(v8::PersistentHandleVisitor* v);
// Iterates over all handles in the new space that have embedder-assigned
// class ID.
void IterateAllRootsInNewSpaceWithClassIds(v8::PersistentHandleVisitor* v);
void IterateAllYoungRootsWithClassIds(v8::PersistentHandleVisitor* v);
// Iterate over all handles in the new space that are weak, unmodified
// and have class IDs
void IterateWeakRootsInNewSpaceWithClassIds(v8::PersistentHandleVisitor* v);
void IterateYoungWeakRootsWithClassIds(v8::PersistentHandleVisitor* v);
// Iterates over all traces handles represented by TracedGlobal.
void IterateTracedNodes(
......@@ -149,22 +149,21 @@ class GlobalHandles final {
void IterateWeakRootsForPhantomHandles(
WeakSlotCallbackWithHeap should_reset_handle);
// Note: The following *NewSpace* methods are used for the Scavenger to
// identify and process handles in new space. The set of new space handles is
// complete but the methods may encounter handles that are already in old
// space.
// Note: The following *Young* methods are used for the Scavenger to
// identify and process handles in the young generation. The set of young
// handles is complete but the methods may encounter handles that are
// already in old space.
// Iterates over strong and dependent handles. See the note above.
void IterateNewSpaceStrongAndDependentRoots(RootVisitor* v);
void IterateYoungStrongAndDependentRoots(RootVisitor* v);
// Marks weak unmodified handles satisfying |is_dead| as pending.
void MarkNewSpaceWeakUnmodifiedObjectsPending(
WeakSlotCallbackWithHeap is_dead);
void MarkYoungWeakUnmodifiedObjectsPending(WeakSlotCallbackWithHeap is_dead);
// Iterates over weak independent or unmodified handles.
// See the note above.
void IterateNewSpaceWeakUnmodifiedRootsForFinalizers(RootVisitor* v);
void IterateNewSpaceWeakUnmodifiedRootsForPhantomHandles(
void IterateYoungWeakUnmodifiedRootsForFinalizers(RootVisitor* v);
void IterateYoungWeakUnmodifiedRootsForPhantomHandles(
RootVisitor* v, WeakSlotCallbackWithHeap should_reset_handle);
// Identify unmodified objects that are in weak state and marks them
......@@ -209,8 +208,8 @@ class GlobalHandles final {
std::vector<std::pair<T*, PendingPhantomCallback>>* pending);
template <typename T>
void UpdateAndCompactListOfNewSpaceNode(std::vector<T*>* node_list);
void UpdateListOfNewSpaceNodes();
void UpdateAndCompactListOfYoungNode(std::vector<T*>* node_list);
void UpdateListOfYoungNodes();
void ApplyPersistentHandleVisitor(v8::PersistentHandleVisitor* visitor,
Node* node);
......@@ -218,12 +217,12 @@ class GlobalHandles final {
Isolate* const isolate_;
std::unique_ptr<NodeSpace<Node>> regular_nodes_;
// Contains all nodes holding new space objects. Note: when the list
// Contains all nodes holding young objects. Note: when the list
// is accessed, some of the objects may have been promoted already.
std::vector<Node*> new_space_nodes_;
std::vector<Node*> young_nodes_;
std::unique_ptr<NodeSpace<TracedNode>> traced_nodes_;
std::vector<TracedNode*> traced_new_space_nodes_;
std::vector<TracedNode*> traced_young_nodes_;
// Field always containing the number of handles to global objects.
size_t handles_count_ = 0;
......@@ -282,8 +281,8 @@ class EternalHandles final {
// Iterates over all handles.
void IterateAllRoots(RootVisitor* visitor);
// Iterates over all handles which might be in new space.
void IterateNewSpaceRoots(RootVisitor* visitor);
// Iterates over all handles which might be in the young generation.
void IterateYoungRoots(RootVisitor* visitor);
// Rebuilds new space list.
void PostGarbageCollectionProcessing();
......@@ -304,7 +303,7 @@ class EternalHandles final {
int size_ = 0;
std::vector<Address*> blocks_;
std::vector<int> new_space_indices_;
std::vector<int> young_node_indices_;
DISALLOW_COPY_AND_ASSIGN(EternalHandles);
};
......
......@@ -3910,10 +3910,10 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) {
break;
case VISIT_ALL_IN_SCAVENGE:
case VISIT_ALL_IN_MINOR_MC_MARK:
isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v);
isolate_->global_handles()->IterateYoungStrongAndDependentRoots(v);
break;
case VISIT_ALL_IN_MINOR_MC_UPDATE:
isolate_->global_handles()->IterateAllNewSpaceRoots(v);
isolate_->global_handles()->IterateAllYoungRoots(v);
break;
case VISIT_ALL_IN_SWEEP_NEWSPACE:
case VISIT_ALL:
......@@ -3926,7 +3926,7 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) {
// serializer. Values referenced by eternal handles need to be added manually.
if (mode != VISIT_FOR_SERIALIZATION) {
if (isMinorGC) {
isolate_->eternal_handles()->IterateNewSpaceRoots(v);
isolate_->eternal_handles()->IterateYoungRoots(v);
} else {
isolate_->eternal_handles()->IterateAllRoots(v);
}
......
......@@ -4577,14 +4577,13 @@ void MinorMarkCompactCollector::MarkLiveObjects() {
{
TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_MARK_GLOBAL_HANDLES);
isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending(
isolate()->global_handles()->MarkYoungWeakUnmodifiedObjectsPending(
&IsUnmarkedObjectForYoungGeneration);
isolate()->global_handles()->IterateYoungWeakUnmodifiedRootsForFinalizers(
&root_visitor);
isolate()
->global_handles()
->IterateNewSpaceWeakUnmodifiedRootsForFinalizers(&root_visitor);
isolate()
->global_handles()
->IterateNewSpaceWeakUnmodifiedRootsForPhantomHandles(
->IterateYoungWeakUnmodifiedRootsForPhantomHandles(
&root_visitor, &IsUnmarkedObjectForYoungGeneration);
ProcessMarkingWorklist();
}
......
......@@ -230,17 +230,16 @@ void ScavengerCollector::CollectGarbage() {
// Scavenge weak global handles.
TRACE_GC(heap_->tracer(),
GCTracer::Scope::SCAVENGER_SCAVENGE_WEAK_GLOBAL_HANDLES_PROCESS);
isolate_->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending(
isolate_->global_handles()->MarkYoungWeakUnmodifiedObjectsPending(
&IsUnscavengedHeapObject);
isolate_->global_handles()
->IterateNewSpaceWeakUnmodifiedRootsForFinalizers(
&root_scavenge_visitor);
isolate_->global_handles()->IterateYoungWeakUnmodifiedRootsForFinalizers(
&root_scavenge_visitor);
scavengers[kMainThreadId]->Process();
DCHECK(copied_list.IsEmpty());
DCHECK(promotion_list.IsEmpty());
isolate_->global_handles()
->IterateNewSpaceWeakUnmodifiedRootsForPhantomHandles(
->IterateYoungWeakUnmodifiedRootsForPhantomHandles(
&root_scavenge_visitor, &IsUnscavengedHeapObject);
}
......
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