| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/gc_sweeper.h" | 5 #include "vm/gc_sweeper.h" |
| 6 | 6 |
| 7 #include "vm/freelist.h" | 7 #include "vm/freelist.h" |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if (page == last_) break; | 145 if (page == last_) break; |
| 146 page = next_page; | 146 page = next_page; |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 // Exit isolate cleanly *before* notifying it, to avoid shutdown race. | 149 // Exit isolate cleanly *before* notifying it, to avoid shutdown race. |
| 150 Thread::ExitIsolateAsHelper(); | 150 Thread::ExitIsolateAsHelper(); |
| 151 // This sweeper task is done. Notify the original isolate. | 151 // This sweeper task is done. Notify the original isolate. |
| 152 { | 152 { |
| 153 MonitorLocker ml(old_space_->tasks_lock()); | 153 MonitorLocker ml(old_space_->tasks_lock()); |
| 154 old_space_->set_tasks(old_space_->tasks() - 1); | 154 old_space_->set_tasks(old_space_->tasks() - 1); |
| 155 ml.Notify(); | 155 ml.NotifyAll(); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 private: | 159 private: |
| 160 Isolate* task_isolate_; | 160 Isolate* task_isolate_; |
| 161 PageSpace* old_space_; | 161 PageSpace* old_space_; |
| 162 HeapPage* first_; | 162 HeapPage* first_; |
| 163 HeapPage* last_; | 163 HeapPage* last_; |
| 164 FreeList* freelist_; | 164 FreeList* freelist_; |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 | 167 |
| 168 void GCSweeper::SweepConcurrent(Isolate* isolate, | 168 void GCSweeper::SweepConcurrent(Isolate* isolate, |
| 169 HeapPage* first, | 169 HeapPage* first, |
| 170 HeapPage* last, | 170 HeapPage* last, |
| 171 FreeList* freelist) { | 171 FreeList* freelist) { |
| 172 SweeperTask* task = | 172 SweeperTask* task = |
| 173 new SweeperTask(isolate, | 173 new SweeperTask(isolate, |
| 174 isolate->heap()->old_space(), | 174 isolate->heap()->old_space(), |
| 175 first, last, | 175 first, last, |
| 176 freelist); | 176 freelist); |
| 177 ThreadPool* pool = Dart::thread_pool(); | 177 ThreadPool* pool = Dart::thread_pool(); |
| 178 pool->Run(task); | 178 pool->Run(task); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace dart | 181 } // namespace dart |
| OLD | NEW |