| // Copyright 2020 the V8 project authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #ifndef V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_STATE_H_ |
| #define V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_STATE_H_ |
| #include "include/v8-cppgc.h" |
| #include "src/heap/heap.h" |
| class BasicTracedReferenceExtractor { |
| static Address* ObjectReference(const TracedReferenceBase& ref) { |
| return reinterpret_cast<Address*>(ref.val_); |
| class UnifiedHeapMarkingState { |
| explicit UnifiedHeapMarkingState(Heap& heap) : heap_(heap) {} |
| UnifiedHeapMarkingState(const UnifiedHeapMarkingState&) = delete; |
| UnifiedHeapMarkingState& operator=(const UnifiedHeapMarkingState&) = delete; |
| inline void MarkAndPush(const TracedReferenceBase&); |
| void UnifiedHeapMarkingState::MarkAndPush(const TracedReferenceBase& ref) { |
| heap_.RegisterExternallyReferencedObject( |
| BasicTracedReferenceExtractor::ObjectReference(ref)); |
| #endif // V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_STATE_H_ |