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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 | 51 |
52 enum GCReason { | 52 enum GCReason { |
53 kNewSpace, | 53 kNewSpace, |
54 kPromotion, | 54 kPromotion, |
55 kOldSpace, | 55 kOldSpace, |
56 kFull, | 56 kFull, |
57 kGCAtAlloc, | 57 kGCAtAlloc, |
58 kGCTestCase, | 58 kGCTestCase, |
59 }; | 59 }; |
60 | 60 |
61 // Default allocation sizes in MB for the old gen and code heaps. | 61 // Default allocation sizes in MB for the code heap. |
62 static const intptr_t kHeapSizeInMWords = 128; | |
63 static const intptr_t kHeapSizeInMB = kHeapSizeInMWords * kWordSize; | |
64 static const intptr_t kCodeHeapSizeInMB = 18; | 62 static const intptr_t kCodeHeapSizeInMB = 18; |
Ivan Posva
2015/01/22 01:45:15
Where is kCodeHeapSizeInMB being used?
koda
2015/01/22 03:26:08
Nowhere! Remove.
| |
65 | 63 |
66 #if defined(DEBUG) | 64 #if defined(DEBUG) |
67 // Pattern for unused new space and swept old space. | 65 // Pattern for unused new space and swept old space. |
68 static const uint64_t kZap64Bits = 0xf3f3f3f3f3f3f3f3; | 66 static const uint64_t kZap64Bits = 0xf3f3f3f3f3f3f3f3; |
69 static const uint32_t kZap32Bits = static_cast<uint32_t>(kZap64Bits); | 67 static const uint32_t kZap32Bits = static_cast<uint32_t>(kZap64Bits); |
70 static const uint8_t kZapByte = static_cast<uint8_t>(kZap64Bits); | 68 static const uint8_t kZapByte = static_cast<uint8_t>(kZap64Bits); |
71 #endif // DEBUG | 69 #endif // DEBUG |
72 | 70 |
73 ~Heap(); | 71 ~Heap(); |
74 | 72 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 } | 152 } |
155 | 153 |
156 // Accessors for inlined allocation in generated code. | 154 // Accessors for inlined allocation in generated code. |
157 uword TopAddress(Space space); | 155 uword TopAddress(Space space); |
158 uword EndAddress(Space space); | 156 uword EndAddress(Space space); |
159 Space SpaceForAllocation(intptr_t class_id) const; | 157 Space SpaceForAllocation(intptr_t class_id) const; |
160 | 158 |
161 // Initialize the heap and register it with the isolate. | 159 // Initialize the heap and register it with the isolate. |
162 static void Init(Isolate* isolate, | 160 static void Init(Isolate* isolate, |
163 intptr_t max_new_gen_words, | 161 intptr_t max_new_gen_words, |
164 intptr_t max_old_gen_words); | 162 intptr_t max_old_gen_words, |
163 intptr_t max_external_words); | |
165 | 164 |
166 // Verify that all pointers in the heap point to the heap. | 165 // Verify that all pointers in the heap point to the heap. |
167 bool Verify(MarkExpectation mark_expectation = kForbidMarked) const; | 166 bool Verify(MarkExpectation mark_expectation = kForbidMarked) const; |
168 | 167 |
169 // Print heap sizes. | 168 // Print heap sizes. |
170 void PrintSizes() const; | 169 void PrintSizes() const; |
171 | 170 |
172 // Return amount of memory used and capacity in a space, excluding external. | 171 // Return amount of memory used and capacity in a space, excluding external. |
173 intptr_t UsedInWords(Space space) const; | 172 intptr_t UsedInWords(Space space) const; |
174 intptr_t CapacityInWords(Space space) const; | 173 intptr_t CapacityInWords(Space space) const; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 intptr_t data_[kDataEntries]; | 276 intptr_t data_[kDataEntries]; |
278 | 277 |
279 private: | 278 private: |
280 DISALLOW_COPY_AND_ASSIGN(GCStats); | 279 DISALLOW_COPY_AND_ASSIGN(GCStats); |
281 }; | 280 }; |
282 | 281 |
283 static const intptr_t kNewAllocatableSize = 256 * KB; | 282 static const intptr_t kNewAllocatableSize = 256 * KB; |
284 | 283 |
285 Heap(Isolate* isolate, | 284 Heap(Isolate* isolate, |
286 intptr_t max_new_gen_semi_words, // Max capacity of new semi-space. | 285 intptr_t max_new_gen_semi_words, // Max capacity of new semi-space. |
287 intptr_t max_old_gen_words); | 286 intptr_t max_old_gen_words, |
287 intptr_t max_external_words); | |
288 | 288 |
289 uword AllocateNew(intptr_t size); | 289 uword AllocateNew(intptr_t size); |
290 uword AllocateOld(intptr_t size, HeapPage::PageType type); | 290 uword AllocateOld(intptr_t size, HeapPage::PageType type); |
291 uword AllocatePretenured(intptr_t size); | 291 uword AllocatePretenured(intptr_t size); |
292 | 292 |
293 // GC stats collection. | 293 // GC stats collection. |
294 void RecordBeforeGC(Space space, GCReason reason); | 294 void RecordBeforeGC(Space space, GCReason reason); |
295 void RecordAfterGC(); | 295 void RecordAfterGC(); |
296 void PrintStats(); | 296 void PrintStats(); |
297 void UpdateClassHeapStatsBeforeGC(Heap::Space space); | 297 void UpdateClassHeapStatsBeforeGC(Heap::Space space); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
361 NoHeapGrowthControlScope(); | 361 NoHeapGrowthControlScope(); |
362 ~NoHeapGrowthControlScope(); | 362 ~NoHeapGrowthControlScope(); |
363 private: | 363 private: |
364 bool current_growth_controller_state_; | 364 bool current_growth_controller_state_; |
365 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 365 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
366 }; | 366 }; |
367 | 367 |
368 } // namespace dart | 368 } // namespace dart |
369 | 369 |
370 #endif // VM_HEAP_H_ | 370 #endif // VM_HEAP_H_ |
OLD | NEW |