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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 kGCTestCase, | 55 kGCTestCase, |
56 }; | 56 }; |
57 | 57 |
58 // Default allocation sizes in MB for the old gen and code heaps. | 58 // Default allocation sizes in MB for the old gen and code heaps. |
59 static const intptr_t kHeapSizeInMWords = 128; | 59 static const intptr_t kHeapSizeInMWords = 128; |
60 static const intptr_t kHeapSizeInMB = kHeapSizeInMWords * kWordSize; | 60 static const intptr_t kHeapSizeInMB = kHeapSizeInMWords * kWordSize; |
61 static const intptr_t kCodeHeapSizeInMB = 18; | 61 static const intptr_t kCodeHeapSizeInMB = 18; |
62 | 62 |
63 ~Heap(); | 63 ~Heap(); |
64 | 64 |
| 65 Scavenger* new_space() { return new_space_; } |
| 66 PageSpace* old_space() { return old_space_; } |
| 67 |
65 uword Allocate(intptr_t size, Space space) { | 68 uword Allocate(intptr_t size, Space space) { |
66 ASSERT(!read_only_); | 69 ASSERT(!read_only_); |
67 switch (space) { | 70 switch (space) { |
68 case kNew: | 71 case kNew: |
69 // Do not attempt to allocate very large objects in new space. | 72 // Do not attempt to allocate very large objects in new space. |
70 if (!IsAllocatableInNewSpace(size)) { | 73 if (!IsAllocatableInNewSpace(size)) { |
71 return AllocateOld(size, HeapPage::kData); | 74 return AllocateOld(size, HeapPage::kData); |
72 } | 75 } |
73 return AllocateNew(size); | 76 return AllocateNew(size); |
74 case kOld: | 77 case kOld: |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 NoHeapGrowthControlScope(); | 366 NoHeapGrowthControlScope(); |
364 ~NoHeapGrowthControlScope(); | 367 ~NoHeapGrowthControlScope(); |
365 private: | 368 private: |
366 bool current_growth_controller_state_; | 369 bool current_growth_controller_state_; |
367 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 370 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
368 }; | 371 }; |
369 | 372 |
370 } // namespace dart | 373 } // namespace dart |
371 | 374 |
372 #endif // VM_HEAP_H_ | 375 #endif // VM_HEAP_H_ |
OLD | NEW |