OLD | NEW |
---|---|
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_LIST_INL_H_ | 5 #ifndef V8_LIST_INL_H_ |
6 #define V8_LIST_INL_H_ | 6 #define V8_LIST_INL_H_ |
7 | 7 |
8 #include "src/list.h" | 8 #include "src/list.h" |
9 | 9 |
10 #include "src/base/macros.h" | 10 #include "src/base/macros.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 | 134 |
135 template<typename T, class P> | 135 template<typename T, class P> |
136 void List<T, P>::Allocate(int length, P allocator) { | 136 void List<T, P>::Allocate(int length, P allocator) { |
137 DeleteData(data_); | 137 DeleteData(data_); |
138 Initialize(length, allocator); | 138 Initialize(length, allocator); |
139 length_ = length; | 139 length_ = length; |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 template<typename T, class P> | 143 template<typename T, class P> |
144 void List<T, P>::Clear() { | 144 void List<T, P>::Clear() { |
jgruber
2016/10/04 11:23:32
Is this left over from local experiments? Clear sh
| |
145 DeleteData(data_); | |
146 // We don't call Initialize(0) since that requires passing a Zone, | |
147 // which we don't really need. | |
148 data_ = NULL; | |
149 capacity_ = 0; | |
150 length_ = 0; | 145 length_ = 0; |
151 } | 146 } |
152 | 147 |
153 | 148 |
154 template<typename T, class P> | 149 template<typename T, class P> |
155 void List<T, P>::Rewind(int pos) { | 150 void List<T, P>::Rewind(int pos) { |
156 DCHECK(0 <= pos && pos <= length_); | 151 DCHECK(0 <= pos && pos <= length_); |
157 length_ = pos; | 152 length_ = pos; |
158 } | 153 } |
159 | 154 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 template <typename T> | 278 template <typename T> |
284 int SortedListBSearch(const List<T>& list, T elem) { | 279 int SortedListBSearch(const List<T>& list, T elem) { |
285 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); | 280 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); |
286 } | 281 } |
287 | 282 |
288 | 283 |
289 } // namespace internal | 284 } // namespace internal |
290 } // namespace v8 | 285 } // namespace v8 |
291 | 286 |
292 #endif // V8_LIST_INL_H_ | 287 #endif // V8_LIST_INL_H_ |
OLD | NEW |