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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ASSERT(result); | 119 ASSERT(result); |
120 { | 120 { |
121 Thread* thread = Thread::Current(); | 121 Thread* thread = Thread::Current(); |
122 TimelineDurationScope tds(thread, Timeline::GetGCStream(), "SweeperTask"); | 122 TIMELINE_FUNCTION_GC_DURATION(thread, "SweeperTask"); |
123 GCSweeper sweeper; | 123 GCSweeper sweeper; |
124 | 124 |
125 HeapPage* page = first_; | 125 HeapPage* page = first_; |
126 HeapPage* prev_page = NULL; | 126 HeapPage* prev_page = NULL; |
127 | 127 |
128 while (page != NULL) { | 128 while (page != NULL) { |
129 thread->CheckForSafepoint(); | 129 thread->CheckForSafepoint(); |
130 HeapPage* next_page = page->next(); | 130 HeapPage* next_page = page->next(); |
131 ASSERT(page->type() == HeapPage::kData); | 131 ASSERT(page->type() == HeapPage::kData); |
132 bool page_in_use = sweeper.SweepPage(page, freelist_, false); | 132 bool page_in_use = sweeper.SweepPage(page, freelist_, false); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 SweeperTask* task = | 171 SweeperTask* task = |
172 new SweeperTask(isolate, | 172 new SweeperTask(isolate, |
173 isolate->heap()->old_space(), | 173 isolate->heap()->old_space(), |
174 first, last, | 174 first, last, |
175 freelist); | 175 freelist); |
176 ThreadPool* pool = Dart::thread_pool(); | 176 ThreadPool* pool = Dart::thread_pool(); |
177 pool->Run(task); | 177 pool->Run(task); |
178 } | 178 } |
179 | 179 |
180 } // namespace dart | 180 } // namespace dart |
OLD | NEW |