Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index b82c76aa830bcb249f919419e99e46b2c6f7410e..4cff31507fd9b2b2c3acac05861703de9ed7f186 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -2607,12 +2607,17 @@ class UpdatingVisitor: public ObjectVisitor { |
explicit UpdatingVisitor(Heap* heap) : heap_(heap) {} |
void VisitPointer(Object** p) { |
- UpdatePointer(p); |
+ UpdatePointer(p, NULL); |
+ } |
+ |
+ void VisitPointer(Object** p, RelocInfo* rinfo) { |
+ // Variant of UpdatePointer, for arch's where RelocInfo is needed. |
+ UpdatePointer(p, rinfo); |
} |
void VisitPointers(Object** start, Object** end) { |
// Mark all HeapObject pointers in [start, end) |
- for (Object** p = start; p < end; p++) UpdatePointer(p); |
+ for (Object** p = start; p < end; p++) UpdatePointer(p, NULL); |
} |
void VisitCodeTarget(RelocInfo* rinfo) { |
@@ -2637,7 +2642,7 @@ class UpdatingVisitor: public ObjectVisitor { |
inline Heap* heap() const { return heap_; } |
private: |
- void UpdatePointer(Object** p) { |
+ void UpdatePointer(Object** p, RelocInfo* rinfo) { |
if (!(*p)->IsHeapObject()) return; |
HeapObject* obj = HeapObject::cast(*p); |
@@ -2683,7 +2688,14 @@ class UpdatingVisitor: public ObjectVisitor { |
original_space->MCSpaceOffsetForAddress(old_addr)); |
} |
- *p = HeapObject::FromAddress(new_addr); |
+ if (rinfo) { |
+ // For arch (like mips) without natural pointers in embedded code |
+ // objects, rinfo->set_target_object() allows proper pointer update. |
+ rinfo->set_target_object(HeapObject::FromAddress(new_addr)); |
+ } else { |
+ // Do normal indirect pointer update when there is no reloc info. |
+ *p = HeapObject::FromAddress(new_addr); |
+ } |
#ifdef DEBUG |
if (FLAG_gc_verbose) { |