Index: src/objects-visiting.h |
diff --git a/src/objects-visiting.h b/src/objects-visiting.h |
index 90f7ce0b3dfa9e04b2b63bfd9c6b8e06551711d1..09af40ef068cd87f5556f9fe081862904987422e 100644 |
--- a/src/objects-visiting.h |
+++ b/src/objects-visiting.h |
@@ -146,7 +146,7 @@ class VisitorDispatchTable { |
void Register(StaticVisitorBase::VisitorId id, Callback callback) { |
ASSERT((0 <= id) && (id < StaticVisitorBase::kVisitorIdCount)); |
- callbacks_[id] = callback; |
+ if (callbacks_[id] != callback) callbacks_[id] = callback; |
} |
template<typename Visitor, |
@@ -387,6 +387,29 @@ void Code::CodeIterateBody() { |
} |
+template<typename StaticVisitor, typename Data> |
+void Code::CodeIterateBody(Data data) { |
+ int mode_mask = RelocInfo::kCodeTargetMask | |
+ RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
+ RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
+ RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
+ RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
+ RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
+ |
+ // Use the relocation info pointer before it is visited by |
+ // the heap compaction in the next statement. |
+ RelocIterator it(this, mode_mask); |
+ |
+ StaticVisitor::VisitPointer( |
+ reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset), data); |
+ |
+ for (; !it.done(); it.next()) { |
+ it.rinfo()->template Visit<StaticVisitor, Data>(data); |
+ } |
+} |
+ |
+ |
+ |
} } // namespace v8::internal |
#endif // V8_OBJECTS_VISITING_H_ |