summaryrefslogtreecommitdiff
path: root/deps/v8/src/heap/cppgc-js/unified-heap-marking-state.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/heap/cppgc-js/unified-heap-marking-state.h')
-rw-r--r--deps/v8/src/heap/cppgc-js/unified-heap-marking-state.h38
1 files changed, 14 insertions, 24 deletions
diff --git a/deps/v8/src/heap/cppgc-js/unified-heap-marking-state.h b/deps/v8/src/heap/cppgc-js/unified-heap-marking-state.h
index 388fa94aab..51dd8fd752 100644
--- a/deps/v8/src/heap/cppgc-js/unified-heap-marking-state.h
+++ b/deps/v8/src/heap/cppgc-js/unified-heap-marking-state.h
@@ -6,43 +6,33 @@
#define V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_STATE_H_
#include "include/v8-cppgc.h"
-#include "src/base/logging.h"
-#include "src/heap/heap.h"
+#include "src/heap/mark-compact.h"
+#include "src/heap/marking-worklist.h"
namespace v8 {
-
namespace internal {
-class BasicTracedReferenceExtractor {
- public:
- static Address* ObjectReference(const TracedReferenceBase& ref) {
- return reinterpret_cast<Address*>(ref.val_);
- }
-};
-
-class UnifiedHeapMarkingState {
+// `UnifiedHeapMarkingState` is used to handle `TracedReferenceBase` and
+// friends. It is used when `CppHeap` is attached but also detached. In detached
+// mode, the expectation is that no non-null `TracedReferenceBase` is found.
+class UnifiedHeapMarkingState final {
public:
- explicit UnifiedHeapMarkingState(Heap* heap) : heap_(heap) {}
+ UnifiedHeapMarkingState(Heap*, MarkingWorklists::Local*);
UnifiedHeapMarkingState(const UnifiedHeapMarkingState&) = delete;
UnifiedHeapMarkingState& operator=(const UnifiedHeapMarkingState&) = delete;
- inline void MarkAndPush(const TracedReferenceBase&);
+ void Update(MarkingWorklists::Local*);
+
+ V8_INLINE void MarkAndPush(const TracedReferenceBase&);
private:
- Heap* heap_;
+ Heap* const heap_;
+ MarkCompactCollector::MarkingState* const marking_state_;
+ MarkingWorklists::Local* local_marking_worklist_ = nullptr;
+ const bool track_retaining_path_;
};
-void UnifiedHeapMarkingState::MarkAndPush(const TracedReferenceBase& ref) {
- // The same visitor is used in testing scenarios without attaching the heap to
- // an Isolate under the assumption that no non-empty v8 references are found.
- // Having the following DCHECK crash means that the heap is in detached mode
- // but we find traceable pointers into an Isolate.
- DCHECK_NOT_NULL(heap_);
- heap_->RegisterExternallyReferencedObject(
- BasicTracedReferenceExtractor::ObjectReference(ref));
-}
-
} // namespace internal
} // namespace v8