| 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 #include "vm/spaces.h" | 14 #include "vm/spaces.h" |
| 15 #include "vm/verifier.h" |
| 15 #include "vm/weak_table.h" | 16 #include "vm/weak_table.h" |
| 16 | 17 |
| 17 namespace dart { | 18 namespace dart { |
| 18 | 19 |
| 19 // Forward declarations. | 20 // Forward declarations. |
| 20 class Isolate; | 21 class Isolate; |
| 21 class ObjectPointerVisitor; | 22 class ObjectPointerVisitor; |
| 22 class ObjectSet; | 23 class ObjectSet; |
| 23 class VirtualMemory; | 24 class VirtualMemory; |
| 24 | 25 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 uword TopAddress(Space space); | 150 uword TopAddress(Space space); |
| 150 uword EndAddress(Space space); | 151 uword EndAddress(Space space); |
| 151 Space SpaceForAllocation(intptr_t class_id) const; | 152 Space SpaceForAllocation(intptr_t class_id) const; |
| 152 | 153 |
| 153 // Initialize the heap and register it with the isolate. | 154 // Initialize the heap and register it with the isolate. |
| 154 static void Init(Isolate* isolate, | 155 static void Init(Isolate* isolate, |
| 155 intptr_t max_new_gen_words, | 156 intptr_t max_new_gen_words, |
| 156 intptr_t max_old_gen_words); | 157 intptr_t max_old_gen_words); |
| 157 | 158 |
| 158 // Verify that all pointers in the heap point to the heap. | 159 // Verify that all pointers in the heap point to the heap. |
| 159 bool Verify() const; | 160 bool Verify(MarkExpectation mark_expectation = kForbidMarked) const; |
| 160 | 161 |
| 161 // Print heap sizes. | 162 // Print heap sizes. |
| 162 void PrintSizes() const; | 163 void PrintSizes() const; |
| 163 | 164 |
| 164 // Return amount of memory used and capacity in a space, excluding external. | 165 // Return amount of memory used and capacity in a space, excluding external. |
| 165 intptr_t UsedInWords(Space space) const; | 166 intptr_t UsedInWords(Space space) const; |
| 166 intptr_t CapacityInWords(Space space) const; | 167 intptr_t CapacityInWords(Space space) const; |
| 167 intptr_t ExternalInWords(Space space) const; | 168 intptr_t ExternalInWords(Space space) const; |
| 168 // Return the amount of GCing in microseconds. | 169 // Return the amount of GCing in microseconds. |
| 169 int64_t GCTimeInMicros(Space space) const; | 170 int64_t GCTimeInMicros(Space space) const; |
| 170 | 171 |
| 171 intptr_t Collections(Space space) const; | 172 intptr_t Collections(Space space) const; |
| 172 | 173 |
| 173 ObjectSet* CreateAllocatedObjectSet() const; | 174 ObjectSet* CreateAllocatedObjectSet(MarkExpectation mark_expectation) const; |
| 174 | 175 |
| 175 static const char* GCReasonToString(GCReason gc_reason); | 176 static const char* GCReasonToString(GCReason gc_reason); |
| 176 | 177 |
| 177 // Associate a peer with an object. A non-existent peer is equal to NULL. | 178 // Associate a peer with an object. A non-existent peer is equal to NULL. |
| 178 void SetPeer(RawObject* raw_obj, void* peer) { | 179 void SetPeer(RawObject* raw_obj, void* peer) { |
| 179 SetWeakEntry(raw_obj, kPeers, reinterpret_cast<intptr_t>(peer)); | 180 SetWeakEntry(raw_obj, kPeers, reinterpret_cast<intptr_t>(peer)); |
| 180 } | 181 } |
| 181 void* GetPeer(RawObject* raw_obj) const { | 182 void* GetPeer(RawObject* raw_obj) const { |
| 182 return reinterpret_cast<void*>(GetWeakEntry(raw_obj, kPeers)); | 183 return reinterpret_cast<void*>(GetWeakEntry(raw_obj, kPeers)); |
| 183 } | 184 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 NoHeapGrowthControlScope(); | 354 NoHeapGrowthControlScope(); |
| 354 ~NoHeapGrowthControlScope(); | 355 ~NoHeapGrowthControlScope(); |
| 355 private: | 356 private: |
| 356 bool current_growth_controller_state_; | 357 bool current_growth_controller_state_; |
| 357 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 358 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
| 358 }; | 359 }; |
| 359 | 360 |
| 360 } // namespace dart | 361 } // namespace dart |
| 361 | 362 |
| 362 #endif // VM_HEAP_H_ | 363 #endif // VM_HEAP_H_ |
| OLD | NEW |