Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: runtime/vm/growable_array.h

Issue 1220193009: Migrate most uses of Isolate::current_zone to Thread::zone. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/flow_graph_range_analysis.cc ('k') | runtime/vm/hash_map.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 VM_GROWABLE_ARRAY_H_
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 template<typename T> 155 template<typename T>
156 class GrowableArray : public BaseGrowableArray<T, ValueObject> { 156 class GrowableArray : public BaseGrowableArray<T, ValueObject> {
157 public: 157 public:
158 GrowableArray(Zone* zone, intptr_t initial_capacity) 158 GrowableArray(Zone* zone, intptr_t initial_capacity)
159 : BaseGrowableArray<T, ValueObject>( 159 : BaseGrowableArray<T, ValueObject>(
160 initial_capacity, ASSERT_NOTNULL(zone)) {} 160 initial_capacity, ASSERT_NOTNULL(zone)) {}
161 explicit GrowableArray(intptr_t initial_capacity) 161 explicit GrowableArray(intptr_t initial_capacity)
162 : BaseGrowableArray<T, ValueObject>( 162 : BaseGrowableArray<T, ValueObject>(
163 initial_capacity, 163 initial_capacity,
164 ASSERT_NOTNULL(Isolate::Current()->current_zone())) {} 164 ASSERT_NOTNULL(Thread::Current()->zone())) {}
165 GrowableArray() 165 GrowableArray()
166 : BaseGrowableArray<T, ValueObject>( 166 : BaseGrowableArray<T, ValueObject>(
167 ASSERT_NOTNULL(Isolate::Current()->current_zone())) {} 167 ASSERT_NOTNULL(Thread::Current()->zone())) {}
168 }; 168 };
169 169
170 170
171 template<typename T> 171 template<typename T>
172 class ZoneGrowableArray : public BaseGrowableArray<T, ZoneAllocated> { 172 class ZoneGrowableArray : public BaseGrowableArray<T, ZoneAllocated> {
173 public: 173 public:
174 ZoneGrowableArray(Zone* zone, intptr_t initial_capacity) 174 ZoneGrowableArray(Zone* zone, intptr_t initial_capacity)
175 : BaseGrowableArray<T, ZoneAllocated>( 175 : BaseGrowableArray<T, ZoneAllocated>(
176 initial_capacity, ASSERT_NOTNULL(zone)) {} 176 initial_capacity, ASSERT_NOTNULL(zone)) {}
177 explicit ZoneGrowableArray(intptr_t initial_capacity) 177 explicit ZoneGrowableArray(intptr_t initial_capacity)
178 : BaseGrowableArray<T, ZoneAllocated>( 178 : BaseGrowableArray<T, ZoneAllocated>(
179 initial_capacity, 179 initial_capacity,
180 ASSERT_NOTNULL(Isolate::Current()->current_zone())) {} 180 ASSERT_NOTNULL(Thread::Current()->zone())) {}
181 ZoneGrowableArray() 181 ZoneGrowableArray()
182 : BaseGrowableArray<T, ZoneAllocated>( 182 : BaseGrowableArray<T, ZoneAllocated>(
183 ASSERT_NOTNULL(Isolate::Current()->current_zone())) {} 183 ASSERT_NOTNULL(Thread::Current()->zone())) {}
184 }; 184 };
185 185
186 186
187 class Malloc : public AllStatic { 187 class Malloc : public AllStatic {
188 public: 188 public:
189 template <class T> 189 template <class T>
190 static inline T* Alloc(intptr_t len) { 190 static inline T* Alloc(intptr_t len) {
191 return reinterpret_cast<T*>(malloc(len * sizeof(T))); 191 return reinterpret_cast<T*>(malloc(len * sizeof(T)));
192 } 192 }
193 193
(...skipping 17 matching lines...) Expand all
211 public: 211 public:
212 explicit MallocGrowableArray(intptr_t initial_capacity) 212 explicit MallocGrowableArray(intptr_t initial_capacity)
213 : BaseGrowableArray<T, EmptyBase, Malloc>(initial_capacity, NULL) {} 213 : BaseGrowableArray<T, EmptyBase, Malloc>(initial_capacity, NULL) {}
214 MallocGrowableArray() 214 MallocGrowableArray()
215 : BaseGrowableArray<T, EmptyBase, Malloc>(NULL) {} 215 : BaseGrowableArray<T, EmptyBase, Malloc>(NULL) {}
216 }; 216 };
217 217
218 } // namespace dart 218 } // namespace dart
219 219
220 #endif // VM_GROWABLE_ARRAY_H_ 220 #endif // VM_GROWABLE_ARRAY_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_range_analysis.cc ('k') | runtime/vm/hash_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698