| 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 #ifndef VM_GC_MARKER_H_ | 5 #ifndef VM_GC_MARKER_H_ |
| 6 #define VM_GC_MARKER_H_ | 6 #define VM_GC_MARKER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 // Forward declarations. | 12 // Forward declarations. |
| 13 class HandleVisitor; | 13 class HandleVisitor; |
| 14 class Heap; | 14 class Heap; |
| 15 class Isolate; | 15 class Isolate; |
| 16 class MarkingVisitor; | 16 class MarkingVisitor; |
| 17 class ObjectPointerVisitor; | 17 class ObjectPointerVisitor; |
| 18 class PageSpace; | 18 class PageSpace; |
| 19 | 19 |
| 20 // The class GCMarker is used to mark reachable old generation objects as part | 20 // The class GCMarker is used to mark reachable old generation objects as part |
| 21 // of the mark-sweep collection. The marking bit used is defined in RawObject. | 21 // of the mark-sweep collection. The marking bit used is defined in RawObject. |
| 22 class GCMarker : public ValueObject { | 22 class GCMarker : public ValueObject { |
| 23 public: | 23 public: |
| 24 explicit GCMarker(Heap* heap) : heap_(heap) { } | 24 explicit GCMarker(Heap* heap) : heap_(heap) { } |
| 25 ~GCMarker() { } | 25 ~GCMarker() { } |
| 26 | 26 |
| 27 void MarkObjects(Isolate* isolate, PageSpace* page_space); | 27 void MarkObjects(Isolate* isolate, |
| 28 PageSpace* page_space, |
| 29 bool invoke_api_callbacks); |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 void Prologue(Isolate* isolate); | 32 void Prologue(Isolate* isolate, bool invoke_api_callbacks); |
| 31 void Epilogue(Isolate* isolate); | 33 void Epilogue(Isolate* isolate, bool invoke_api_callbacks); |
| 32 void IterateRoots(Isolate* isolate, ObjectPointerVisitor* visitor); | 34 void IterateRoots(Isolate* isolate, |
| 33 void IterateWeakRoots(Isolate* isolate, HandleVisitor* visitor); | 35 ObjectPointerVisitor* visitor, |
| 36 bool visit_prologue_weak_persistent_handles); |
| 37 void IterateWeakRoots(Isolate* isolate, |
| 38 HandleVisitor* visitor, |
| 39 bool visit_prologue_weak_persistent_handles); |
| 34 void IterateWeakReferences(Isolate* isolate, MarkingVisitor* visitor); | 40 void IterateWeakReferences(Isolate* isolate, MarkingVisitor* visitor); |
| 35 void DrainMarkingStack(Isolate* isolate, MarkingVisitor* visitor); | 41 void DrainMarkingStack(Isolate* isolate, MarkingVisitor* visitor); |
| 36 | 42 |
| 37 Heap* heap_; | 43 Heap* heap_; |
| 38 | 44 |
| 39 DISALLOW_IMPLICIT_CONSTRUCTORS(GCMarker); | 45 DISALLOW_IMPLICIT_CONSTRUCTORS(GCMarker); |
| 40 }; | 46 }; |
| 41 | 47 |
| 42 } // namespace dart | 48 } // namespace dart |
| 43 | 49 |
| 44 #endif // VM_GC_MARKER_H_ | 50 #endif // VM_GC_MARKER_H_ |
| OLD | NEW |