Cleanup allocation site pretenuring tracing, added new flag --trace-pretenuring-stati...
authorhpayer@chromium.org <hpayer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 6 Feb 2014 10:30:13 +0000 (10:30 +0000)
committerhpayer@chromium.org <hpayer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 6 Feb 2014 10:30:13 +0000 (10:30 +0000)
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

src/flag-definitions.h
src/heap.cc
src/objects-inl.h

index 25af921..6f226ac 100644 (file)
@@ -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")
index 4eadabe..e0b3120 100644 (file)
@@ -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)) {
index 18926bf..a0256fb 100644 (file)
@@ -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<double>(found_count) / create_count;
+  PretenureFlag current_mode = GetPretenureMode();
+
   if (create_count >= kPretenureMinimumCreated) {
-    int found_count = memento_found_count();
-    double ratio = static_cast<double>(found_count) / create_count;
-    if (FLAG_trace_track_allocation_sites) {
-      PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n",
-             static_cast<void*>(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<void*>(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);