OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_OBJECT_GRAPH_H_ | 5 #ifndef VM_OBJECT_GRAPH_H_ |
6 #define VM_OBJECT_GRAPH_H_ | 6 #define VM_OBJECT_GRAPH_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 kBacktrack, // Ignore this object's pointers. | 46 kBacktrack, // Ignore this object's pointers. |
47 kAbort, // Terminate the entire search immediately. | 47 kAbort, // Terminate the entire search immediately. |
48 }; | 48 }; |
49 virtual ~Visitor() { } | 49 virtual ~Visitor() { } |
50 // Visits the object pointed to by *it. The iterator is only valid | 50 // Visits the object pointed to by *it. The iterator is only valid |
51 // during this call. This method must not allocate from the heap or | 51 // during this call. This method must not allocate from the heap or |
52 // trigger GC in any way. | 52 // trigger GC in any way. |
53 virtual Direction VisitObject(StackIterator* it) = 0; | 53 virtual Direction VisitObject(StackIterator* it) = 0; |
54 }; | 54 }; |
55 | 55 |
56 explicit ObjectGraph(Isolate* isolate); | 56 explicit ObjectGraph(Thread* thread); |
57 ~ObjectGraph(); | 57 ~ObjectGraph(); |
58 | 58 |
59 // Visits all strongly reachable objects in the isolate's heap, in a | 59 // Visits all strongly reachable objects in the isolate's heap, in a |
60 // pre-order, depth first traversal. | 60 // pre-order, depth first traversal. |
61 void IterateObjects(Visitor* visitor); | 61 void IterateObjects(Visitor* visitor); |
62 | 62 |
63 // Like 'IterateObjects', but restricted to objects reachable from 'root' | 63 // Like 'IterateObjects', but restricted to objects reachable from 'root' |
64 // (including 'root' itself). | 64 // (including 'root' itself). |
65 void IterateObjectsFrom(const Object& root, Visitor* visitor); | 65 void IterateObjectsFrom(const Object& root, Visitor* visitor); |
66 | 66 |
(...skipping 27 matching lines...) Expand all Loading... |
94 // TODO(koda): Document format; support streaming/chunking. | 94 // TODO(koda): Document format; support streaming/chunking. |
95 intptr_t Serialize(WriteStream* stream); | 95 intptr_t Serialize(WriteStream* stream); |
96 | 96 |
97 private: | 97 private: |
98 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectGraph); | 98 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectGraph); |
99 }; | 99 }; |
100 | 100 |
101 } // namespace dart | 101 } // namespace dart |
102 | 102 |
103 #endif // VM_OBJECT_GRAPH_H_ | 103 #endif // VM_OBJECT_GRAPH_H_ |
OLD | NEW |