| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 case kCode: | 95 case kCode: |
| 96 return old_space_->TryAllocate(size, | 96 return old_space_->TryAllocate(size, |
| 97 HeapPage::kExecutable, | 97 HeapPage::kExecutable, |
| 98 growth_policy); | 98 growth_policy); |
| 99 default: | 99 default: |
| 100 UNREACHABLE(); | 100 UNREACHABLE(); |
| 101 } | 101 } |
| 102 return 0; | 102 return 0; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Track external data. |
| 106 void AllocateExternal(intptr_t size, Space space); |
| 107 void FreeExternal(intptr_t size, Space space); |
| 108 |
| 105 // Heap contains the specified address. | 109 // Heap contains the specified address. |
| 106 bool Contains(uword addr) const; | 110 bool Contains(uword addr) const; |
| 107 bool NewContains(uword addr) const; | 111 bool NewContains(uword addr) const; |
| 108 bool OldContains(uword addr) const; | 112 bool OldContains(uword addr) const; |
| 109 bool CodeContains(uword addr) const; | 113 bool CodeContains(uword addr) const; |
| 110 bool StubCodeContains(uword addr) const; | 114 bool StubCodeContains(uword addr) const; |
| 111 | 115 |
| 112 // Visit all pointers. | 116 // Visit all pointers. |
| 113 void IteratePointers(ObjectPointerVisitor* visitor); | 117 void IteratePointers(ObjectPointerVisitor* visitor); |
| 114 | 118 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 159 |
| 156 // Initialize the heap and register it with the isolate. | 160 // Initialize the heap and register it with the isolate. |
| 157 static void Init(Isolate* isolate); | 161 static void Init(Isolate* isolate); |
| 158 | 162 |
| 159 // Verify that all pointers in the heap point to the heap. | 163 // Verify that all pointers in the heap point to the heap. |
| 160 bool Verify() const; | 164 bool Verify() const; |
| 161 | 165 |
| 162 // Print heap sizes. | 166 // Print heap sizes. |
| 163 void PrintSizes() const; | 167 void PrintSizes() const; |
| 164 | 168 |
| 165 // Return amount of memory used and capacity in a space. | 169 // Return amount of memory used and capacity in a space, excluding external. |
| 166 intptr_t UsedInWords(Space space) const; | 170 intptr_t UsedInWords(Space space) const; |
| 167 intptr_t CapacityInWords(Space space) const; | 171 intptr_t CapacityInWords(Space space) const; |
| 172 intptr_t ExternalInWords(Space space) const; |
| 168 // Return the amount of GCing in microseconds. | 173 // Return the amount of GCing in microseconds. |
| 169 int64_t GCTimeInMicros(Space space) const; | 174 int64_t GCTimeInMicros(Space space) const; |
| 170 | 175 |
| 171 intptr_t Collections(Space space) const; | 176 intptr_t Collections(Space space) const; |
| 172 // Returns the [lowest, highest) addresses in the heap. | 177 // Returns the [lowest, highest) addresses in the heap. |
| 173 void StartEndAddress(uword* start, uword* end) const; | 178 void StartEndAddress(uword* start, uword* end) const; |
| 174 | 179 |
| 175 ObjectSet* CreateAllocatedObjectSet() const; | 180 ObjectSet* CreateAllocatedObjectSet() const; |
| 176 | 181 |
| 177 static const char* GCReasonToString(GCReason gc_reason); | 182 static const char* GCReasonToString(GCReason gc_reason); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 NoHeapGrowthControlScope(); | 329 NoHeapGrowthControlScope(); |
| 325 ~NoHeapGrowthControlScope(); | 330 ~NoHeapGrowthControlScope(); |
| 326 private: | 331 private: |
| 327 bool current_growth_controller_state_; | 332 bool current_growth_controller_state_; |
| 328 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 333 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
| 329 }; | 334 }; |
| 330 | 335 |
| 331 } // namespace dart | 336 } // namespace dart |
| 332 | 337 |
| 333 #endif // VM_HEAP_H_ | 338 #endif // VM_HEAP_H_ |
| OLD | NEW |