| 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_marker.h" | 5 #include "vm/gc_marker.h" |
| 6 | 6 |
| 7 #include "vm/allocation.h" | 7 #include "vm/allocation.h" |
| 8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/pages.h" | 10 #include "vm/pages.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 WeakPersistentHandle::Finalize(handle); | 212 WeakPersistentHandle::Finalize(handle); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 private: | 216 private: |
| 217 DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor); | 217 DISALLOW_COPY_AND_ASSIGN(MarkingWeakVisitor); |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 | 220 |
| 221 void GCMarker::Prologue(Isolate* isolate) { | 221 void GCMarker::Prologue(Isolate* isolate) { |
| 222 // Nothing to do at the moment. | 222 // Always invoke the prologue callbacks. |
| 223 isolate->gc_prologue_callbacks().Invoke(); |
| 223 } | 224 } |
| 224 | 225 |
| 225 | 226 |
| 227 void GCMarker::Epilogue(Isolate* isolate) { |
| 228 // Always invoke the epilogue callbacks. |
| 229 isolate->gc_epilogue_callbacks().Invoke(); |
| 230 } |
| 231 |
| 232 |
| 226 void GCMarker::IterateRoots(Isolate* isolate, ObjectPointerVisitor* visitor) { | 233 void GCMarker::IterateRoots(Isolate* isolate, ObjectPointerVisitor* visitor) { |
| 227 isolate->VisitObjectPointers(visitor, | 234 isolate->VisitObjectPointers(visitor, |
| 228 StackFrameIterator::kDontValidateFrames); | 235 StackFrameIterator::kDontValidateFrames); |
| 229 heap_->IterateNewPointers(visitor); | 236 heap_->IterateNewPointers(visitor); |
| 230 heap_->IterateCodePointers(visitor); | 237 heap_->IterateCodePointers(visitor); |
| 231 } | 238 } |
| 232 | 239 |
| 233 | 240 |
| 234 void GCMarker::IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor) { | 241 void GCMarker::IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor) { |
| 235 isolate->VisitWeakPersistentHandles(visitor); | 242 isolate->VisitWeakPersistentHandles(visitor); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 305 |
| 299 void GCMarker::MarkObjects(Isolate* isolate, PageSpace* page_space) { | 306 void GCMarker::MarkObjects(Isolate* isolate, PageSpace* page_space) { |
| 300 MarkingStack marking_stack; | 307 MarkingStack marking_stack; |
| 301 Prologue(isolate); | 308 Prologue(isolate); |
| 302 MarkingVisitor mark(heap_, page_space, &marking_stack); | 309 MarkingVisitor mark(heap_, page_space, &marking_stack); |
| 303 IterateRoots(isolate, &mark); | 310 IterateRoots(isolate, &mark); |
| 304 DrainMarkingStack(isolate, &mark); | 311 DrainMarkingStack(isolate, &mark); |
| 305 IterateWeakReferences(isolate, &mark); | 312 IterateWeakReferences(isolate, &mark); |
| 306 MarkingWeakVisitor mark_weak; | 313 MarkingWeakVisitor mark_weak; |
| 307 IterateWeakRoots(isolate, &mark_weak); | 314 IterateWeakRoots(isolate, &mark_weak); |
| 315 Epilogue(isolate); |
| 308 } | 316 } |
| 309 | 317 |
| 310 } // namespace dart | 318 } // namespace dart |
| OLD | NEW |