1 // Copyright 2022 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-js/unified-heap-marking-state.h" 6 7 #include "src/base/logging.h" 8 #include "src/heap/mark-compact.h" 9 10 namespace v8 { 11 namespace internal { 12 UnifiedHeapMarkingState(Heap * heap,MarkingWorklists::Local * local_marking_worklist)13UnifiedHeapMarkingState::UnifiedHeapMarkingState( 14 Heap* heap, MarkingWorklists::Local* local_marking_worklist) 15 : heap_(heap), 16 marking_state_(heap_ ? heap_->mark_compact_collector()->marking_state() 17 : nullptr), 18 local_marking_worklist_(local_marking_worklist), 19 track_retaining_path_(FLAG_track_retaining_path) { 20 DCHECK_IMPLIES(FLAG_track_retaining_path, 21 !FLAG_concurrent_marking && !FLAG_parallel_marking); 22 DCHECK_IMPLIES(heap_, marking_state_); 23 } 24 Update(MarkingWorklists::Local * local_marking_worklist)25void UnifiedHeapMarkingState::Update( 26 MarkingWorklists::Local* local_marking_worklist) { 27 local_marking_worklist_ = local_marking_worklist; 28 DCHECK_NOT_NULL(heap_); 29 } 30 31 } // namespace internal 32 } // namespace v8 33