| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 explicit ObjectGraph(Thread* thread); | 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 void IterateObjectsFrom(intptr_t class_id, Visitor* visitor); |
| 66 | 67 |
| 67 // The number of bytes retained by 'obj'. | 68 // The number of bytes retained by 'obj'. |
| 68 intptr_t SizeRetainedByInstance(const Object& obj); | 69 intptr_t SizeRetainedByInstance(const Object& obj); |
| 70 intptr_t SizeReachableByInstance(const Object& obj); |
| 69 | 71 |
| 70 // The number of bytes retained by the set of all objects of the given class. | 72 // The number of bytes retained by the set of all objects of the given class. |
| 71 intptr_t SizeRetainedByClass(intptr_t class_id); | 73 intptr_t SizeRetainedByClass(intptr_t class_id); |
| 74 intptr_t SizeReachableByClass(intptr_t class_id); |
| 72 | 75 |
| 73 // Finds some retaining path from the isolate roots to 'obj'. Populates the | 76 // Finds some retaining path from the isolate roots to 'obj'. Populates the |
| 74 // provided array with pairs of (object, offset from parent in words), | 77 // provided array with pairs of (object, offset from parent in words), |
| 75 // starting with 'obj' itself, as far as there is room. Returns the number | 78 // starting with 'obj' itself, as far as there is room. Returns the number |
| 76 // of objects on the full path. A null input array behaves like a zero-length | 79 // of objects on the full path. A null input array behaves like a zero-length |
| 77 // input array. The 'offset' of a root is -1. | 80 // input array. The 'offset' of a root is -1. |
| 78 // | 81 // |
| 79 // To break the trivial path, the handle 'obj' is temporarily cleared during | 82 // To break the trivial path, the handle 'obj' is temporarily cleared during |
| 80 // the search, but restored before returning. If no path is found (i.e., the | 83 // the search, but restored before returning. If no path is found (i.e., the |
| 81 // provided handle was the only way to reach the object), zero is returned. | 84 // provided handle was the only way to reach the object), zero is returned. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 // TODO(koda): Document format; support streaming/chunking. | 97 // TODO(koda): Document format; support streaming/chunking. |
| 95 intptr_t Serialize(WriteStream* stream); | 98 intptr_t Serialize(WriteStream* stream); |
| 96 | 99 |
| 97 private: | 100 private: |
| 98 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectGraph); | 101 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectGraph); |
| 99 }; | 102 }; |
| 100 | 103 |
| 101 } // namespace dart | 104 } // namespace dart |
| 102 | 105 |
| 103 #endif // VM_OBJECT_GRAPH_H_ | 106 #endif // VM_OBJECT_GRAPH_H_ |
| OLD | NEW |