Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: runtime/vm/gc_marker.cc

Issue 9605033: Implement a garbage collection prologue and epilogue callback mechanism. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« runtime/vm/gc_callbacks.h ('K') | « runtime/vm/gc_marker.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698