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

Unified Diff: src/objects-inl.h

Issue 309623007: Tenure allocation sites only when semi-space is maximum size. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « src/objects.cc ('k') | src/spaces.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 29fcec6017a29ec87ce8e352de6690c33c78c1dd..acc64b7ca4886de7c3ebada93bc243587ba9cf6c 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1577,42 +1577,60 @@ inline void AllocationSite::IncrementMementoCreateCount() {
}
-inline bool AllocationSite::DigestPretenuringFeedback() {
- bool decision_changed = false;
+inline bool AllocationSite::MakePretenureDecision(
+ PretenureDecision current_decision,
+ double ratio,
+ bool maximum_size_scavenge) {
+ // Here we just allow state transitions from undecided or maybe tenure
+ // to don't tenure, maybe tenure, or tenure.
+ if ((current_decision == kUndecided || current_decision == kMaybeTenure)) {
+ if (ratio >= kPretenureRatio) {
+ // We just transition into tenure state when the semi-space was at
+ // maximum capacity.
+ if (maximum_size_scavenge) {
+ set_deopt_dependent_code(true);
+ set_pretenure_decision(kTenure);
+ // Currently we just need to deopt when we make a state transition to
+ // tenure.
+ return true;
+ }
+ set_pretenure_decision(kMaybeTenure);
+ } else {
+ set_pretenure_decision(kDontTenure);
+ }
+ }
+ return false;
+}
+
+
+inline bool AllocationSite::DigestPretenuringFeedback(
+ bool maximum_size_scavenge) {
+ 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();
+
+ if (minimum_mementos_created) {
+ deopt = MakePretenureDecision(
+ current_decision, ratio, maximum_size_scavenge);
}
if (FLAG_trace_pretenuring_statistics) {
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;
}
« no previous file with comments | « src/objects.cc ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698