| 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_; } | 65 Scavenger* new_space() const { return new_space_; } |
| 66 PageSpace* old_space() { return old_space_; } | 66 PageSpace* old_space() const { return old_space_; } |
| 67 | 67 |
| 68 uword Allocate(intptr_t size, Space space) { | 68 uword Allocate(intptr_t size, Space space) { |
| 69 ASSERT(!read_only_); | 69 ASSERT(!read_only_); |
| 70 switch (space) { | 70 switch (space) { |
| 71 case kNew: | 71 case kNew: |
| 72 // Do not attempt to allocate very large objects in new space. | 72 // Do not attempt to allocate very large objects in new space. |
| 73 if (!IsAllocatableInNewSpace(size)) { | 73 if (!IsAllocatableInNewSpace(size)) { |
| 74 return AllocateOld(size, HeapPage::kData); | 74 return AllocateOld(size, HeapPage::kData); |
| 75 } | 75 } |
| 76 return AllocateNew(size); | 76 return AllocateNew(size); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 NoHeapGrowthControlScope(); | 344 NoHeapGrowthControlScope(); |
| 345 ~NoHeapGrowthControlScope(); | 345 ~NoHeapGrowthControlScope(); |
| 346 private: | 346 private: |
| 347 bool current_growth_controller_state_; | 347 bool current_growth_controller_state_; |
| 348 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 348 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
| 349 }; | 349 }; |
| 350 | 350 |
| 351 } // namespace dart | 351 } // namespace dart |
| 352 | 352 |
| 353 #endif // VM_HEAP_H_ | 353 #endif // VM_HEAP_H_ |
| OLD | NEW |