Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: src/mark-compact.cc

Issue 7039058: MIPS: arch-independent changes to support mips. (Closed)
Patch Set: Rebased on r7964. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
« no previous file with comments | « src/assembler.h ('k') | src/mips/assembler-mips-inl.h » ('j') | src/mips/assembler-mips-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698