OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_SWEEPER_THREAD_H_ | 5 #ifndef V8_SWEEPER_THREAD_H_ |
6 #define V8_SWEEPER_THREAD_H_ | 6 #define V8_SWEEPER_THREAD_H_ |
7 | 7 |
8 #include "atomicops.h" | 8 #include "atomicops.h" |
9 #include "flags.h" | 9 #include "flags.h" |
10 #include "platform.h" | 10 #include "platform.h" |
11 #include "utils.h" | 11 #include "utils.h" |
12 | 12 |
13 #include "spaces.h" | 13 #include "spaces.h" |
14 | 14 |
15 #include "heap.h" | 15 #include "heap.h" |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 namespace internal { | 18 namespace internal { |
19 | 19 |
20 class SweeperThread : public Thread { | 20 class SweeperThread : public Thread { |
21 public: | 21 public: |
22 explicit SweeperThread(Isolate* isolate); | 22 explicit SweeperThread(Isolate* isolate); |
23 ~SweeperThread() {} | 23 ~SweeperThread() {} |
24 | 24 |
25 void Run(); | 25 void Run(); |
26 void Stop(); | 26 void Stop(); |
27 void StartSweeping(); | 27 void StartSweeping(); |
28 void WaitForSweeperThread(); | 28 void WaitForSweeperThread(); |
| 29 bool SweepingCompleted(); |
29 | 30 |
30 static int NumberOfThreads(int max_available); | 31 static int NumberOfThreads(int max_available); |
31 | 32 |
32 private: | 33 private: |
33 Isolate* isolate_; | 34 Isolate* isolate_; |
34 Heap* heap_; | 35 Heap* heap_; |
35 MarkCompactCollector* collector_; | 36 MarkCompactCollector* collector_; |
36 Semaphore start_sweeping_semaphore_; | 37 Semaphore start_sweeping_semaphore_; |
37 Semaphore end_sweeping_semaphore_; | 38 Semaphore end_sweeping_semaphore_; |
38 Semaphore stop_semaphore_; | 39 Semaphore stop_semaphore_; |
39 volatile AtomicWord stop_thread_; | 40 volatile AtomicWord stop_thread_; |
40 }; | 41 }; |
41 | 42 |
42 } } // namespace v8::internal | 43 } } // namespace v8::internal |
43 | 44 |
44 #endif // V8_SWEEPER_THREAD_H_ | 45 #endif // V8_SWEEPER_THREAD_H_ |
OLD | NEW |