| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/heap/concurrent-marking-deque.h" |
| 9 #include "src/heap/concurrent-marking.h" | 10 #include "src/heap/concurrent-marking.h" |
| 10 #include "src/heap/heap-inl.h" | 11 #include "src/heap/heap-inl.h" |
| 11 #include "src/heap/heap.h" | 12 #include "src/heap/heap.h" |
| 12 #include "test/cctest/cctest.h" | 13 #include "test/cctest/cctest.h" |
| 13 #include "test/cctest/heap/heap-utils.h" | 14 #include "test/cctest/heap/heap-utils.h" |
| 14 | 15 |
| 15 namespace v8 { | 16 namespace v8 { |
| 16 namespace internal { | 17 namespace internal { |
| 17 TEST(ConcurrentMarking) { | 18 TEST(ConcurrentMarking) { |
| 18 if (!i::FLAG_concurrent_marking) return; | 19 if (!i::FLAG_concurrent_marking) return; |
| 19 CcTest::InitializeVM(); | 20 CcTest::InitializeVM(); |
| 20 Heap* heap = CcTest::heap(); | 21 Heap* heap = CcTest::heap(); |
| 21 ConcurrentMarking* concurrent_marking = new ConcurrentMarking(heap); | 22 ConcurrentMarkingDeque deque(heap); |
| 22 concurrent_marking->AddRoot(heap->undefined_value()); | 23 deque.Push(heap->undefined_value()); |
| 24 ConcurrentMarking* concurrent_marking = new ConcurrentMarking(heap, &deque); |
| 23 concurrent_marking->StartTask(); | 25 concurrent_marking->StartTask(); |
| 24 concurrent_marking->WaitForTaskToComplete(); | 26 concurrent_marking->WaitForTaskToComplete(); |
| 25 delete concurrent_marking; | 27 delete concurrent_marking; |
| 26 } | 28 } |
| 27 | 29 |
| 28 } // namespace internal | 30 } // namespace internal |
| 29 } // namespace v8 | 31 } // namespace v8 |
| OLD | NEW |