1 // Copyright 2020 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "src/heap/cppgc/marking-state.h" 6 7 #include <unordered_set> 8 9 #include "src/heap/cppgc/heap-base.h" 10 #include "src/heap/cppgc/stats-collector.h" 11 12 namespace cppgc { 13 namespace internal { 14 FlushNotFullyConstructedObjects()15void MutatorMarkingState::FlushNotFullyConstructedObjects() { 16 std::unordered_set<HeapObjectHeader*> objects = 17 not_fully_constructed_worklist_.Extract<AccessMode::kAtomic>(); 18 for (HeapObjectHeader* object : objects) { 19 if (MarkNoPush(*object)) 20 previously_not_fully_constructed_worklist_.Push(object); 21 } 22 } 23 FlushDiscoveredEphemeronPairs()24void MutatorMarkingState::FlushDiscoveredEphemeronPairs() { 25 StatsCollector::EnabledScope stats_scope( 26 heap_.stats_collector(), StatsCollector::kMarkFlushEphemerons); 27 discovered_ephemeron_pairs_worklist_.Publish(); 28 if (!discovered_ephemeron_pairs_worklist_.IsGlobalEmpty()) { 29 ephemeron_pairs_for_processing_worklist_.Merge( 30 &discovered_ephemeron_pairs_worklist_); 31 } 32 } 33 34 } // namespace internal 35 } // namespace cppgc 36