| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 case kOld: | 66 case kOld: |
| 67 return AllocateOld(size, HeapPage::kData); | 67 return AllocateOld(size, HeapPage::kData); |
| 68 case kCode: | 68 case kCode: |
| 69 return AllocateOld(size, HeapPage::kExecutable); | 69 return AllocateOld(size, HeapPage::kExecutable); |
| 70 default: | 70 default: |
| 71 UNREACHABLE(); | 71 UNREACHABLE(); |
| 72 } | 72 } |
| 73 return 0; | 73 return 0; |
| 74 } | 74 } |
| 75 | 75 |
| 76 uword TryAllocate(intptr_t size, Space space) { | 76 uword TryAllocate( |
| 77 intptr_t size, |
| 78 Space space, |
| 79 PageSpace::GrowthPolicy growth_policy = PageSpace::kControlGrowth) { |
| 77 ASSERT(!read_only_); | 80 ASSERT(!read_only_); |
| 78 switch (space) { | 81 switch (space) { |
| 79 case kNew: | 82 case kNew: |
| 80 return new_space_->TryAllocate(size); | 83 return new_space_->TryAllocate(size); |
| 81 case kOld: | 84 case kOld: |
| 82 return old_space_->TryAllocate(size, HeapPage::kData); | 85 return old_space_->TryAllocate(size, |
| 86 HeapPage::kData, |
| 87 growth_policy); |
| 83 case kCode: | 88 case kCode: |
| 84 return old_space_->TryAllocate(size, HeapPage::kExecutable); | 89 return old_space_->TryAllocate(size, |
| 90 HeapPage::kExecutable, |
| 91 growth_policy); |
| 85 default: | 92 default: |
| 86 UNREACHABLE(); | 93 UNREACHABLE(); |
| 87 } | 94 } |
| 88 return 0; | 95 return 0; |
| 89 } | 96 } |
| 90 | 97 |
| 91 // Heap contains the specified address. | 98 // Heap contains the specified address. |
| 92 bool Contains(uword addr) const; | 99 bool Contains(uword addr) const; |
| 93 bool NewContains(uword addr) const; | 100 bool NewContains(uword addr) const; |
| 94 bool OldContains(uword addr) const; | 101 bool OldContains(uword addr) const; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 public: | 203 public: |
| 197 NoGCScope() {} | 204 NoGCScope() {} |
| 198 private: | 205 private: |
| 199 DISALLOW_COPY_AND_ASSIGN(NoGCScope); | 206 DISALLOW_COPY_AND_ASSIGN(NoGCScope); |
| 200 }; | 207 }; |
| 201 #endif // defined(DEBUG) | 208 #endif // defined(DEBUG) |
| 202 | 209 |
| 203 } // namespace dart | 210 } // namespace dart |
| 204 | 211 |
| 205 #endif // VM_HEAP_H_ | 212 #endif // VM_HEAP_H_ |
| OLD | NEW |