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" |
| (...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. The 'ref' pointer is only used to determine which | |
| 106 // space to use. Non-heap and VM heap objects are charged to old space. | |
| 107 void AllocateExternal(intptr_t size, RawObject* ref); | |
|
Ivan Posva
2014/03/05 21:21:23
Do we allow non-heap objects (aka Smis) do be used
koda
2014/03/05 21:52:08
Yes, I believe we do. See my test WeakPersistentHa
| |
| 108 void FreeExternal(intptr_t size, RawObject* ref); | |
| 109 | |
| 105 // Heap contains the specified address. | 110 // Heap contains the specified address. |
| 106 bool Contains(uword addr) const; | 111 bool Contains(uword addr) const; |
| 107 bool NewContains(uword addr) const; | 112 bool NewContains(uword addr) const; |
| 108 bool OldContains(uword addr) const; | 113 bool OldContains(uword addr) const; |
| 109 bool CodeContains(uword addr) const; | 114 bool CodeContains(uword addr) const; |
| 110 bool StubCodeContains(uword addr) const; | 115 bool StubCodeContains(uword addr) const; |
| 111 | 116 |
| 112 // Visit all pointers. | 117 // Visit all pointers. |
| 113 void IteratePointers(ObjectPointerVisitor* visitor); | 118 void IteratePointers(ObjectPointerVisitor* visitor); |
| 114 | 119 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 | 160 |
| 156 // Initialize the heap and register it with the isolate. | 161 // Initialize the heap and register it with the isolate. |
| 157 static void Init(Isolate* isolate); | 162 static void Init(Isolate* isolate); |
| 158 | 163 |
| 159 // Verify that all pointers in the heap point to the heap. | 164 // Verify that all pointers in the heap point to the heap. |
| 160 bool Verify() const; | 165 bool Verify() const; |
| 161 | 166 |
| 162 // Print heap sizes. | 167 // Print heap sizes. |
| 163 void PrintSizes() const; | 168 void PrintSizes() const; |
| 164 | 169 |
| 165 // Return amount of memory used and capacity in a space. | 170 // Return amount of memory used and capacity in a space, including external. |
| 166 intptr_t UsedInWords(Space space) const; | 171 intptr_t UsedInWords(Space space) const; |
| 167 intptr_t CapacityInWords(Space space) const; | 172 intptr_t CapacityInWords(Space space) const; |
| 173 intptr_t ExternalAllocatedInWords(Space space) const; | |
|
Ivan Posva
2014/03/05 21:21:23
How about ExternalInWords?
koda
2014/03/05 21:52:08
Done.
| |
| 168 // Return the amount of GCing in microseconds. | 174 // Return the amount of GCing in microseconds. |
| 169 int64_t GCTimeInMicros(Space space) const; | 175 int64_t GCTimeInMicros(Space space) const; |
| 170 | 176 |
| 171 intptr_t Collections(Space space) const; | 177 intptr_t Collections(Space space) const; |
| 172 // Returns the [lowest, highest) addresses in the heap. | 178 // Returns the [lowest, highest) addresses in the heap. |
| 173 void StartEndAddress(uword* start, uword* end) const; | 179 void StartEndAddress(uword* start, uword* end) const; |
| 174 | 180 |
| 175 ObjectSet* CreateAllocatedObjectSet() const; | 181 ObjectSet* CreateAllocatedObjectSet() const; |
| 176 | 182 |
| 177 static const char* GCReasonToString(GCReason gc_reason); | 183 static const char* GCReasonToString(GCReason gc_reason); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 NoHeapGrowthControlScope(); | 331 NoHeapGrowthControlScope(); |
| 326 ~NoHeapGrowthControlScope(); | 332 ~NoHeapGrowthControlScope(); |
| 327 private: | 333 private: |
| 328 bool current_growth_controller_state_; | 334 bool current_growth_controller_state_; |
| 329 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 335 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
| 330 }; | 336 }; |
| 331 | 337 |
| 332 } // namespace dart | 338 } // namespace dart |
| 333 | 339 |
| 334 #endif // VM_HEAP_H_ | 340 #endif // VM_HEAP_H_ |
| OLD | NEW |