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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 ASSERT(old_space_ != NULL); | 97 ASSERT(old_space_ != NULL); |
98 ASSERT(last_ != NULL); | 98 ASSERT(last_ != NULL); |
99 ASSERT(freelist_ != NULL); | 99 ASSERT(freelist_ != NULL); |
100 MonitorLocker ml(old_space_->tasks_lock()); | 100 MonitorLocker ml(old_space_->tasks_lock()); |
101 old_space_->set_tasks(old_space_->tasks() + 1); | 101 old_space_->set_tasks(old_space_->tasks() + 1); |
102 ml.Notify(); | 102 ml.Notify(); |
103 } | 103 } |
104 | 104 |
105 virtual void Run() { | 105 virtual void Run() { |
106 Isolate::SetCurrent(task_isolate_); | 106 Isolate::SetCurrent(task_isolate_); |
107 GCSweeper sweeper(NULL); | 107 GCSweeper sweeper; |
108 | 108 |
109 HeapPage* page = first_; | 109 HeapPage* page = first_; |
110 HeapPage* prev_page = NULL; | 110 HeapPage* prev_page = NULL; |
111 | 111 |
112 while (page != NULL) { | 112 while (page != NULL) { |
113 HeapPage* next_page = page->next(); | 113 HeapPage* next_page = page->next(); |
114 ASSERT(page->type() == HeapPage::kData); | 114 ASSERT(page->type() == HeapPage::kData); |
115 bool page_in_use = true; | 115 bool page_in_use = true; |
116 { | 116 { |
117 MutexLocker ml(freelist_->mutex()); | 117 MutexLocker ml(freelist_->mutex()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 SweeperTask* task = | 157 SweeperTask* task = |
158 new SweeperTask(isolate->ShallowCopy(), | 158 new SweeperTask(isolate->ShallowCopy(), |
159 isolate->heap()->old_space(), | 159 isolate->heap()->old_space(), |
160 first, last, | 160 first, last, |
161 freelist); | 161 freelist); |
162 ThreadPool* pool = Dart::thread_pool(); | 162 ThreadPool* pool = Dart::thread_pool(); |
163 pool->Run(task); | 163 pool->Run(task); |
164 } | 164 } |
165 | 165 |
166 } // namespace dart | 166 } // namespace dart |
OLD | NEW |