Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index bfb901691693ecf866355382316053be2e9de451..b60768bfc07a5d46c3fa1e027edaf87a2d2bea82 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -406,8 +406,6 @@ void MarkCompactCollector::CollectGarbage() { |
ASSERT(state_ == PREPARE_GC); |
ASSERT(encountered_weak_collections_ == Smi::FromInt(0)); |
- heap()->allocation_mementos_found_ = 0; |
- |
MarkLiveObjects(); |
ASSERT(heap_->incremental_marking()->IsStopped()); |
@@ -449,11 +447,6 @@ void MarkCompactCollector::CollectGarbage() { |
marking_parity_ = EVEN_MARKING_PARITY; |
} |
- if (FLAG_trace_track_allocation_sites && |
- heap()->allocation_mementos_found_ > 0) { |
- PrintF("AllocationMementos found during mark-sweep = %d\n", |
- heap()->allocation_mementos_found_); |
- } |
tracer_ = NULL; |
} |
@@ -1889,6 +1882,14 @@ class MarkCompactWeakObjectRetainer : public WeakObjectRetainer { |
virtual Object* RetainAs(Object* object) { |
if (Marking::MarkBitFrom(HeapObject::cast(object)).Get()) { |
return object; |
+ } else if (object->IsAllocationSite() && |
+ !(AllocationSite::cast(object)->IsZombie())) { |
+ // "dead" AllocationSites need to live long enough for a traversal of new |
+ // space. These sites get a one-time reprieve. |
+ AllocationSite* site = AllocationSite::cast(object); |
+ site->MarkZombie(); |
+ site->GetHeap()->mark_compact_collector()->MarkAllocationSite(site); |
+ return object; |
} else { |
return NULL; |
} |
@@ -2000,12 +2001,7 @@ int MarkCompactCollector::DiscoverAndPromoteBlackObjectsOnPage( |
int size = object->Size(); |
survivors_size += size; |
- if (FLAG_trace_track_allocation_sites && object->IsJSObject()) { |
- if (AllocationMemento::FindForJSObject(JSObject::cast(object), true) |
- != NULL) { |
- heap()->allocation_mementos_found_++; |
- } |
- } |
+ Heap::UpdateAllocationSiteFeedback(object); |
offset++; |
current_cell >>= 1; |
@@ -2098,6 +2094,12 @@ void MarkCompactCollector::MarkStringTable(RootMarkingVisitor* visitor) { |
} |
+void MarkCompactCollector::MarkAllocationSite(AllocationSite* site) { |
+ MarkBit mark_bit = Marking::MarkBitFrom(site); |
+ SetMark(site, mark_bit); |
+} |
+ |
+ |
void MarkCompactCollector::MarkRoots(RootMarkingVisitor* visitor) { |
// Mark the heap roots including global variables, stack variables, |
// etc., and all objects reachable from them. |