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 #ifndef V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_STATE_H_ 6 #define V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_STATE_H_ 7 8 #include "include/v8-cppgc.h" 9 #include "src/heap/mark-compact.h" 10 #include "src/heap/marking-worklist.h" 11 12 namespace v8 { 13 namespace internal { 14 15 // `UnifiedHeapMarkingState` is used to handle `TracedReferenceBase` and 16 // friends. It is used when `CppHeap` is attached but also detached. In detached 17 // mode, the expectation is that no non-null `TracedReferenceBase` is found. 18 class UnifiedHeapMarkingState final { 19 public: 20 UnifiedHeapMarkingState(Heap*, MarkingWorklists::Local*); 21 22 UnifiedHeapMarkingState(const UnifiedHeapMarkingState&) = delete; 23 UnifiedHeapMarkingState& operator=(const UnifiedHeapMarkingState&) = delete; 24 25 void Update(MarkingWorklists::Local*); 26 27 V8_INLINE void MarkAndPush(const TracedReferenceBase&); 28 29 private: 30 Heap* const heap_; 31 MarkCompactCollector::MarkingState* const marking_state_; 32 MarkingWorklists::Local* local_marking_worklist_ = nullptr; 33 const bool track_retaining_path_; 34 }; 35 36 } // namespace internal 37 } // namespace v8 38 39 #endif // V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_STATE_H_ 40