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