diff options
Diffstat (limited to 'deps/v8/src/visitors.h')
-rw-r--r-- | deps/v8/src/visitors.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/deps/v8/src/visitors.h b/deps/v8/src/visitors.h index baf989182b..7696df8faf 100644 --- a/deps/v8/src/visitors.h +++ b/deps/v8/src/visitors.h @@ -10,6 +10,7 @@ namespace v8 { namespace internal { +class CodeDataContainer; class Object; #define ROOT_ID_LIST(V) \ @@ -75,6 +76,44 @@ class RootVisitor BASE_EMBEDDED { virtual void Synchronize(VisitorSynchronization::SyncTag tag) {} }; +// Abstract base class for visiting, and optionally modifying, the +// pointers contained in Objects. Used in GC and serialization/deserialization. +class ObjectVisitor BASE_EMBEDDED { + public: + virtual ~ObjectVisitor() {} + + // Visits a contiguous arrays of pointers in the half-open range + // [start, end). Any or all of the values may be modified on return. + virtual void VisitPointers(HeapObject* host, Object** start, + Object** end) = 0; + + // Handy shorthand for visiting a single pointer. + virtual void VisitPointer(HeapObject* host, Object** p) { + VisitPointers(host, p, p + 1); + } + + // To allow lazy clearing of inline caches the visitor has + // a rich interface for iterating over Code objects ... + + // Visits a code target in the instruction stream. + virtual void VisitCodeTarget(Code* host, RelocInfo* rinfo); + + // Visits a runtime entry in the instruction stream. + virtual void VisitRuntimeEntry(Code* host, RelocInfo* rinfo) {} + + // Visit pointer embedded into a code object. + virtual void VisitEmbeddedPointer(Code* host, RelocInfo* rinfo); + + // Visits an external reference embedded into a code object. + virtual void VisitExternalReference(Code* host, RelocInfo* rinfo) {} + + // Visits an external reference. + virtual void VisitExternalReference(Foreign* host, Address* p) {} + + // Visits an (encoded) internal reference. + virtual void VisitInternalReference(Code* host, RelocInfo* rinfo) {} +}; + } // namespace internal } // namespace v8 |