Commit c1a1c113 authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Only run MarkTransitiveClosureLinear() with serial marking

This method was intended to run single-threaded, so with parallel
marking disabled. While correctness isn't an issue here (simply because
we will later run this method single-threaded as well), some CHECKs do
not hold when parallel marking is active.

Bug: chromium:1325628
Change-Id: Iedebcf6241835011982217b1452271e38a36ce9d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3700074
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81073}
parent b621958c
...@@ -2196,6 +2196,8 @@ bool MarkCompactCollector::ProcessEphemerons() { ...@@ -2196,6 +2196,8 @@ bool MarkCompactCollector::ProcessEphemerons() {
void MarkCompactCollector::MarkTransitiveClosureLinear() { void MarkCompactCollector::MarkTransitiveClosureLinear() {
TRACE_GC(heap()->tracer(), TRACE_GC(heap()->tracer(),
GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERON_LINEAR); GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERON_LINEAR);
// This phase doesn't support parallel marking.
DCHECK(heap()->concurrent_marking()->IsStopped());
std::unordered_multimap<HeapObject, HeapObject, Object::Hasher> key_to_values; std::unordered_multimap<HeapObject, HeapObject, Object::Hasher> key_to_values;
Ephemeron ephemeron; Ephemeron ephemeron;
...@@ -2275,6 +2277,8 @@ void MarkCompactCollector::MarkTransitiveClosureLinear() { ...@@ -2275,6 +2277,8 @@ void MarkCompactCollector::MarkTransitiveClosureLinear() {
ResetNewlyDiscovered(); ResetNewlyDiscovered();
ephemeron_marking_.newly_discovered.shrink_to_fit(); ephemeron_marking_.newly_discovered.shrink_to_fit();
CHECK(local_marking_worklists()->IsEmpty());
CHECK(weak_objects_.current_ephemerons.IsEmpty()); CHECK(weak_objects_.current_ephemerons.IsEmpty());
CHECK(weak_objects_.discovered_ephemerons.IsEmpty()); CHECK(weak_objects_.discovered_ephemerons.IsEmpty());
...@@ -2406,8 +2410,9 @@ void MarkCompactCollector::MarkTransitiveClosure() { ...@@ -2406,8 +2410,9 @@ void MarkCompactCollector::MarkTransitiveClosure() {
if (!MarkTransitiveClosureUntilFixpoint()) { if (!MarkTransitiveClosureUntilFixpoint()) {
// Fixpoint iteration needed too many iterations and was cancelled. Use the // Fixpoint iteration needed too many iterations and was cancelled. Use the
// guaranteed linear algorithm. // guaranteed linear algorithm. But only in the final single-thread marking
MarkTransitiveClosureLinear(); // phase.
if (!parallel_marking_) MarkTransitiveClosureLinear();
} }
} }
......
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