Revision: 17336
Author: [email protected]
Date: Wed Oct 23 10:47:51 2013 UTC
Log: Simplify ObjectVisitor for external references.
[email protected]
Review URL: https://codereview.chromium.org/36853003
http://code.google.com/p/v8/source/detail?r=17336
Modified:
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/serialize.cc
/branches/bleeding_edge/src/serialize.h
=======================================
--- /branches/bleeding_edge/src/objects.cc Tue Oct 22 17:41:08 2013 UTC
+++ /branches/bleeding_edge/src/objects.cc Wed Oct 23 10:47:51 2013 UTC
@@ -10327,7 +10327,7 @@
void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) {
Address* p = rinfo->target_reference_address();
- VisitExternalReferences(p, p + 1);
+ VisitExternalReference(p);
}
=======================================
--- /branches/bleeding_edge/src/objects.h Tue Oct 22 17:41:08 2013 UTC
+++ /branches/bleeding_edge/src/objects.h Wed Oct 23 10:47:51 2013 UTC
@@ -10339,6 +10339,9 @@
// 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(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..
@@ -10367,23 +10370,15 @@
// Visits the byte sequence in a function's prologue that contains
information
// 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) {}
=======================================
--- /branches/bleeding_edge/src/serialize.cc Tue Oct 22 08:50:46 2013 UTC
+++ /branches/bleeding_edge/src/serialize.cc Wed Oct 23 10:47:51 2013 UTC
@@ -1682,19 +1682,15 @@
}
-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);
- sink_->PutInt(reference_id, "reference id");
- }
- bytes_processed_so_far_ += static_cast<int>((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;
}
=======================================
--- /branches/bleeding_edge/src/serialize.h Tue Oct 22 08:50:46 2013 UTC
+++ /branches/bleeding_edge/src/serialize.h Wed Oct 23 10:47:51 2013 UTC
@@ -339,10 +339,6 @@
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 @@
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);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.