Reviewers: ernstm,

Description:
Report precise number of incrementally marked bytes to gc tracer.

BUG=

Please review this at https://codereview.chromium.org/428263006/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+16, -10 lines):
  M src/gc-tracer.h
  M src/gc-tracer.cc
  M src/incremental-marking.h
  M src/incremental-marking.cc


Index: src/gc-tracer.cc
diff --git a/src/gc-tracer.cc b/src/gc-tracer.cc
index 74a2aa873f1cb635ad6a2401c01cc4640db7f1c0..e3c876cd7cf98cafbcf8ab68d9cf47cdae87e1ce 100644
--- a/src/gc-tracer.cc
+++ b/src/gc-tracer.cc
@@ -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: src/gc-tracer.h
diff --git a/src/gc-tracer.h b/src/gc-tracer.h
index 0f4f135256ecc6ebd0ca0ea68ba1b68bf299108a..b33214cfeb80f1436b040f5962da26b3df02119a 100644
--- a/src/gc-tracer.h
+++ b/src/gc-tracer.h
@@ -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: src/incremental-marking.cc
diff --git a/src/incremental-marking.cc b/src/incremental-marking.cc
index 0ab9a002452e94aa7846816d14c73e9c4f349b7e..6526577d3efc1d4490d0a2340f8daaa7a70cd210 100644
--- a/src/incremental-marking.cc
+++ b/src/incremental-marking.cc
@@ -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: src/incremental-marking.h
diff --git a/src/incremental-marking.h b/src/incremental-marking.h
index 20cfb018ae368b5a47504ebcd59a7a21dab654a1..c2f9e70417fc05678cdec29c8dc5c55bbce2c8b4 100644
--- a/src/incremental-marking.h
+++ b/src/incremental-marking.h
@@ -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));



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to