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(task_isolate_ != NULL); | 107 ASSERT(task_isolate_ != NULL); |
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 } | 114 } |
115 | 115 |
116 virtual void Run() { | 116 virtual void Run() { |
117 bool result = Thread::EnterIsolateAsHelper(task_isolate_, | 117 bool result = |
118 Thread::kSweeperTask); | 118 Thread::EnterIsolateAsHelper(task_isolate_, Thread::kSweeperTask); |
119 ASSERT(result); | 119 ASSERT(result); |
120 { | 120 { |
121 Thread* thread = Thread::Current(); | 121 Thread* thread = Thread::Current(); |
122 TIMELINE_FUNCTION_GC_DURATION(thread, "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) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 HeapPage* first_; | 161 HeapPage* first_; |
162 HeapPage* last_; | 162 HeapPage* last_; |
163 FreeList* freelist_; | 163 FreeList* freelist_; |
164 }; | 164 }; |
165 | 165 |
166 | 166 |
167 void GCSweeper::SweepConcurrent(Isolate* isolate, | 167 void GCSweeper::SweepConcurrent(Isolate* isolate, |
168 HeapPage* first, | 168 HeapPage* first, |
169 HeapPage* last, | 169 HeapPage* last, |
170 FreeList* freelist) { | 170 FreeList* freelist) { |
171 SweeperTask* task = | 171 SweeperTask* task = new SweeperTask(isolate, isolate->heap()->old_space(), |
172 new SweeperTask(isolate, | 172 first, last, freelist); |
173 isolate->heap()->old_space(), | |
174 first, last, | |
175 freelist); | |
176 ThreadPool* pool = Dart::thread_pool(); | 173 ThreadPool* pool = Dart::thread_pool(); |
177 pool->Run(task); | 174 pool->Run(task); |
178 } | 175 } |
179 | 176 |
180 } // namespace dart | 177 } // namespace dart |
OLD | NEW |