summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/heap/test-concurrent-marking.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/cctest/heap/test-concurrent-marking.cc')
-rw-r--r--deps/v8/test/cctest/heap/test-concurrent-marking.cc40
1 files changed, 36 insertions, 4 deletions
diff --git a/deps/v8/test/cctest/heap/test-concurrent-marking.cc b/deps/v8/test/cctest/heap/test-concurrent-marking.cc
index 36bf49c2ff..5ee99c6320 100644
--- a/deps/v8/test/cctest/heap/test-concurrent-marking.cc
+++ b/deps/v8/test/cctest/heap/test-concurrent-marking.cc
@@ -31,12 +31,20 @@ TEST(ConcurrentMarking) {
if (!i::FLAG_concurrent_marking) return;
CcTest::InitializeVM();
Heap* heap = CcTest::heap();
- ConcurrentMarking::MarkingWorklist shared, bailout;
+ CcTest::CollectAllGarbage();
+ if (!heap->incremental_marking()->IsStopped()) return;
+ MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector();
+ if (collector->sweeping_in_progress()) {
+ collector->EnsureSweepingCompleted();
+ }
+
+ ConcurrentMarking::MarkingWorklist shared, bailout, on_hold;
WeakObjects weak_objects;
ConcurrentMarking* concurrent_marking =
- new ConcurrentMarking(heap, &shared, &bailout, &weak_objects);
+ new ConcurrentMarking(heap, &shared, &bailout, &on_hold, &weak_objects);
PublishSegment(&shared, heap->undefined_value());
concurrent_marking->ScheduleTasks();
+ concurrent_marking->WaitForTasks();
concurrent_marking->EnsureCompleted();
delete concurrent_marking;
}
@@ -45,19 +53,43 @@ TEST(ConcurrentMarkingReschedule) {
if (!i::FLAG_concurrent_marking) return;
CcTest::InitializeVM();
Heap* heap = CcTest::heap();
- ConcurrentMarking::MarkingWorklist shared, bailout;
+ CcTest::CollectAllGarbage();
+ if (!heap->incremental_marking()->IsStopped()) return;
+ MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector();
+ if (collector->sweeping_in_progress()) {
+ collector->EnsureSweepingCompleted();
+ }
+
+ ConcurrentMarking::MarkingWorklist shared, bailout, on_hold;
WeakObjects weak_objects;
ConcurrentMarking* concurrent_marking =
- new ConcurrentMarking(heap, &shared, &bailout, &weak_objects);
+ new ConcurrentMarking(heap, &shared, &bailout, &on_hold, &weak_objects);
PublishSegment(&shared, heap->undefined_value());
concurrent_marking->ScheduleTasks();
+ concurrent_marking->WaitForTasks();
concurrent_marking->EnsureCompleted();
PublishSegment(&shared, heap->undefined_value());
concurrent_marking->RescheduleTasksIfNeeded();
+ concurrent_marking->WaitForTasks();
concurrent_marking->EnsureCompleted();
delete concurrent_marking;
}
+TEST(ConcurrentMarkingMarkedBytes) {
+ if (!i::FLAG_concurrent_marking) return;
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = CcTest::heap();
+ HandleScope sc(isolate);
+ Handle<FixedArray> root = isolate->factory()->NewFixedArray(1000000);
+ CcTest::CollectAllGarbage();
+ if (!heap->incremental_marking()->IsStopped()) return;
+ heap::SimulateIncrementalMarking(heap, false);
+ heap->concurrent_marking()->WaitForTasks();
+ heap->concurrent_marking()->EnsureCompleted();
+ CHECK_GE(heap->concurrent_marking()->TotalMarkedBytes(), root->Size());
+}
+
} // namespace heap
} // namespace internal
} // namespace v8