Reviewers: Hannes Payer,

Description:
Make tests pass with weak closure overapproximation enabled

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

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

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

Affected files (+14, -2 lines):
  M src/heap/heap.cc
  M src/heap/incremental-marking.h
  M test/cctest/cctest.h
  M test/cctest/test-heap.cc


Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 6ce23da02908f33323bd8ce6a7b6b1ee4c7e319f..a3548836f3df29671f55333b6a0eefcef34ed528 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4586,6 +4586,7 @@ bool Heap::TryFinalizeIdleIncrementalMarking(
     size_t final_incremental_mark_compact_speed_in_bytes_per_ms) {
   if (incremental_marking()->IsReadyToOverApproximateWeakClosure() ||
       (FLAG_overapproximate_weak_closure &&
+       !incremental_marking()->weak_closure_was_overapproximated() &&
        mark_compact_collector_.marking_deque()->IsEmpty() &&
        gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure(
            static_cast<size_t>(idle_time_in_ms)))) {
Index: src/heap/incremental-marking.h
diff --git a/src/heap/incremental-marking.h b/src/heap/incremental-marking.h
index 8ad12bc79f95065c3c30efbc1f0389e35135ce22..7d41cfef4156dc73f46abb3180f95baf9f625a3b 100644
--- a/src/heap/incremental-marking.h
+++ b/src/heap/incremental-marking.h
@@ -42,6 +42,10 @@ class IncrementalMarking {
     return weak_closure_was_overapproximated_;
   }

+  void SetWeakClosureWasOverApproximatedForTesting(bool val) {
+    weak_closure_was_overapproximated_ = val;
+  }
+
   inline bool IsStopped() { return state() == STOPPED; }

   INLINE(bool IsMarking()) { return state() >= MARKING; }
@@ -51,7 +55,8 @@ class IncrementalMarking {
   inline bool IsComplete() { return state() == COMPLETE; }

   inline bool IsReadyToOverApproximateWeakClosure() const {
-    return request_type_ == OVERAPPROXIMATION;
+    return request_type_ == OVERAPPROXIMATION &&
+           !weak_closure_was_overapproximated_;
   }

   GCRequestType request_type() const { return request_type_; }
Index: test/cctest/cctest.h
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index e111438cdf7de109e3834dfeba6a41a1fa9a1e9c..08877c8268bc8641a8020b706de25d5f1c4aea53 100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -558,6 +558,9 @@ static inline void SimulateIncrementalMarking(i::Heap* heap) {
   CHECK(marking->IsMarking());
   while (!marking->IsComplete()) {
     marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD);
+    if (marking->IsReadyToOverApproximateWeakClosure()) {
+      marking->MarkObjectGroups();
+    }
   }
   CHECK(marking->IsComplete());
 }
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index d46d59a9128553f96d0c709cd22cd8c5c237d9e8..0e6776cbe95724b4ad94494766c2028a9e47ab6f 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -2341,6 +2341,8 @@ TEST(IdleNotificationFinishMarking) {
     CHECK(!marking->IsIdleMarkingDelayCounterLimitReached());
   }

+  marking->SetWeakClosureWasOverApproximatedForTesting(true);
+
   // The next idle notification has to finish incremental marking.
   const int kLongIdleTime = 1000000;
   CcTest::isolate()->IdleNotification(kLongIdleTime);
@@ -4065,7 +4067,8 @@ TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) {
   if (marking->IsStopped()) marking->Start();
   // This big step should be sufficient to mark the whole array.
   marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
-  DCHECK(marking->IsComplete());
+  DCHECK(marking->IsComplete() ||
+         marking->IsReadyToOverApproximateWeakClosure());
 }




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