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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ASSERT(first_ != NULL); | 107 ASSERT(first_ != NULL); |
108 ASSERT(old_space_ != NULL); | 108 ASSERT(old_space_ != NULL); |
109 ASSERT(last_ != NULL); | 109 ASSERT(last_ != NULL); |
110 ASSERT(freelist_ != NULL); | 110 ASSERT(freelist_ != NULL); |
111 MonitorLocker ml(old_space_->tasks_lock()); | 111 MonitorLocker ml(old_space_->tasks_lock()); |
112 old_space_->set_tasks(old_space_->tasks() + 1); | 112 old_space_->set_tasks(old_space_->tasks() + 1); |
113 ml.Notify(); | 113 ml.Notify(); |
114 } | 114 } |
115 | 115 |
116 virtual void Run() { | 116 virtual void Run() { |
117 Thread::EnterIsolateAsHelper(task_isolate_); | 117 bool result = Thread::EnterIsolateAsHelper(task_isolate_); |
| 118 ASSERT(result); |
118 GCSweeper sweeper; | 119 GCSweeper sweeper; |
119 | 120 |
120 HeapPage* page = first_; | 121 HeapPage* page = first_; |
121 HeapPage* prev_page = NULL; | 122 HeapPage* prev_page = NULL; |
122 | 123 |
123 while (page != NULL) { | 124 while (page != NULL) { |
124 task_isolate_->thread_registry()->CheckSafepoint(); | 125 task_isolate_->thread_registry()->CheckSafepoint(); |
125 HeapPage* next_page = page->next(); | 126 HeapPage* next_page = page->next(); |
126 ASSERT(page->type() == HeapPage::kData); | 127 ASSERT(page->type() == HeapPage::kData); |
127 bool page_in_use = sweeper.SweepPage(page, freelist_, false); | 128 bool page_in_use = sweeper.SweepPage(page, freelist_, false); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 SweeperTask* task = | 166 SweeperTask* task = |
166 new SweeperTask(isolate, | 167 new SweeperTask(isolate, |
167 isolate->heap()->old_space(), | 168 isolate->heap()->old_space(), |
168 first, last, | 169 first, last, |
169 freelist); | 170 freelist); |
170 ThreadPool* pool = Dart::thread_pool(); | 171 ThreadPool* pool = Dart::thread_pool(); |
171 pool->Run(task); | 172 pool->Run(task); |
172 } | 173 } |
173 | 174 |
174 } // namespace dart | 175 } // namespace dart |
OLD | NEW |