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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 Isolate::Current()->current_zone()) {} | 128 Isolate::Current()->current_zone()) {} |
129 GrowableArray() | 129 GrowableArray() |
130 : BaseGrowableArray<T, ValueObject>( | 130 : BaseGrowableArray<T, ValueObject>( |
131 Isolate::Current()->current_zone()) {} | 131 Isolate::Current()->current_zone()) {} |
132 }; | 132 }; |
133 | 133 |
134 | 134 |
135 template<typename T> | 135 template<typename T> |
136 class ZoneGrowableArray : public BaseGrowableArray<T, ZoneAllocated> { | 136 class ZoneGrowableArray : public BaseGrowableArray<T, ZoneAllocated> { |
137 public: | 137 public: |
| 138 ZoneGrowableArray(Isolate* isolate, intptr_t initial_capacity) |
| 139 : BaseGrowableArray<T, ZoneAllocated>( |
| 140 initial_capacity, isolate->current_zone()) {} |
138 explicit ZoneGrowableArray(intptr_t initial_capacity) | 141 explicit ZoneGrowableArray(intptr_t initial_capacity) |
139 : BaseGrowableArray<T, ZoneAllocated>( | 142 : BaseGrowableArray<T, ZoneAllocated>( |
140 initial_capacity, | 143 initial_capacity, |
141 Isolate::Current()->current_zone()) {} | 144 Isolate::Current()->current_zone()) {} |
142 ZoneGrowableArray() : | 145 ZoneGrowableArray() : |
143 BaseGrowableArray<T, ZoneAllocated>( | 146 BaseGrowableArray<T, ZoneAllocated>( |
144 Isolate::Current()->current_zone()) {} | 147 Isolate::Current()->current_zone()) {} |
145 }; | 148 }; |
146 | 149 |
147 } // namespace dart | 150 } // namespace dart |
148 | 151 |
149 #endif // VM_GROWABLE_ARRAY_H_ | 152 #endif // VM_GROWABLE_ARRAY_H_ |
OLD | NEW |