// Copyright 2019 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_MARKING_VISITOR_H_ #define V8_HEAP_MARKING_VISITOR_H_ #include "src/base/logging.h" #include "src/common/globals.h" #include "src/execution/isolate.h" #include "src/heap/marking-state.h" #include "src/heap/marking-worklist.h" #include "src/heap/marking.h" #include "src/heap/objects-visiting.h" #include "src/heap/pretenuring-handler.h" #include "src/heap/spaces.h" #include "src/heap/weak-object-worklists.h" namespace v8 { namespace internal { struct EphemeronMarking { … }; // The base class for all marking visitors (main and concurrent marking) but // also for e.g. the reference summarizer. It implements marking logic with // support for bytecode flushing, embedder tracing and weak references. // // Derived classes are expected to provide the following methods: // - CanUpdateValuesInHeap // - AddStrongReferenceForReferenceSummarizer // - AddWeakReferenceForReferenceSummarizer // - marking_state // - MarkPointerTableEntry // - RecordSlot // - RecordRelocSlot // // These methods capture the difference between the different visitor // implementations. For example, the concurrent visitor has to use the locking // for string types that can be transitioned to other types on the main thread // concurrently. On the other hand, the reference summarizer is not supposed to // write into heap objects. template <typename ConcreteVisitor> class MarkingVisitorBase : public ConcurrentHeapVisitor<int, ConcreteVisitor> { … }; // This is the common base class for main and concurrent full marking visitors. // Derived class are expected to provide the same methods as for // MarkingVisitorBase except for those defined in this class. template <typename ConcreteVisitor> class FullMarkingVisitorBase : public MarkingVisitorBase<ConcreteVisitor> { … }; } // namespace internal } // namespace v8 #endif // V8_HEAP_MARKING_VISITOR_H_