Simplify ObjectVisitor for external references.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/36853003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17336 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fbaf016b
......@@ -10327,7 +10327,7 @@ void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) {
void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) {
Address* p = rinfo->target_reference_address();
VisitExternalReferences(p, p + 1);
VisitExternalReference(p);
}
......
......@@ -10340,6 +10340,9 @@ class ObjectVisitor BASE_EMBEDDED {
// [start, end). Any or all of the values may be modified on return.
virtual void VisitPointers(Object** start, Object** end) = 0;
// Handy shorthand for visiting a single pointer.
virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); }
// To allow lazy clearing of inline caches the visitor has
// a rich interface for iterating over Code objects..
......@@ -10368,22 +10371,14 @@ class ObjectVisitor BASE_EMBEDDED {
// about the code's age.
virtual void VisitCodeAgeSequence(RelocInfo* rinfo);
// Handy shorthand for visiting a single pointer.
virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); }
// Visit pointer embedded into a code object.
virtual void VisitEmbeddedPointer(RelocInfo* rinfo);
// Visits a contiguous arrays of external references (references to the C++
// heap) in the half-open range [start, end). Any or all of the values
// may be modified on return.
virtual void VisitExternalReferences(Address* start, Address* end) {}
// Visits an external reference embedded into a code object.
virtual void VisitExternalReference(RelocInfo* rinfo);
inline void VisitExternalReference(Address* p) {
VisitExternalReferences(p, p + 1);
}
// Visits an external reference. The value may be modified on return.
virtual void VisitExternalReference(Address* p) {}
// Visits a handle that has an embedder-assigned class ID.
virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {}
......
......@@ -1682,19 +1682,15 @@ void Serializer::ObjectSerializer::VisitEmbeddedPointer(RelocInfo* rinfo) {
}
void Serializer::ObjectSerializer::VisitExternalReferences(Address* start,
Address* end) {
Address references_start = reinterpret_cast<Address>(start);
void Serializer::ObjectSerializer::VisitExternalReference(Address* p) {
Address references_start = reinterpret_cast<Address>(p);
int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping);
for (Address* current = start; current < end; current++) {
sink_->Put(kExternalReference + kPlain + kStartOfObject, "ExternalRef");
sink_->PutInt(skip, "SkipB4ExternalRef");
skip = 0;
int reference_id = serializer_->EncodeExternalReference(*current);
int reference_id = serializer_->EncodeExternalReference(*p);
sink_->PutInt(reference_id, "reference id");
}
bytes_processed_so_far_ += static_cast<int>((end - start) * kPointerSize);
bytes_processed_so_far_ += kPointerSize;
}
......
......@@ -339,10 +339,6 @@ class Deserializer: public SerializerDeserializer {
private:
virtual void VisitPointers(Object** start, Object** end);
virtual void VisitExternalReferences(Address* start, Address* end) {
UNREACHABLE();
}
virtual void VisitRuntimeEntry(RelocInfo* rinfo) {
UNREACHABLE();
}
......@@ -521,7 +517,7 @@ class Serializer : public SerializerDeserializer {
void Serialize();
void VisitPointers(Object** start, Object** end);
void VisitEmbeddedPointer(RelocInfo* target);
void VisitExternalReferences(Address* start, Address* end);
void VisitExternalReference(Address* p);
void VisitExternalReference(RelocInfo* rinfo);
void VisitCodeTarget(RelocInfo* target);
void VisitCodeEntry(Address entry_address);
......
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