11cb0ef41Sopenharmony_ci// Copyright 2020 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_STATE_H_ 61cb0ef41Sopenharmony_ci#define V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_STATE_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include "include/v8-cppgc.h" 91cb0ef41Sopenharmony_ci#include "src/heap/mark-compact.h" 101cb0ef41Sopenharmony_ci#include "src/heap/marking-worklist.h" 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cinamespace v8 { 131cb0ef41Sopenharmony_cinamespace internal { 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ci// `UnifiedHeapMarkingState` is used to handle `TracedReferenceBase` and 161cb0ef41Sopenharmony_ci// friends. It is used when `CppHeap` is attached but also detached. In detached 171cb0ef41Sopenharmony_ci// mode, the expectation is that no non-null `TracedReferenceBase` is found. 181cb0ef41Sopenharmony_ciclass UnifiedHeapMarkingState final { 191cb0ef41Sopenharmony_ci public: 201cb0ef41Sopenharmony_ci UnifiedHeapMarkingState(Heap*, MarkingWorklists::Local*); 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci UnifiedHeapMarkingState(const UnifiedHeapMarkingState&) = delete; 231cb0ef41Sopenharmony_ci UnifiedHeapMarkingState& operator=(const UnifiedHeapMarkingState&) = delete; 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci void Update(MarkingWorklists::Local*); 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ci V8_INLINE void MarkAndPush(const TracedReferenceBase&); 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ci private: 301cb0ef41Sopenharmony_ci Heap* const heap_; 311cb0ef41Sopenharmony_ci MarkCompactCollector::MarkingState* const marking_state_; 321cb0ef41Sopenharmony_ci MarkingWorklists::Local* local_marking_worklist_ = nullptr; 331cb0ef41Sopenharmony_ci const bool track_retaining_path_; 341cb0ef41Sopenharmony_ci}; 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci} // namespace internal 371cb0ef41Sopenharmony_ci} // namespace v8 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ci#endif // V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_STATE_H_ 40