Chromium Code Reviews| 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 <map> | |
|
siva
2012/09/14 00:03:46
I would prefer if we could have a local map and no
| |
| 9 | |
| 8 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| 9 | 11 |
| 10 namespace dart { | 12 namespace dart { |
| 11 | 13 |
| 12 // Forward declarations. | 14 // Forward declarations. |
| 13 class HandleVisitor; | 15 class HandleVisitor; |
| 14 class Heap; | 16 class Heap; |
| 15 class Isolate; | 17 class Isolate; |
| 16 class MarkingVisitor; | 18 class MarkingVisitor; |
| 17 class ObjectPointerVisitor; | 19 class ObjectPointerVisitor; |
| 18 class PageSpace; | 20 class PageSpace; |
| 21 class RawObject; | |
| 19 class RawWeakProperty; | 22 class RawWeakProperty; |
| 20 | 23 |
| 21 // The class GCMarker is used to mark reachable old generation objects as part | 24 // The class GCMarker is used to mark reachable old generation objects as part |
| 22 // of the mark-sweep collection. The marking bit used is defined in RawObject. | 25 // of the mark-sweep collection. The marking bit used is defined in RawObject. |
| 23 class GCMarker : public ValueObject { | 26 class GCMarker : public ValueObject { |
| 24 public: | 27 public: |
| 25 explicit GCMarker(Heap* heap) : heap_(heap) { } | 28 explicit GCMarker(Heap* heap, std::map<RawObject*, void*>* peer) : |
|
Anton Muhin
2012/09/13 06:27:07
nit: explicit can go away now
cshapiro
2012/09/15 01:23:41
Thanks. Done.
| |
| 29 heap_(heap), peer_(peer) { } | |
| 26 ~GCMarker() { } | 30 ~GCMarker() { } |
| 27 | 31 |
| 28 void MarkObjects(Isolate* isolate, | 32 void MarkObjects(Isolate* isolate, |
| 29 PageSpace* page_space, | 33 PageSpace* page_space, |
| 30 bool invoke_api_callbacks); | 34 bool invoke_api_callbacks); |
| 31 | 35 |
| 32 private: | 36 private: |
| 33 void Prologue(Isolate* isolate, bool invoke_api_callbacks); | 37 void Prologue(Isolate* isolate, bool invoke_api_callbacks); |
| 34 void Epilogue(Isolate* isolate, bool invoke_api_callbacks); | 38 void Epilogue(Isolate* isolate, bool invoke_api_callbacks); |
| 35 void IterateRoots(Isolate* isolate, | 39 void IterateRoots(Isolate* isolate, |
| 36 ObjectPointerVisitor* visitor, | 40 ObjectPointerVisitor* visitor, |
| 37 bool visit_prologue_weak_persistent_handles); | 41 bool visit_prologue_weak_persistent_handles); |
| 38 void IterateWeakRoots(Isolate* isolate, | 42 void IterateWeakRoots(Isolate* isolate, |
| 39 HandleVisitor* visitor, | 43 HandleVisitor* visitor, |
| 40 bool visit_prologue_weak_persistent_handles); | 44 bool visit_prologue_weak_persistent_handles); |
| 41 void IterateWeakReferences(Isolate* isolate, MarkingVisitor* visitor); | 45 void IterateWeakReferences(Isolate* isolate, MarkingVisitor* visitor); |
| 42 void DrainMarkingStack(Isolate* isolate, MarkingVisitor* visitor); | 46 void DrainMarkingStack(Isolate* isolate, MarkingVisitor* visitor); |
| 43 void ProcessWeakProperty(RawWeakProperty* raw_weak, MarkingVisitor* visitor); | 47 void ProcessWeakProperty(RawWeakProperty* raw_weak, MarkingVisitor* visitor); |
| 48 void ProcessPeerReferents(); | |
| 44 | 49 |
| 45 Heap* heap_; | 50 Heap* heap_; |
| 51 std::map<RawObject*, void*>* peer_; | |
|
siva
2012/09/14 00:03:46
why not call it peer_table_ or peer_map_
cshapiro
2012/09/15 01:23:41
Renamed. Done.
| |
| 46 | 52 |
| 47 DISALLOW_IMPLICIT_CONSTRUCTORS(GCMarker); | 53 DISALLOW_IMPLICIT_CONSTRUCTORS(GCMarker); |
| 48 }; | 54 }; |
| 49 | 55 |
| 50 } // namespace dart | 56 } // namespace dart |
| 51 | 57 |
| 52 #endif // VM_GC_MARKER_H_ | 58 #endif // VM_GC_MARKER_H_ |
| OLD | NEW |