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

Unified Diff: src/mark-compact.cc

Issue 6780032: Minor cleanup in StaticMarkingVisitor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 38f9239b781984780c1f67e8141411fb2e2f41f9..96ec71fe6b6b4408f3238915814a2fcd8488f447 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -464,7 +464,7 @@ class StaticMarkingVisitor : public StaticVisitorBase {
// Please note targets for cleared inline cached do not have to be
// marked since they are contained in HEAP->non_monomorphic_cache().
} else {
- HEAP->mark_compact_collector()->MarkObject(code);
+ code->heap()->mark_compact_collector()->MarkObject(code);
}
}
@@ -472,7 +472,7 @@ class StaticMarkingVisitor : public StaticVisitorBase {
ASSERT(rinfo->rmode() == RelocInfo::GLOBAL_PROPERTY_CELL);
Object* cell = rinfo->target_cell();
Object* old_cell = cell;
- VisitPointer(HEAP, &cell);
+ VisitPointer(reinterpret_cast<JSGlobalPropertyCell*>(cell)->heap(), &cell);
if (cell != old_cell) {
rinfo->set_target_cell(reinterpret_cast<JSGlobalPropertyCell*>(cell));
}
@@ -484,28 +484,31 @@ class StaticMarkingVisitor : public StaticVisitorBase {
(RelocInfo::IsDebugBreakSlot(rinfo->rmode()) &&
rinfo->IsPatchedDebugBreakSlotSequence()));
HeapObject* code = Code::GetCodeFromTargetAddress(rinfo->call_address());
- HEAP->mark_compact_collector()->MarkObject(code);
+ reinterpret_cast<Code*>(code)->heap()->mark_compact_collector()->
+ MarkObject(code);
}
// Mark object pointed to by p.
INLINE(static void MarkObjectByPointer(Heap* heap, Object** p)) {
if (!(*p)->IsHeapObject()) return;
HeapObject* object = ShortCircuitConsString(p);
- heap->mark_compact_collector()->MarkObject(object);
+ if (!object->IsMarked()) {
+ heap->mark_compact_collector()->MarkUnmarkedObject(object);
+ }
}
// Visit an unmarked object.
- static inline void VisitUnmarkedObject(HeapObject* obj) {
+ INLINE(static void VisitUnmarkedObject(MarkCompactCollector* collector,
+ HeapObject* obj)) {
#ifdef DEBUG
- ASSERT(HEAP->Contains(obj));
+ ASSERT(obj->map()->heap()->Contains(obj));
Vitaly Repeshko 2011/03/31 19:23:16 It's safer to have Isolate::Current() in asserts l
ASSERT(!obj->IsMarked());
#endif
Map* map = obj->map();
- MarkCompactCollector* collector = map->heap()->mark_compact_collector();
collector->SetMark(obj);
// Mark the map pointer and the body.
- collector->MarkObject(map);
+ if (!map->IsMarked()) collector->MarkUnmarkedObject(map);
IterateBody(map, obj);
}
@@ -518,12 +521,13 @@ class StaticMarkingVisitor : public StaticVisitorBase {
StackLimitCheck check(heap->isolate());
if (check.HasOverflowed()) return false;
+ MarkCompactCollector* collector = heap->mark_compact_collector();
// Visit the unmarked objects.
for (Object** p = start; p < end; p++) {
if (!(*p)->IsHeapObject()) continue;
HeapObject* obj = HeapObject::cast(*p);
if (obj->IsMarked()) continue;
- VisitUnmarkedObject(obj);
+ VisitUnmarkedObject(collector, obj);
}
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698