| 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: allocated on stack. | 5 // - GrowableArray: allocated on stack. |
| 6 // - ZoneGrowableArray: allocated in the zone. | 6 // - ZoneGrowableArray: allocated in the zone. |
| 7 // - MallocGrowableArray: allocates using malloc/realloc; free is only called | 7 // - MallocGrowableArray: allocates using malloc/realloc; free is only called |
| 8 // at destruction. | 8 // at destruction. |
| 9 | 9 |
| 10 #ifndef VM_GROWABLE_ARRAY_H_ | 10 #ifndef RUNTIME_VM_GROWABLE_ARRAY_H_ |
| 11 #define VM_GROWABLE_ARRAY_H_ | 11 #define RUNTIME_VM_GROWABLE_ARRAY_H_ |
| 12 | 12 |
| 13 #include "platform/utils.h" | 13 #include "platform/utils.h" |
| 14 #include "vm/allocation.h" | 14 #include "vm/allocation.h" |
| 15 #include "vm/isolate.h" | 15 #include "vm/isolate.h" |
| 16 #include "vm/zone.h" | 16 #include "vm/zone.h" |
| 17 | 17 |
| 18 namespace dart { | 18 namespace dart { |
| 19 | 19 |
| 20 template<typename T, typename B, typename Allocator = Zone> | 20 template<typename T, typename B, typename Allocator = Zone> |
| 21 class BaseGrowableArray : public B { | 21 class BaseGrowableArray : public B { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 class MallocGrowableArray : public BaseGrowableArray<T, EmptyBase, Malloc> { | 287 class MallocGrowableArray : public BaseGrowableArray<T, EmptyBase, Malloc> { |
| 288 public: | 288 public: |
| 289 explicit MallocGrowableArray(intptr_t initial_capacity) | 289 explicit MallocGrowableArray(intptr_t initial_capacity) |
| 290 : BaseGrowableArray<T, EmptyBase, Malloc>(initial_capacity, NULL) {} | 290 : BaseGrowableArray<T, EmptyBase, Malloc>(initial_capacity, NULL) {} |
| 291 MallocGrowableArray() | 291 MallocGrowableArray() |
| 292 : BaseGrowableArray<T, EmptyBase, Malloc>(NULL) {} | 292 : BaseGrowableArray<T, EmptyBase, Malloc>(NULL) {} |
| 293 }; | 293 }; |
| 294 | 294 |
| 295 } // namespace dart | 295 } // namespace dart |
| 296 | 296 |
| 297 #endif // VM_GROWABLE_ARRAY_H_ | 297 #endif // RUNTIME_VM_GROWABLE_ARRAY_H_ |
| OLD | NEW |