Commit bb514c42 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[objects.h splitting] Move ObjectVisitor.

There was a helpful TODO telling where it should live.

BUG=v8:5402,v8:6921

Change-Id: Id9022c72c9e7de8d76ea0db964217b766299195d
Reviewed-on: https://chromium-review.googlesource.com/718337Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48524}
parent 36860509
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "src/objects.h" #include "src/objects.h"
#include "src/objects/hash-table.h" #include "src/objects/hash-table.h"
#include "src/objects/string.h" #include "src/objects/string.h"
#include "src/visitors.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -7050,51 +7050,6 @@ class SourcePositionTableWithFrameCache : public Tuple2 { ...@@ -7050,51 +7050,6 @@ class SourcePositionTableWithFrameCache : public Tuple2 {
DISALLOW_IMPLICIT_CONSTRUCTORS(SourcePositionTableWithFrameCache); DISALLOW_IMPLICIT_CONSTRUCTORS(SourcePositionTableWithFrameCache);
}; };
// Abstract base class for visiting, and optionally modifying, the
// pointers contained in Objects. Used in GC and serialization/deserialization.
// TODO(ulan): move to src/visitors.h
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);
}
// Visit weak next_code_link in Code object.
virtual void VisitNextCodeLink(Code* 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) {}
};
// BooleanBit is a helper class for setting and getting a bit in an integer. // BooleanBit is a helper class for setting and getting a bit in an integer.
class BooleanBit : public AllStatic { class BooleanBit : public AllStatic {
public: public:
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "src/visitors.h" #include "src/visitors.h"
#include "src/objects.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -18,5 +20,9 @@ const char* const VisitorSynchronization::kTagNames ...@@ -18,5 +20,9 @@ const char* const VisitorSynchronization::kTagNames
[VisitorSynchronization::kNumberOfSyncTags] = {ROOT_ID_LIST(DECLARE_TAG)}; [VisitorSynchronization::kNumberOfSyncTags] = {ROOT_ID_LIST(DECLARE_TAG)};
#undef DECLARE_TAG #undef DECLARE_TAG
void ObjectVisitor::VisitNextCodeLink(Code* host, Object** p) {
VisitPointers(host, p, p + 1);
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -75,6 +75,47 @@ class RootVisitor BASE_EMBEDDED { ...@@ -75,6 +75,47 @@ class RootVisitor BASE_EMBEDDED {
virtual void Synchronize(VisitorSynchronization::SyncTag tag) {} 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);
}
// Visit weak next_code_link in Code object.
virtual void VisitNextCodeLink(Code* host, Object** p);
// 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 internal
} // namespace v8 } // namespace v8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment