Commit 3b589d0b authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

cppgc: Enable concurrent marking/sweeping for unified heap

Bug: chromium:1056170
Change-Id: I010ab2ff2c55ce54b5dcc2df6fb7bbcd14b03e2a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2480568Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70599}
parent 67c0721d
......@@ -169,10 +169,13 @@ void CppHeap::RegisterV8References(
}
void CppHeap::TracePrologue(TraceFlags flags) {
// Finish sweeping in case it is still running.
sweeper_.FinishIfRunning();
const UnifiedHeapMarker::MarkingConfig marking_config{
UnifiedHeapMarker::MarkingConfig::CollectionType::kMajor,
cppgc::Heap::StackState::kNoHeapPointers,
UnifiedHeapMarker::MarkingConfig::MarkingType::kIncremental};
UnifiedHeapMarker::MarkingConfig::MarkingType::kIncrementalAndConcurrent};
marker_ =
cppgc::internal::MarkerFactory::CreateAndStartMarking<UnifiedHeapMarker>(
*isolate_.heap(), AsBase(), platform_.get(), marking_config);
......@@ -210,7 +213,8 @@ void CppHeap::TraceEpilogue(TraceSummary* trace_summary) {
#endif
{
NoGCScope no_gc(*this);
sweeper().Start(cppgc::internal::Sweeper::Config::kAtomic);
sweeper().Start(
cppgc::internal::Sweeper::Config::kIncrementalAndConcurrent);
}
}
......
......@@ -580,6 +580,9 @@ void CppGraphBuilderImpl::VisitRootForGraphBuilding(
}
void CppGraphBuilderImpl::Run() {
// Sweeping from a previous GC might still be running, in which case not all
// pages have been returned to spaces yet.
cpp_heap_.sweeper().FinishIfRunning();
// First pass: Figure out which objects should be included in the graph -- see
// class-level comment on CppGraphBuilder.
LiveObjectsForVisibilityIterator visitor(*this);
......
......@@ -94,6 +94,8 @@ TEST_F(UnifiedHeapTest, FindingV8ToBlinkReference) {
EXPECT_EQ(0u, Wrappable::destructor_callcount);
ResetWrappableConnection(api_object);
CollectGarbage(OLD_SPACE);
// Calling CollectGarbage twice to force the first GC to finish sweeping.
CollectGarbage(OLD_SPACE);
EXPECT_EQ(1u, Wrappable::destructor_callcount);
}
......
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