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

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

Issue 1314363003: More cleanups in compiler (remove allocation in new space). (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | runtime/vm/intermediate_language.cc » ('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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 T& operator[](intptr_t index) const { 210 T& operator[](intptr_t index) const {
211 return *array_[index]; 211 return *array_[index];
212 } 212 }
213 213
214 const T& At(intptr_t index) const { 214 const T& At(intptr_t index) const {
215 return operator[](index); 215 return operator[](index);
216 } 216 }
217 217
218 void SetAt(intptr_t index, const T& t) {
219 array_[index] = &T::ZoneHandle(zone_, t.raw());
220 }
221
218 intptr_t length() const { return array_.length(); } 222 intptr_t length() const { return array_.length(); }
219 223
220 const GrowableArray<T*>& growable_array() const { return array_; } 224 const GrowableArray<T*>& growable_array() const { return array_; }
221 225
222 private: 226 private:
223 Zone* zone_; 227 Zone* zone_;
224 GrowableArray<T*> array_; 228 GrowableArray<T*> array_;
225 229
226 DISALLOW_COPY_AND_ASSIGN(BaseGrowableHandlePtrArray); 230 DISALLOW_COPY_AND_ASSIGN(BaseGrowableHandlePtrArray);
227 }; 231 };
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 public: 277 public:
274 explicit MallocGrowableArray(intptr_t initial_capacity) 278 explicit MallocGrowableArray(intptr_t initial_capacity)
275 : BaseGrowableArray<T, EmptyBase, Malloc>(initial_capacity, NULL) {} 279 : BaseGrowableArray<T, EmptyBase, Malloc>(initial_capacity, NULL) {}
276 MallocGrowableArray() 280 MallocGrowableArray()
277 : BaseGrowableArray<T, EmptyBase, Malloc>(NULL) {} 281 : BaseGrowableArray<T, EmptyBase, Malloc>(NULL) {}
278 }; 282 };
279 283
280 } // namespace dart 284 } // namespace dart
281 285
282 #endif // VM_GROWABLE_ARRAY_H_ 286 #endif // VM_GROWABLE_ARRAY_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698