From: hpayer@chromium.org Date: Thu, 6 Feb 2014 10:30:13 +0000 (+0000) Subject: Cleanup allocation site pretenuring tracing, added new flag --trace-pretenuring-stati... X-Git-Tag: upstream/4.7.83~10846 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9b61008f2719111b9aeb73018293f9c67e250953;p=platform%2Fupstream%2Fv8.git Cleanup allocation site pretenuring tracing, added new flag --trace-pretenuring-statistics. BUG= R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/153273003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19141 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 25af921..6f226ac 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -224,6 +224,8 @@ DEFINE_bool(allocation_site_pretenuring, true, "pretenure with allocation sites") DEFINE_bool(trace_pretenuring, false, "trace pretenuring decisions of HAllocate instructions") +DEFINE_bool(trace_pretenuring_statistics, false, + "trace allocation site pretenuring statistics") DEFINE_bool(track_fields, true, "track fields with only smi values") DEFINE_bool(track_double_fields, true, "track fields with double values") DEFINE_bool(track_heap_object_fields, true, "track fields with heap values") diff --git a/src/heap.cc b/src/heap.cc index 4eadabe..e0b3120 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -548,10 +548,7 @@ void Heap::ProcessPretenuringFeedback() { allocation_sites_scratchpad_length = 0; - // TODO(mvstanton): Pretenure decisions are only made once for an allocation - // site. Find a sane way to decide about revisiting the decision later. - - if (FLAG_trace_track_allocation_sites && + if (FLAG_trace_pretenuring_statistics && (allocation_mementos_found > 0 || tenure_decisions > 0 || dont_tenure_decisions > 0)) { diff --git a/src/objects-inl.h b/src/objects-inl.h index 18926bf..a0256fb 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -1550,14 +1550,11 @@ inline void AllocationSite::IncrementMementoCreateCount() { inline bool AllocationSite::DigestPretenuringFeedback() { bool decision_changed = false; int create_count = memento_create_count(); + int found_count = memento_found_count(); + double ratio = static_cast(found_count) / create_count; + PretenureFlag current_mode = GetPretenureMode(); + if (create_count >= kPretenureMinimumCreated) { - int found_count = memento_found_count(); - double ratio = static_cast(found_count) / create_count; - if (FLAG_trace_track_allocation_sites) { - PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n", - static_cast(this), create_count, found_count, ratio); - } - int current_mode = GetPretenureMode(); PretenureDecision result = ratio >= kPretenureRatio ? kTenure : kDontTenure; @@ -1570,6 +1567,14 @@ inline bool AllocationSite::DigestPretenuringFeedback() { } } + if (FLAG_trace_pretenuring_statistics) { + PrintF( + "AllocationSite(%p): (created, found, ratio) (%d, %d, %f) %s => %s\n", + static_cast(this), create_count, found_count, ratio, + current_mode == TENURED ? "tenured" : "not tenured", + GetPretenureMode() == TENURED ? "tenured" : "not tenured"); + } + // Clear feedback calculation fields until the next gc. set_memento_found_count(0); set_memento_create_count(0);