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

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

Issue 683433003: Integrate the Irregexp Regular Expression Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: more comments Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/il_printer.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 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return result; 53 return result;
54 } 54 }
55 55
56 T& operator[](intptr_t index) const { 56 T& operator[](intptr_t index) const {
57 ASSERT(0 <= index); 57 ASSERT(0 <= index);
58 ASSERT(index < length_); 58 ASSERT(index < length_);
59 ASSERT(length_ <= capacity_); 59 ASSERT(length_ <= capacity_);
60 return data_[index]; 60 return data_[index];
61 } 61 }
62 62
63 const T& At(intptr_t index) const {
64 return operator[](index);
65 }
66
63 T& Last() const { 67 T& Last() const {
64 ASSERT(length_ > 0); 68 ASSERT(length_ > 0);
65 return operator[](length_ - 1); 69 return operator[](length_ - 1);
66 } 70 }
67 71
68 void AddArray(const BaseGrowableArray<T, B>& src) { 72 void AddArray(const BaseGrowableArray<T, B>& src) {
69 for (intptr_t i = 0; i < src.length(); i++) { 73 for (intptr_t i = 0; i < src.length(); i++) {
70 Add(src[i]); 74 Add(src[i]);
71 } 75 }
72 } 76 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 initial_capacity, 165 initial_capacity,
162 Isolate::Current()->current_zone()) {} 166 Isolate::Current()->current_zone()) {}
163 ZoneGrowableArray() : 167 ZoneGrowableArray() :
164 BaseGrowableArray<T, ZoneAllocated>( 168 BaseGrowableArray<T, ZoneAllocated>(
165 Isolate::Current()->current_zone()) {} 169 Isolate::Current()->current_zone()) {}
166 }; 170 };
167 171
168 } // namespace dart 172 } // namespace dart
169 173
170 #endif // VM_GROWABLE_ARRAY_H_ 174 #endif // VM_GROWABLE_ARRAY_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698