| 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 // Defines growable array classes, that differ where they are allocated: | 4 // Defines growable array classes, that differ where they are allocated: |
| 5 // - GrowableArray: allocate on stack. | 5 // - GrowableArray: allocate on stack. |
| 6 // - ZoneGrowableArray: allocated in the zone. | 6 // - ZoneGrowableArray: allocated in the zone. |
| 7 | 7 |
| 8 #ifndef VM_GROWABLE_ARRAY_H_ | 8 #ifndef VM_GROWABLE_ARRAY_H_ |
| 9 #define VM_GROWABLE_ARRAY_H_ | 9 #define VM_GROWABLE_ARRAY_H_ |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 length_ = new_length; | 116 length_ = new_length; |
| 117 } | 117 } |
| 118 | 118 |
| 119 | 119 |
| 120 template<typename T> | 120 template<typename T> |
| 121 class GrowableArray : public BaseGrowableArray<T, ValueObject> { | 121 class GrowableArray : public BaseGrowableArray<T, ValueObject> { |
| 122 public: | 122 public: |
| 123 explicit GrowableArray(int initial_capacity) | 123 explicit GrowableArray(int initial_capacity) |
| 124 : BaseGrowableArray<T, ValueObject>( | 124 : BaseGrowableArray<T, ValueObject>( |
| 125 initial_capacity, | 125 initial_capacity, |
| 126 Isolate::Current()->current_zone()->GetBaseZone()) {} | 126 Isolate::Current()->current_zone()) {} |
| 127 GrowableArray() | 127 GrowableArray() |
| 128 : BaseGrowableArray<T, ValueObject>( | 128 : BaseGrowableArray<T, ValueObject>( |
| 129 Isolate::Current()->current_zone()->GetBaseZone()) {} | 129 Isolate::Current()->current_zone()) {} |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 | 132 |
| 133 template<typename T> | 133 template<typename T> |
| 134 class ZoneGrowableArray : public BaseGrowableArray<T, ZoneAllocated> { | 134 class ZoneGrowableArray : public BaseGrowableArray<T, ZoneAllocated> { |
| 135 public: | 135 public: |
| 136 explicit ZoneGrowableArray(int initial_capacity) | 136 explicit ZoneGrowableArray(int initial_capacity) |
| 137 : BaseGrowableArray<T, ZoneAllocated>( | 137 : BaseGrowableArray<T, ZoneAllocated>( |
| 138 initial_capacity, | 138 initial_capacity, |
| 139 Isolate::Current()->current_zone()->GetBaseZone()) {} | 139 Isolate::Current()->current_zone()) {} |
| 140 ZoneGrowableArray() : | 140 ZoneGrowableArray() : |
| 141 BaseGrowableArray<T, ZoneAllocated>( | 141 BaseGrowableArray<T, ZoneAllocated>( |
| 142 Isolate::Current()->current_zone()->GetBaseZone()) {} | 142 Isolate::Current()->current_zone()) {} |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace dart | 145 } // namespace dart |
| 146 | 146 |
| 147 #endif // VM_GROWABLE_ARRAY_H_ | 147 #endif // VM_GROWABLE_ARRAY_H_ |
| OLD | NEW |