Chromium Code Reviews| 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" |
| 11 #include "vm/globals.h" | 11 #include "vm/globals.h" |
| 12 #include "vm/pages.h" | 12 #include "vm/pages.h" |
| 13 #include "vm/scavenger.h" | 13 #include "vm/scavenger.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 // Forward declarations. | 17 // Forward declarations. |
| 18 class Isolate; | 18 class Isolate; |
| 19 class ObjectPointerVisitor; | 19 class ObjectPointerVisitor; |
| 20 class ObjectSet; | |
| 20 class VirtualMemory; | 21 class VirtualMemory; |
| 21 | 22 |
| 22 DECLARE_FLAG(bool, verbose_gc); | 23 DECLARE_FLAG(bool, verbose_gc); |
| 23 DECLARE_FLAG(bool, verify_before_gc); | 24 DECLARE_FLAG(bool, verify_before_gc); |
| 24 DECLARE_FLAG(bool, verify_after_gc); | 25 DECLARE_FLAG(bool, verify_after_gc); |
| 25 DECLARE_FLAG(bool, gc_at_alloc); | 26 DECLARE_FLAG(bool, gc_at_alloc); |
| 26 | 27 |
| 27 class Heap { | 28 class Heap { |
| 28 public: | 29 public: |
| 29 enum Space { | 30 enum Space { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 UNREACHABLE(); | 74 UNREACHABLE(); |
| 74 } | 75 } |
| 75 return 0; | 76 return 0; |
| 76 } | 77 } |
| 77 | 78 |
| 78 // Heap contains the specified address. | 79 // Heap contains the specified address. |
| 79 bool Contains(uword addr) const; | 80 bool Contains(uword addr) const; |
| 80 bool CodeContains(uword addr) const; | 81 bool CodeContains(uword addr) const; |
| 81 bool StubCodeContains(uword addr) const; | 82 bool StubCodeContains(uword addr) const; |
| 82 | 83 |
| 84 void VisitObjects(ObjectVisitor* visitor); | |
|
Ivan Posva
2012/06/29 22:20:41
It is unclear why these are named different. We al
cshapiro
2012/07/10 21:48:17
VisitObjects -> IterateObjects
VisitObjectPointers
| |
| 85 | |
| 86 void VisitObjectPointers(ObjectPointerVisitor* visitor); | |
| 87 | |
| 83 // Visit all pointers in the space. | 88 // Visit all pointers in the space. |
| 84 void IterateNewPointers(ObjectPointerVisitor* visitor); | 89 void IterateNewPointers(ObjectPointerVisitor* visitor); |
| 85 void IterateOldPointers(ObjectPointerVisitor* visitor); | 90 void IterateOldPointers(ObjectPointerVisitor* visitor); |
| 86 void IterateCodePointers(ObjectPointerVisitor* visitor); | 91 void IterateCodePointers(ObjectPointerVisitor* visitor); |
| 87 | 92 |
| 88 // Visit all object in the space. | 93 // Visit all object in the space. |
| 89 void IterateNewObjects(ObjectVisitor* visitor); | 94 void IterateNewObjects(ObjectVisitor* visitor); |
| 90 void IterateOldObjects(ObjectVisitor* visitor); | 95 void IterateOldObjects(ObjectVisitor* visitor); |
| 91 void IterateCodeObjects(ObjectVisitor* visitor); | 96 void IterateCodeObjects(ObjectVisitor* visitor); |
| 92 | 97 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 115 | 120 |
| 116 // Initialize the heap and register it with the isolate. | 121 // Initialize the heap and register it with the isolate. |
| 117 static void Init(Isolate* isolate); | 122 static void Init(Isolate* isolate); |
| 118 | 123 |
| 119 // Verify that all pointers in the heap point to the heap. | 124 // Verify that all pointers in the heap point to the heap. |
| 120 bool Verify() const; | 125 bool Verify() const; |
| 121 | 126 |
| 122 // Print heap sizes. | 127 // Print heap sizes. |
| 123 void PrintSizes() const; | 128 void PrintSizes() const; |
| 124 | 129 |
| 130 void StartEndAddress(uword* start, uword* end) const; | |
| 131 | |
| 132 ObjectSet* GetAllocatedObjects() const; | |
| 133 | |
| 125 // Generates a profile of the current and VM isolate heaps. | 134 // Generates a profile of the current and VM isolate heaps. |
| 126 void Profile(Dart_HeapProfileWriteCallback callback, void* stream) const; | 135 void Profile(Dart_HeapProfileWriteCallback callback, void* stream) const; |
| 127 | 136 |
| 128 private: | 137 private: |
| 129 Heap(); | 138 Heap(); |
| 130 | 139 |
| 131 uword AllocateNew(intptr_t size); | 140 uword AllocateNew(intptr_t size); |
| 132 uword AllocateOld(intptr_t size); | 141 uword AllocateOld(intptr_t size); |
| 133 uword AllocateCode(PageSpace* space, intptr_t size); | 142 uword AllocateCode(PageSpace* space, intptr_t size); |
| 134 | 143 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 154 public: | 163 public: |
| 155 NoGCScope() {} | 164 NoGCScope() {} |
| 156 private: | 165 private: |
| 157 DISALLOW_COPY_AND_ASSIGN(NoGCScope); | 166 DISALLOW_COPY_AND_ASSIGN(NoGCScope); |
| 158 }; | 167 }; |
| 159 #endif // defined(DEBUG) | 168 #endif // defined(DEBUG) |
| 160 | 169 |
| 161 } // namespace dart | 170 } // namespace dart |
| 162 | 171 |
| 163 #endif // VM_HEAP_H_ | 172 #endif // VM_HEAP_H_ |
| OLD | NEW |