From: mstarzinger@chromium.org Date: Wed, 23 Oct 2013 10:47:51 +0000 (+0000) Subject: Simplify ObjectVisitor for external references. X-Git-Tag: upstream/4.7.83~11994 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=701749c4eca885a68785d1c345fc45367261fb23;p=platform%2Fupstream%2Fv8.git 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 --- diff --git a/src/objects.cc b/src/objects.cc index 4412e76..e0f160b 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -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); } diff --git a/src/objects.h b/src/objects.h index 299ca2d..ec78d27 100644 --- a/src/objects.h +++ b/src/objects.h @@ -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) {} diff --git a/src/serialize.cc b/src/serialize.cc index a232d8c..b536163 100644 --- a/src/serialize.cc +++ b/src/serialize.cc @@ -1682,19 +1682,15 @@ void Serializer::ObjectSerializer::VisitEmbeddedPointer(RelocInfo* rinfo) { } -void Serializer::ObjectSerializer::VisitExternalReferences(Address* start, - Address* end) { - Address references_start = reinterpret_cast
(start); +void Serializer::ObjectSerializer::VisitExternalReference(Address* p) { + Address references_start = reinterpret_cast
(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); - sink_->PutInt(reference_id, "reference id"); - } - bytes_processed_so_far_ += static_cast((end - start) * kPointerSize); + sink_->Put(kExternalReference + kPlain + kStartOfObject, "ExternalRef"); + sink_->PutInt(skip, "SkipB4ExternalRef"); + int reference_id = serializer_->EncodeExternalReference(*p); + sink_->PutInt(reference_id, "reference id"); + bytes_processed_so_far_ += kPointerSize; } diff --git a/src/serialize.h b/src/serialize.h index 15d9369..47627ac 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -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);