Report precise number of incrementally marked bytes to gc tracer.
authorhpayer@chromium.org <hpayer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 1 Aug 2014 07:34:49 +0000 (07:34 +0000)
committerhpayer@chromium.org <hpayer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 1 Aug 2014 07:34:49 +0000 (07:34 +0000)
BUG=
R=ernstm@chromium.org

Review URL: https://codereview.chromium.org/428263006

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22776 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/gc-tracer.cc
src/gc-tracer.h
src/incremental-marking.cc
src/incremental-marking.h

index 74a2aa8..e3c876c 100644 (file)
@@ -280,8 +280,8 @@ void GCTracer::PrintNVP() const {
     PrintF("steps_count=%d ", current_.incremental_marking_steps);
     PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
     PrintF("longest_step=%.1f ", current_.longest_incremental_marking_step);
-    PrintF("marking_throughput=%" V8_PTR_PREFIX "d ",
-           MarkingSpeedInBytesPerMillisecond());
+    PrintF("incremental_marking_throughput=%" V8_PTR_PREFIX "d ",
+           IncrementalMarkingSpeedInBytesPerMillisecond());
   }
 
   PrintF("\n");
@@ -355,7 +355,7 @@ double GCTracer::MaxIncrementalMarkingDuration() const {
 }
 
 
-intptr_t GCTracer::MarkingSpeedInBytesPerMillisecond() const {
+intptr_t GCTracer::IncrementalMarkingSpeedInBytesPerMillisecond() const {
   if (cumulative_incremental_marking_duration_ == 0.0) return 0;
 
   // We haven't completed an entire round of incremental marking, yet.
index 0f4f135..b33214c 100644 (file)
@@ -252,7 +252,7 @@ class GCTracer BASE_EMBEDDED {
 
   // Compute the average incremental marking speed in bytes/second. Returns 0 if
   // no events have been recorded.
-  intptr_t MarkingSpeedInBytesPerMillisecond() const;
+  intptr_t IncrementalMarkingSpeedInBytesPerMillisecond() const;
 
  private:
   // Print one detailed trace line in name=value format.
index 0ab9a00..6526577 100644 (file)
@@ -677,9 +677,10 @@ void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) {
 }
 
 
-void IncrementalMarking::ProcessMarkingDeque(intptr_t bytes_to_process) {
+intptr_t IncrementalMarking::ProcessMarkingDeque(intptr_t bytes_to_process) {
+  intptr_t bytes_processed = 0;
   Map* filler_map = heap_->one_pointer_filler_map();
-  while (!marking_deque_.IsEmpty() && bytes_to_process > 0) {
+  while (!marking_deque_.IsEmpty() && bytes_processed < bytes_to_process) {
     HeapObject* obj = marking_deque_.Pop();
 
     // Explicitly skip one word fillers. Incremental markbit patterns are
@@ -693,8 +694,9 @@ void IncrementalMarking::ProcessMarkingDeque(intptr_t bytes_to_process) {
     int delta = (size - unscanned_bytes_of_large_object_);
     // TODO(jochen): remove after http://crbug.com/381820 is resolved.
     CHECK_LT(0, delta);
-    bytes_to_process -= delta;
+    bytes_processed += delta;
   }
+  return bytes_processed;
 }
 
 
@@ -873,6 +875,7 @@ void IncrementalMarking::Step(intptr_t allocated_bytes,
     write_barriers_invoked_since_last_step_ = 0;
 
     bytes_scanned_ += bytes_to_process;
+    intptr_t bytes_processed = 0;
 
     if (state_ == SWEEPING) {
       if (heap_->mark_compact_collector()->sweeping_in_progress() &&
@@ -884,7 +887,7 @@ void IncrementalMarking::Step(intptr_t allocated_bytes,
         StartMarking(PREVENT_COMPACTION);
       }
     } else if (state_ == MARKING) {
-      ProcessMarkingDeque(bytes_to_process);
+      bytes_processed = ProcessMarkingDeque(bytes_to_process);
       if (marking_deque_.IsEmpty()) MarkingComplete(action);
     }
 
@@ -956,7 +959,10 @@ void IncrementalMarking::Step(intptr_t allocated_bytes,
 
     double end = base::OS::TimeCurrentMillis();
     double duration = (end - start);
-    heap_->tracer()->AddIncrementalMarkingStep(duration, allocated_bytes);
+    // Note that we report zero bytes here when sweeping was in progress or
+    // when we just started incremental marking. In these cases we did not
+    // process the marking deque.
+    heap_->tracer()->AddIncrementalMarkingStep(duration, bytes_processed);
     heap_->AddMarkingTime(duration);
   }
 }
index 20cfb01..c2f9e70 100644 (file)
@@ -202,7 +202,7 @@ class IncrementalMarking {
 
   INLINE(void ProcessMarkingDeque());
 
-  INLINE(void ProcessMarkingDeque(intptr_t bytes_to_process));
+  INLINE(intptr_t ProcessMarkingDeque(intptr_t bytes_to_process));
 
   INLINE(void VisitObject(Map* map, HeapObject* obj, int size));