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

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

Issue 10939036: 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() { 76 void Remove(intptr_t idx) {
77 ASSERT(length_ > 0); 77 ASSERT(length_ > idx);
78 length_--; 78 length_--;
79 for (int i = 0; i < length_; i++) { 79 for (int i = idx; i < length_; i++) {
80 data_[i] = data_[i + 1]; 80 data_[i] = data_[i + 1];
81 } 81 }
82 } 82 }
83 83
84 void InsertAt(intptr_t idx, const T& value) { 84 void InsertAt(intptr_t idx, const T& value) {
85 Resize(length() + 1); 85 Resize(length() + 1);
86 for (intptr_t i = length_ - 2; i >= idx; i--) { 86 for (intptr_t i = length_ - 2; i >= idx; i--) {
87 data_[i + 1] = data_[i]; 87 data_[i + 1] = data_[i];
88 } 88 }
89 data_[idx] = value; 89 data_[idx] = value;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 initial_capacity, 146 initial_capacity,
147 Isolate::Current()->current_zone()->GetBaseZone()) {} 147 Isolate::Current()->current_zone()->GetBaseZone()) {}
148 ZoneGrowableArray() : 148 ZoneGrowableArray() :
149 BaseGrowableArray<T, ZoneAllocated>( 149 BaseGrowableArray<T, ZoneAllocated>(
150 Isolate::Current()->current_zone()->GetBaseZone()) {} 150 Isolate::Current()->current_zone()->GetBaseZone()) {}
151 }; 151 };
152 152
153 } // namespace dart 153 } // namespace dart
154 154
155 #endif // VM_GROWABLE_ARRAY_H_ 155 #endif // VM_GROWABLE_ARRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698