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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 ASSERT(first_ != NULL); | 108 ASSERT(first_ != NULL); |
109 ASSERT(old_space_ != NULL); | 109 ASSERT(old_space_ != NULL); |
110 ASSERT(last_ != NULL); | 110 ASSERT(last_ != NULL); |
111 ASSERT(freelist_ != NULL); | 111 ASSERT(freelist_ != NULL); |
112 MonitorLocker ml(old_space_->tasks_lock()); | 112 MonitorLocker ml(old_space_->tasks_lock()); |
113 old_space_->set_tasks(old_space_->tasks() + 1); | 113 old_space_->set_tasks(old_space_->tasks() + 1); |
114 ml.Notify(); | 114 ml.Notify(); |
115 } | 115 } |
116 | 116 |
117 virtual void Run() { | 117 virtual void Run() { |
118 bool result = Thread::EnterIsolateAsHelper(task_isolate_); | 118 bool result = Thread::EnterIsolateAsHelper(task_isolate_, |
| 119 Thread::kSweeperTask); |
119 ASSERT(result); | 120 ASSERT(result); |
120 { | 121 { |
121 Thread* thread = Thread::Current(); | 122 Thread* thread = Thread::Current(); |
122 TIMELINE_FUNCTION_GC_DURATION(thread, "SweeperTask"); | 123 TIMELINE_FUNCTION_GC_DURATION(thread, "SweeperTask"); |
123 GCSweeper sweeper; | 124 GCSweeper sweeper; |
124 | 125 |
125 HeapPage* page = first_; | 126 HeapPage* page = first_; |
126 HeapPage* prev_page = NULL; | 127 HeapPage* prev_page = NULL; |
127 | 128 |
128 while (page != NULL) { | 129 while (page != NULL) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 SweeperTask* task = | 172 SweeperTask* task = |
172 new SweeperTask(isolate, | 173 new SweeperTask(isolate, |
173 isolate->heap()->old_space(), | 174 isolate->heap()->old_space(), |
174 first, last, | 175 first, last, |
175 freelist); | 176 freelist); |
176 ThreadPool* pool = Dart::thread_pool(); | 177 ThreadPool* pool = Dart::thread_pool(); |
177 pool->Run(task); | 178 pool->Run(task); |
178 } | 179 } |
179 | 180 |
180 } // namespace dart | 181 } // namespace dart |
OLD | NEW |