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

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

Issue 10956013: Reapply "A simpler scheme for garbage collection of ureachable phi inputs." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
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: 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void AddArray(const BaseGrowableArray<T, B>& src) { 66 void AddArray(const BaseGrowableArray<T, B>& src) {
67 for (intptr_t i = 0; i < src.length(); i++) { 67 for (intptr_t i = 0; i < src.length(); i++) {
68 Add(src[i]); 68 Add(src[i]);
69 } 69 }
70 } 70 }
71 71
72 void Clear() { 72 void Clear() {
73 length_ = 0; 73 length_ = 0;
74 } 74 }
75 75
76 void RemoveFirst() {
77 ASSERT(length_ > 0);
78 length_--;
79 for (int i = 0; i < length_; i++) {
80 data_[i] = data_[i + 1];
81 }
82 }
83
84 void InsertAt(intptr_t idx, const T& value) { 76 void InsertAt(intptr_t idx, const T& value) {
85 Resize(length() + 1); 77 Resize(length() + 1);
86 for (intptr_t i = length_ - 2; i >= idx; i--) { 78 for (intptr_t i = length_ - 2; i >= idx; i--) {
87 data_[i + 1] = data_[i]; 79 data_[i + 1] = data_[i];
88 } 80 }
89 data_[idx] = value; 81 data_[idx] = value;
90 } 82 }
91 83
92 // Sort the array in place. 84 // Sort the array in place.
93 inline void Sort(int compare(const T*, const T*)); 85 inline void Sort(int compare(const T*, const T*));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 initial_capacity, 138 initial_capacity,
147 Isolate::Current()->current_zone()->GetBaseZone()) {} 139 Isolate::Current()->current_zone()->GetBaseZone()) {}
148 ZoneGrowableArray() : 140 ZoneGrowableArray() :
149 BaseGrowableArray<T, ZoneAllocated>( 141 BaseGrowableArray<T, ZoneAllocated>(
150 Isolate::Current()->current_zone()->GetBaseZone()) {} 142 Isolate::Current()->current_zone()->GetBaseZone()) {}
151 }; 143 };
152 144
153 } // namespace dart 145 } // namespace dart
154 146
155 #endif // VM_GROWABLE_ARRAY_H_ 147 #endif // VM_GROWABLE_ARRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698