Commit f11e4028 authored by Anton Bikineev's avatar Anton Bikineev Committed by V8 LUCI CQ

cppgc: young-gen: Don't visit TracedReferences for minor GC concurrent-marker

In Oilpan minor GCs we don't trace the V8 subgraph. The commit
2da23bd5 broke it for the concurrent marker case. This CL bails
out from visiting TracedReferences in the concurrent marker visitor,
same as what we do for the mutator marking visitor.

Bug: chromium:1029379
Change-Id: Iabeba11fd3d030e9dc5961a364481a0a7d8b8245
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3602520Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80135}
parent c2cd3e64
...@@ -208,23 +208,30 @@ class UnifiedHeapConcurrentMarker ...@@ -208,23 +208,30 @@ class UnifiedHeapConcurrentMarker
cppgc::internal::MarkingWorklists& marking_worklists, cppgc::internal::MarkingWorklists& marking_worklists,
cppgc::internal::IncrementalMarkingSchedule& incremental_marking_schedule, cppgc::internal::IncrementalMarkingSchedule& incremental_marking_schedule,
cppgc::Platform* platform, cppgc::Platform* platform,
UnifiedHeapMarkingState& unified_heap_marking_state) UnifiedHeapMarkingState& unified_heap_marking_state,
CppHeap::CollectionType collection_type)
: cppgc::internal::ConcurrentMarkerBase( : cppgc::internal::ConcurrentMarkerBase(
heap, marking_worklists, incremental_marking_schedule, platform), heap, marking_worklists, incremental_marking_schedule, platform),
v8_heap_(v8_heap) {} v8_heap_(v8_heap),
collection_type_(collection_type) {}
std::unique_ptr<cppgc::Visitor> CreateConcurrentMarkingVisitor( std::unique_ptr<cppgc::Visitor> CreateConcurrentMarkingVisitor(
cppgc::internal::ConcurrentMarkingState&) const final; cppgc::internal::ConcurrentMarkingState&) const final;
private: private:
Heap* const v8_heap_; Heap* const v8_heap_;
CppHeap::CollectionType collection_type_;
}; };
std::unique_ptr<cppgc::Visitor> std::unique_ptr<cppgc::Visitor>
UnifiedHeapConcurrentMarker::CreateConcurrentMarkingVisitor( UnifiedHeapConcurrentMarker::CreateConcurrentMarkingVisitor(
cppgc::internal::ConcurrentMarkingState& marking_state) const { cppgc::internal::ConcurrentMarkingState& marking_state) const {
return std::make_unique<ConcurrentUnifiedHeapMarkingVisitor>(heap(), v8_heap_, if (collection_type_ == CppHeap::CollectionType::kMajor)
marking_state); return std::make_unique<ConcurrentUnifiedHeapMarkingVisitor>(
heap(), v8_heap_, marking_state);
else
return std::make_unique<ConcurrentMinorGCMarkingVisitor>(heap(), v8_heap_,
marking_state);
} }
void FatalOutOfMemoryHandlerImpl(const std::string& reason, void FatalOutOfMemoryHandlerImpl(const std::string& reason,
...@@ -289,7 +296,7 @@ UnifiedHeapMarker::UnifiedHeapMarker(Heap* v8_heap, ...@@ -289,7 +296,7 @@ UnifiedHeapMarker::UnifiedHeapMarker(Heap* v8_heap,
*marking_visitor_) { *marking_visitor_) {
concurrent_marker_ = std::make_unique<UnifiedHeapConcurrentMarker>( concurrent_marker_ = std::make_unique<UnifiedHeapConcurrentMarker>(
heap_, v8_heap, marking_worklists_, schedule_, platform_, heap_, v8_heap, marking_worklists_, schedule_, platform_,
mutator_unified_heap_marking_state_); mutator_unified_heap_marking_state_, config.collection_type);
} }
void UnifiedHeapMarker::AddObject(void* object) { void UnifiedHeapMarker::AddObject(void* object) {
......
...@@ -84,7 +84,7 @@ class V8_EXPORT_PRIVATE MutatorMinorGCMarkingVisitor final ...@@ -84,7 +84,7 @@ class V8_EXPORT_PRIVATE MutatorMinorGCMarkingVisitor final
void Visit(const TracedReferenceBase&) final {} void Visit(const TracedReferenceBase&) final {}
}; };
class V8_EXPORT_PRIVATE ConcurrentUnifiedHeapMarkingVisitor final class V8_EXPORT_PRIVATE ConcurrentUnifiedHeapMarkingVisitor
: public UnifiedHeapMarkingVisitorBase { : public UnifiedHeapMarkingVisitorBase {
public: public:
ConcurrentUnifiedHeapMarkingVisitor(HeapBase&, Heap*, ConcurrentUnifiedHeapMarkingVisitor(HeapBase&, Heap*,
...@@ -113,6 +113,20 @@ class V8_EXPORT_PRIVATE ConcurrentUnifiedHeapMarkingVisitor final ...@@ -113,6 +113,20 @@ class V8_EXPORT_PRIVATE ConcurrentUnifiedHeapMarkingVisitor final
UnifiedHeapMarkingState concurrent_unified_heap_marking_state_; UnifiedHeapMarkingState concurrent_unified_heap_marking_state_;
}; };
// Same visitor as for full GCs unified heap, but avoids visiting
// TracedReferences.
class V8_EXPORT_PRIVATE ConcurrentMinorGCMarkingVisitor final
: public ConcurrentUnifiedHeapMarkingVisitor {
public:
using ConcurrentUnifiedHeapMarkingVisitor::
ConcurrentUnifiedHeapMarkingVisitor;
private:
// Override and make the function empty, since we don't want to trace V8
// reference during cppgc's minor GC.
void Visit(const TracedReferenceBase&) final {}
};
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
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