Chromium Code Reviews| Index: src/objects-inl.h |
| diff --git a/src/objects-inl.h b/src/objects-inl.h |
| index 29fcec6017a29ec87ce8e352de6690c33c78c1dd..f0ca6a5d128bc71207cc1b539b88f1b7a8736a3d 100644 |
| --- a/src/objects-inl.h |
| +++ b/src/objects-inl.h |
| @@ -1577,27 +1577,41 @@ inline void AllocationSite::IncrementMementoCreateCount() { |
| } |
| +inline bool AllocationSite::MakePretenuringDecision(double ratio) { |
| + // Currently we just need to deopt when we make a state transition to tenure. |
| + if (ratio >= kPretenureRatio) { |
| + // We just transition into tenure state when the semi-space was at |
| + // maximum capacity. |
| + Heap* heap = GetHeap(); |
| + if (heap->changed_to_max_semi_space_size() && |
|
mvstanton
2014/06/02 13:31:25
Since the allocation sites are processed in bulk,
Hannes Payer (out of office)
2014/06/02 14:56:52
Done.
|
| + heap->new_space()->IsAtMaximumCapacity()) { |
| + set_deopt_dependent_code(true); |
| + set_pretenure_decision(kTenure); |
| + return true; |
| + } |
| + set_pretenure_decision(kMaybeTenure); |
| + } else { |
| + set_pretenure_decision(kDontTenure); |
| + } |
| + return false; |
| +} |
| + |
| + |
| inline bool AllocationSite::DigestPretenuringFeedback() { |
| - bool decision_changed = false; |
| + bool deopt = false; |
| int create_count = memento_create_count(); |
| int found_count = memento_found_count(); |
| bool minimum_mementos_created = create_count >= kPretenureMinimumCreated; |
| double ratio = |
| minimum_mementos_created || FLAG_trace_pretenuring_statistics ? |
| static_cast<double>(found_count) / create_count : 0.0; |
| - PretenureFlag current_mode = GetPretenureMode(); |
| - |
| - // TODO(hpayer): Add an intermediate state MAYBE_TENURE which collects |
| - // more lifetime feedback for tenuring candidates. In the meantime, we |
| - // just allow transitions from undecided to tenured or not tenured. |
| - if (minimum_mementos_created && pretenure_decision() == kUndecided) { |
| - PretenureDecision result = ratio >= kPretenureRatio |
| - ? kTenure |
| - : kDontTenure; |
| - set_pretenure_decision(result); |
| - if (current_mode != GetPretenureMode()) { |
| - decision_changed = true; |
| - set_deopt_dependent_code(true); |
| + PretenureDecision current_decision = pretenure_decision(); |
| + |
| + // Here we just allow state transitions from undecided or maybe tenure |
| + // to don't tenure, maybe tenure, or tenure. |
| + if (minimum_mementos_created) { |
| + if ((current_decision == kUndecided || current_decision == kMaybeTenure)) { |
| + deopt = MakePretenuringDecision(ratio); |
| } |
| } |
| @@ -1605,14 +1619,14 @@ inline bool AllocationSite::DigestPretenuringFeedback() { |
| PrintF( |
| "AllocationSite(%p): (created, found, ratio) (%d, %d, %f) %s => %s\n", |
| static_cast<void*>(this), create_count, found_count, ratio, |
| - current_mode == TENURED ? "tenured" : "not tenured", |
| - GetPretenureMode() == TENURED ? "tenured" : "not tenured"); |
| + PretenureDecisionName(current_decision), |
| + PretenureDecisionName(pretenure_decision())); |
| } |
| // Clear feedback calculation fields until the next gc. |
| set_memento_found_count(0); |
| set_memento_create_count(0); |
| - return decision_changed; |
| + return deopt; |
| } |