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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 old gen and code heaps. |
62 static const intptr_t kHeapSizeInMWords = 128; | 62 static const intptr_t kHeapSizeInMWords = 128; |
63 static const intptr_t kHeapSizeInMB = kHeapSizeInMWords * kWordSize; | 63 static const intptr_t kHeapSizeInMB = kHeapSizeInMWords * kWordSize; |
64 static const intptr_t kCodeHeapSizeInMB = 18; | 64 static const intptr_t kCodeHeapSizeInMB = 18; |
65 | 65 |
| 66 #if defined(DEBUG) |
| 67 // Pattern for unused new space and swept old space. |
| 68 static const uint64_t kZap64Bits = 0xf3f3f3f3f3f3f3f3; |
| 69 static const uint32_t kZap32Bits = static_cast<uint32_t>(kZap64Bits); |
| 70 static const uint8_t kZapByte = static_cast<uint8_t>(kZap64Bits); |
| 71 #endif // DEBUG |
| 72 |
66 ~Heap(); | 73 ~Heap(); |
67 | 74 |
68 Scavenger* new_space() const { return new_space_; } | 75 Scavenger* new_space() const { return new_space_; } |
69 PageSpace* old_space() const { return old_space_; } | 76 PageSpace* old_space() const { return old_space_; } |
70 | 77 |
71 uword Allocate(intptr_t size, Space space) { | 78 uword Allocate(intptr_t size, Space space) { |
72 ASSERT(!read_only_); | 79 ASSERT(!read_only_); |
73 switch (space) { | 80 switch (space) { |
74 case kNew: | 81 case kNew: |
75 // Do not attempt to allocate very large objects in new space. | 82 // Do not attempt to allocate very large objects in new space. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 NoHeapGrowthControlScope(); | 361 NoHeapGrowthControlScope(); |
355 ~NoHeapGrowthControlScope(); | 362 ~NoHeapGrowthControlScope(); |
356 private: | 363 private: |
357 bool current_growth_controller_state_; | 364 bool current_growth_controller_state_; |
358 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 365 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
359 }; | 366 }; |
360 | 367 |
361 } // namespace dart | 368 } // namespace dart |
362 | 369 |
363 #endif // VM_HEAP_H_ | 370 #endif // VM_HEAP_H_ |
OLD | NEW |