| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| 11 #include "vm/pages.h" |
| 11 | 12 |
| 12 namespace dart { | 13 namespace dart { |
| 13 | 14 |
| 14 // Forward declarations. | 15 // Forward declarations. |
| 15 class Isolate; | 16 class Isolate; |
| 16 class ObjectPointerVisitor; | 17 class ObjectPointerVisitor; |
| 17 class PageSpace; | 18 class PageSpace; |
| 18 class Scavenger; | 19 class Scavenger; |
| 19 class VirtualMemory; | 20 class VirtualMemory; |
| 20 | 21 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 | 34 |
| 34 // Default allocation sizes in MB for the old gen and code heaps. | 35 // Default allocation sizes in MB for the old gen and code heaps. |
| 35 static const intptr_t kHeapSizeInMB = 512; | 36 static const intptr_t kHeapSizeInMB = 512; |
| 36 static const intptr_t kCodeHeapSizeInMB = 4; | 37 static const intptr_t kCodeHeapSizeInMB = 4; |
| 37 | 38 |
| 38 ~Heap(); | 39 ~Heap(); |
| 39 | 40 |
| 40 uword Allocate(intptr_t size, Space space) { | 41 uword Allocate(intptr_t size, Space space) { |
| 41 switch (space) { | 42 switch (space) { |
| 42 case kNew: | 43 case kNew: |
| 44 // Do not attempt to allocate very large objects in new space. |
| 45 if (!PageSpace::IsPageAllocatableSize(size)) { |
| 46 return AllocateOld(size); |
| 47 } |
| 43 return AllocateNew(size); | 48 return AllocateNew(size); |
| 44 case kOld: | 49 case kOld: |
| 45 return AllocateOld(size); | 50 return AllocateOld(size); |
| 46 case kExecutable: | 51 case kExecutable: |
| 47 return AllocateCode(size); | 52 return AllocateCode(size); |
| 48 default: | 53 default: |
| 49 UNREACHABLE(); | 54 UNREACHABLE(); |
| 50 } | 55 } |
| 51 return 0; | 56 return 0; |
| 52 } | 57 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 public: | 108 public: |
| 104 NoGCScope() {} | 109 NoGCScope() {} |
| 105 private: | 110 private: |
| 106 DISALLOW_COPY_AND_ASSIGN(NoGCScope); | 111 DISALLOW_COPY_AND_ASSIGN(NoGCScope); |
| 107 }; | 112 }; |
| 108 #endif // defined(DEBUG) | 113 #endif // defined(DEBUG) |
| 109 | 114 |
| 110 } // namespace dart | 115 } // namespace dart |
| 111 | 116 |
| 112 #endif // VM_HEAP_H_ | 117 #endif // VM_HEAP_H_ |
| OLD | NEW |