Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index b9e1a2b323a36664d1e53e84e7c7e899f2f9817e..3ff9a49aa79a867995112155f30aee7ba8bb9c04 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -148,6 +148,7 @@ Heap::Heap() |
#ifdef VERIFY_HEAP |
no_weak_object_verification_scope_depth_(0), |
#endif |
+ allocation_sites_scratchpad_pointer(0), |
mvstanton
2013/12/13 10:30:17
How about using the word count or length instead o
Hannes Payer (out of office)
2013/12/18 14:29:19
Done.
|
promotion_queue_(this), |
configured_(false), |
chunks_queued_for_free_(NULL), |
@@ -504,25 +505,52 @@ void Heap::RepairFreeListsAfterBoot() { |
} |
-void Heap::GarbageCollectionEpilogue() { |
+void Heap::ProcessPretenuringFeedback() { |
if (FLAG_allocation_site_pretenuring) { |
int tenure_decisions = 0; |
int dont_tenure_decisions = 0; |
int allocation_mementos_found = 0; |
- |
- Object* cur = allocation_sites_list(); |
- while (cur->IsAllocationSite()) { |
- AllocationSite* casted = AllocationSite::cast(cur); |
- allocation_mementos_found += casted->memento_found_count()->value(); |
- if (casted->DigestPretenuringFeedback()) { |
- if (casted->GetPretenureMode() == TENURED) { |
- tenure_decisions++; |
- } else { |
- dont_tenure_decisions++; |
+ int allocation_sites = 0; |
+ int active_allocation_sites = 0; |
+ bool use_scratchpad = |
+ allocation_sites_scratchpad_pointer < kAllocationSiteScratchpadSize; |
+ |
+ if (use_scratchpad) { |
Hannes Payer (out of office)
2013/12/12 15:26:05
Should I make an Iterator for that duplicated piec
mvstanton
2013/12/13 10:30:17
Yep that is a good idea. Alternatively, a function
Hannes Payer (out of office)
2013/12/18 14:29:19
I decided to do the simplified version, not beauti
|
+ for (int i = 0; i < allocation_sites_scratchpad_pointer; i++) { |
+ AllocationSite* casted = allocation_sites_scratchpad[i]; |
+ allocation_mementos_found += casted->memento_found_count()->value(); |
+ if (casted->memento_found_count()->value() > 0) { |
+ active_allocation_sites++; |
+ } |
+ if (casted->DigestPretenuringFeedback()) { |
+ if (casted->GetPretenureMode() == TENURED) { |
+ tenure_decisions++; |
+ } else { |
+ dont_tenure_decisions++; |
+ } |
+ } |
+ allocation_sites++; |
+ } |
+ } else { |
+ Object* cur = allocation_sites_list(); |
+ while (cur->IsAllocationSite()) { |
+ AllocationSite* casted = AllocationSite::cast(cur); |
+ allocation_mementos_found += casted->memento_found_count()->value(); |
+ if (casted->memento_found_count()->value() > 0) { |
+ active_allocation_sites++; |
+ } |
+ if (casted->DigestPretenuringFeedback()) { |
+ if (casted->GetPretenureMode() == TENURED) { |
+ tenure_decisions++; |
+ } else { |
+ dont_tenure_decisions++; |
+ } |
} |
+ cur = casted->weak_next(); |
+ allocation_sites++; |
} |
- cur = casted->weak_next(); |
} |
+ allocation_sites_scratchpad_pointer = 0; |
// TODO(mvstanton): Pretenure decisions are only made once for an allocation |
// site. Find a sane way to decide about revisiting the decision later. |
@@ -531,14 +559,21 @@ void Heap::GarbageCollectionEpilogue() { |
(allocation_mementos_found > 0 || |
tenure_decisions > 0 || |
dont_tenure_decisions > 0)) { |
- PrintF("GC: (#mementos, #tenure decisions, #donttenure decisions) " |
- "(%d, %d, %d)\n", |
+ PrintF("GC(%d): (#allocation sites, #active allocation sites, " |
+ "#mementos, #tenure decisions, #donttenure decisions) " |
+ "(%d, %d, %d, %d, %d)\n", |
+ use_scratchpad, |
+ allocation_sites, |
+ active_allocation_sites, |
allocation_mementos_found, |
tenure_decisions, |
dont_tenure_decisions); |
} |
} |
+} |
+ |
+void Heap::GarbageCollectionEpilogue() { |
store_buffer()->GCEpilogue(); |
// In release mode, we only zap the from space under heap verification. |
@@ -1565,6 +1600,8 @@ void Heap::Scavenge() { |
IncrementYoungSurvivorsCounter(static_cast<int>( |
(PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); |
+ ProcessPretenuringFeedback(); |
+ |
LOG(isolate_, ResourceEvent("scavenge", "end")); |
gc_state_ = NOT_IN_GC; |