OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_HEAP_H_ | 5 #ifndef VM_HEAP_H_ |
6 #define VM_HEAP_H_ | 6 #define VM_HEAP_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 // Heap contains the specified address. | 78 // Heap contains the specified address. |
79 bool Contains(uword addr) const; | 79 bool Contains(uword addr) const; |
80 bool CodeContains(uword addr) const; | 80 bool CodeContains(uword addr) const; |
81 | 81 |
82 // Visit all pointers in the space. | 82 // Visit all pointers in the space. |
83 void IterateNewPointers(ObjectPointerVisitor* visitor); | 83 void IterateNewPointers(ObjectPointerVisitor* visitor); |
84 void IterateOldPointers(ObjectPointerVisitor* visitor); | 84 void IterateOldPointers(ObjectPointerVisitor* visitor); |
85 void IterateCodePointers(ObjectPointerVisitor* visitor); | 85 void IterateCodePointers(ObjectPointerVisitor* visitor); |
86 | 86 |
| 87 // Find an object by visiting all pointers in the specified heap space, |
| 88 // the 'visitor' is used to determine if an object is found or not. |
| 89 // The 'visitor' function should be set up to return true if the |
| 90 // object is found, traversal through the heap space stops at that |
| 91 // point. |
| 92 // The 'visitor' function should return false if the object is not found, |
| 93 // traversal through the heap space continues. |
| 94 RawInstructions* FindObjectInCodeSpace(FindObjectVisitor* visitor); |
| 95 |
87 void CollectGarbage(Space space); | 96 void CollectGarbage(Space space); |
88 void CollectGarbage(Space space, ApiCallbacks api_callbacks); | 97 void CollectGarbage(Space space, ApiCallbacks api_callbacks); |
89 void CollectAllGarbage(); | 98 void CollectAllGarbage(); |
90 | 99 |
91 // Accessors for inlined allocation in generated code. | 100 // Accessors for inlined allocation in generated code. |
92 uword TopAddress(); | 101 uword TopAddress(); |
93 uword EndAddress(); | 102 uword EndAddress(); |
94 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } | 103 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } |
95 | 104 |
96 // Initialize the heap and register it with the isolate. | 105 // Initialize the heap and register it with the isolate. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 public: | 137 public: |
129 NoGCScope() {} | 138 NoGCScope() {} |
130 private: | 139 private: |
131 DISALLOW_COPY_AND_ASSIGN(NoGCScope); | 140 DISALLOW_COPY_AND_ASSIGN(NoGCScope); |
132 }; | 141 }; |
133 #endif // defined(DEBUG) | 142 #endif // defined(DEBUG) |
134 | 143 |
135 } // namespace dart | 144 } // namespace dart |
136 | 145 |
137 #endif // VM_HEAP_H_ | 146 #endif // VM_HEAP_H_ |
OLD | NEW |