| 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 ApiState* state = isolate->api_state(); |
| 224 ASSERT(state != NULL); |
| 225 state->gc_prologue_callbacks().Invoke(); |
| 223 } | 226 } |
| 224 | 227 |
| 225 | 228 |
| 229 void GCMarker::Epilogue(Isolate* isolate) { |
| 230 // Always invoke the epilogue callbacks. |
| 231 ApiState* state = isolate->api_state(); |
| 232 ASSERT(state != NULL); |
| 233 state->gc_epilogue_callbacks().Invoke(); |
| 234 } |
| 235 |
| 236 |
| 226 void GCMarker::IterateRoots(Isolate* isolate, ObjectPointerVisitor* visitor) { | 237 void GCMarker::IterateRoots(Isolate* isolate, ObjectPointerVisitor* visitor) { |
| 227 isolate->VisitObjectPointers(visitor, | 238 isolate->VisitObjectPointers(visitor, |
| 228 StackFrameIterator::kDontValidateFrames); | 239 StackFrameIterator::kDontValidateFrames); |
| 229 heap_->IterateNewPointers(visitor); | 240 heap_->IterateNewPointers(visitor); |
| 230 heap_->IterateCodePointers(visitor); | 241 heap_->IterateCodePointers(visitor); |
| 231 } | 242 } |
| 232 | 243 |
| 233 | 244 |
| 234 void GCMarker::IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor) { | 245 void GCMarker::IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor) { |
| 235 isolate->VisitWeakPersistentHandles(visitor); | 246 isolate->VisitWeakPersistentHandles(visitor); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 309 |
| 299 void GCMarker::MarkObjects(Isolate* isolate, PageSpace* page_space) { | 310 void GCMarker::MarkObjects(Isolate* isolate, PageSpace* page_space) { |
| 300 MarkingStack marking_stack; | 311 MarkingStack marking_stack; |
| 301 Prologue(isolate); | 312 Prologue(isolate); |
| 302 MarkingVisitor mark(heap_, page_space, &marking_stack); | 313 MarkingVisitor mark(heap_, page_space, &marking_stack); |
| 303 IterateRoots(isolate, &mark); | 314 IterateRoots(isolate, &mark); |
| 304 DrainMarkingStack(isolate, &mark); | 315 DrainMarkingStack(isolate, &mark); |
| 305 IterateWeakReferences(isolate, &mark); | 316 IterateWeakReferences(isolate, &mark); |
| 306 MarkingWeakVisitor mark_weak; | 317 MarkingWeakVisitor mark_weak; |
| 307 IterateWeakRoots(isolate, &mark_weak); | 318 IterateWeakRoots(isolate, &mark_weak); |
| 319 Epilogue(isolate); |
| 308 } | 320 } |
| 309 | 321 |
| 310 } // namespace dart | 322 } // namespace dart |
| OLD | NEW |