Fix incremental marking to be off during heap snapshots.
authormstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 27 Nov 2012 13:18:55 +0000 (13:18 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 27 Nov 2012 13:18:55 +0000 (13:18 +0000)
The heap snapshot generator uses the UnreachableObjectsFilter which in
turn messes with marking bits. This requires incremental marking to be
turned off while the snapshot is being generated.

R=verwaest@chromium.org
TEST=cctest/test-heap-profiler --stress-compaction

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

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

src/heap.cc
src/mark-compact.h

index c394a2c60b7a4177e43691c211826112118fe8b0..b3b2df9148fde8a0719bd91d3f214f1bd71d464e 100644 (file)
@@ -615,7 +615,7 @@ bool Heap::CollectGarbage(AllocationSpace space,
   }
 
   if (collector == MARK_COMPACTOR &&
-      !mark_compact_collector()->abort_incremental_marking_ &&
+      !mark_compact_collector()->abort_incremental_marking() &&
       !incremental_marking()->IsStopped() &&
       !incremental_marking()->should_hurry() &&
       FLAG_incremental_marking_steps) {
@@ -657,10 +657,13 @@ bool Heap::CollectGarbage(AllocationSpace space,
     GarbageCollectionEpilogue();
   }
 
-  if (incremental_marking()->IsStopped()) {
-    if (incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull()) {
-      incremental_marking()->Start();
-    }
+  // Start incremental marking for the next cycle. The heap snapshot
+  // generator needs incremental marking to stay off after it aborted.
+  if (!mark_compact_collector()->abort_incremental_marking() &&
+      incremental_marking()->IsStopped() &&
+      incremental_marking()->WorthActivating() &&
+      NextGCIsLikelyToBeFull()) {
+    incremental_marking()->Start();
   }
 
   return next_gc_likely_to_collect_more;
index 0a4c1ea0d6e9ae04533054004b569393546cb272..b652e22a2835e66191a14335c28521a179ecd5f3 100644 (file)
@@ -658,6 +658,8 @@ class MarkCompactCollector {
 
   void ClearMarkbits();
 
+  bool abort_incremental_marking() const { return abort_incremental_marking_; }
+
   bool is_compacting() const { return compacting_; }
 
   MarkingParity marking_parity() { return marking_parity_; }