Reviewers: Hannes Payer,

Description:
Trace how long it takes to compute the weak closure during mark-compact

BUG=none
[email protected]
LOG=n

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

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+30, -25 lines):
  M src/heap/gc-tracer.h
  M src/heap/gc-tracer.cc
  M src/heap/mark-compact.cc


Index: src/heap/gc-tracer.cc
diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc
index 93686ba85cbba178adc618153d6208d42e136b47..732bfe0d57860076eaf49ceb14e9bc49b40ebd68 100644
--- a/src/heap/gc-tracer.cc
+++ b/src/heap/gc-tracer.cc
@@ -339,6 +339,7 @@ void GCTracer::PrintNVP() const {
          current_.scopes[Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED]);
   PrintF("misc_compaction=%.1f ",
          current_.scopes[Scope::MC_UPDATE_MISC_POINTERS]);
+  PrintF("weak_closure=%.1f ", current_.scopes[Scope::MC_WEAKCLOSURE]);
   PrintF("weakcollection_process=%.1f ",
          current_.scopes[Scope::MC_WEAKCOLLECTION_PROCESS]);
   PrintF("weakcollection_clear=%.1f ",
Index: src/heap/gc-tracer.h
diff --git a/src/heap/gc-tracer.h b/src/heap/gc-tracer.h
index fb229f47e6b22190d9778549274e9d0bae99e2d7..6932eadfd8d4ea4298bed4ff9d06c0c488b5759a 100644
--- a/src/heap/gc-tracer.h
+++ b/src/heap/gc-tracer.h
@@ -103,6 +103,7 @@ class GCTracer {
       MC_UPDATE_POINTERS_TO_EVACUATED,
       MC_UPDATE_POINTERS_BETWEEN_EVACUATED,
       MC_UPDATE_MISC_POINTERS,
+      MC_WEAKCLOSURE,
       MC_WEAKCOLLECTION_PROCESS,
       MC_WEAKCOLLECTION_CLEAR,
       MC_WEAKCOLLECTION_ABORT,
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 51a650a09930bd70af2d196beebe1e6b97abcc37..047db79dbe2c879fe19274a20f59deccf3b78440 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2220,31 +2220,34 @@ void MarkCompactCollector::MarkLiveObjects() {
   RootMarkingVisitor root_visitor(heap());
   MarkRoots(&root_visitor);

-  ProcessTopOptimizedFrame(&root_visitor);
-
-  // The objects reachable from the roots are marked, yet unreachable
-  // objects are unmarked.  Mark objects reachable due to host
-  // application specific logic or through Harmony weak maps.
-  ProcessEphemeralMarking(&root_visitor, false);
-
-  // The objects reachable from the roots, weak maps or object groups
-  // are marked. Objects pointed to only by weak global handles cannot be
- // immediately reclaimed. Instead, we have to mark them as pending and mark
-  // objects reachable from them.
-  //
-  // First we identify nonlive weak handles and mark them as pending
-  // destruction.
-  heap()->isolate()->global_handles()->IdentifyWeakHandles(
-      &IsUnmarkedHeapObject);
-  // Then we mark the objects.
-  heap()->isolate()->global_handles()->IterateWeakRoots(&root_visitor);
-
- // Repeat Harmony weak maps marking to mark unmarked objects reachable from
-  // the weak roots we just marked as pending destruction.
-  //
- // We only process harmony collections, as all object groups have been fully - // processed and no weakly reachable node can discover new objects groups.
-  ProcessEphemeralMarking(&root_visitor, true);
+  {
+ GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_WEAKCLOSURE);
+    ProcessTopOptimizedFrame(&root_visitor);
+
+    // The objects reachable from the roots are marked, yet unreachable
+    // objects are unmarked.  Mark objects reachable due to host
+    // application specific logic or through Harmony weak maps.
+    ProcessEphemeralMarking(&root_visitor, false);
+
+    // The objects reachable from the roots, weak maps or object groups
+    // are marked. Objects pointed to only by weak global handles cannot be
+ // immediately reclaimed. Instead, we have to mark them as pending and mark
+    // objects reachable from them.
+    //
+    // First we identify nonlive weak handles and mark them as pending
+    // destruction.
+    heap()->isolate()->global_handles()->IdentifyWeakHandles(
+        &IsUnmarkedHeapObject);
+    // Then we mark the objects.
+    heap()->isolate()->global_handles()->IterateWeakRoots(&root_visitor);
+
+ // Repeat Harmony weak maps marking to mark unmarked objects reachable from
+    // the weak roots we just marked as pending destruction.
+    //
+ // We only process harmony collections, as all object groups have been fully + // processed and no weakly reachable node can discover new objects groups.
+    ProcessEphemeralMarking(&root_visitor, true);
+  }

   AfterMarking();



--
--
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