Reviewers: Hannes Payer,

Description:
Use the incremental root marking visitor for overapproximating the weak closure

Since incremental marking hasn't completed yet at this point, we can't
use the MC's root visitor.

Also, we shouldn't hurry with incremental marking while
overapproximating

BUG=v8:3862
[email protected]
LOG=n

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

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

Affected files (+14, -4 lines):
  M src/heap/heap.cc
  M src/heap/incremental-marking.h
  M src/heap/incremental-marking.cc
  M src/heap/mark-compact.cc


Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index e0dd8b63b2dd0ea3f073aff50f896110d7fcae9c..87b3d3e89ce5551fd6b939638978ead24ed6b5d2 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -777,7 +777,6 @@ void Heap::OverApproximateWeakClosure(const char* gc_reason) {
     }
   }
   mark_compact_collector()->OverApproximateWeakClosure();
-  incremental_marking()->set_should_hurry(false);
   incremental_marking()->set_weak_closure_was_overapproximated(true);
   {
     GCCallbacksScope scope(this);
Index: src/heap/incremental-marking.cc
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc index 76c05de6065be5da1c51e8a7f7f8894f1eed82fb..3a24114bea7d2dbef998a59756662b21b073bb06 100644
--- a/src/heap/incremental-marking.cc
+++ b/src/heap/incremental-marking.cc
@@ -777,7 +777,6 @@ void IncrementalMarking::OverApproximateWeakClosure() {
   if (FLAG_trace_incremental_marking) {
PrintF("[IncrementalMarking] requesting weak closure overapproximation.\n");
   }
-  set_should_hurry(true);
   request_type_ = OVERAPPROXIMATION;
   heap_->isolate()->stack_guard()->RequestGC();
 }
@@ -1000,6 +999,11 @@ bool IncrementalMarking::IsIdleMarkingDelayCounterLimitReached() {
 }


+ObjectVisitor* IncrementalMarking::CreateRootMarkingVisitor() {
+  return new IncrementalMarkingRootMarkingVisitor(this);
+}
+
+
 void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
   idle_marking_delay_counter_++;
 }
Index: src/heap/incremental-marking.h
diff --git a/src/heap/incremental-marking.h b/src/heap/incremental-marking.h
index d6dfe17c7f2472ebb9ce76bdab694e1cb5a00708..0b16f3713fcd9373f5c843c4fd95a71524a28a8d 100644
--- a/src/heap/incremental-marking.h
+++ b/src/heap/incremental-marking.h
@@ -189,6 +189,10 @@ class IncrementalMarking {

   bool IsIdleMarkingDelayCounterLimitReached();

+  // Creates a visitor for marking roots using this incremental marking
+  // instance. Caller takes ownership.
+  ObjectVisitor* CreateRootMarkingVisitor();
+
  private:
   int64_t SpaceLeftInOldSpace();

Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 29cf00e9757922789a908ccf24080fd296db8636..f23f86b442d317cb7337a3bebdf2fc63467e2291 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2228,9 +2228,12 @@ void MarkCompactCollector::OverApproximateWeakClosure() {
   GCTracer::Scope gc_scope(heap()->tracer(),
                            GCTracer::Scope::MC_INCREMENTAL_WEAKCLOSURE);

-  RootMarkingVisitor root_visitor(heap());
+  ObjectVisitor* root_visitor =
+      heap()->incremental_marking()->CreateRootMarkingVisitor();
   isolate()->global_handles()->IterateObjectGroups(
-      &root_visitor, &IsUnmarkedHeapObjectWithHeap);
+      root_visitor, &IsUnmarkedHeapObjectWithHeap);
+  delete root_visitor;
+
   MarkImplicitRefGroups();

   // Remove object groups after marking phase.


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