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 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // We don't call Initialize(0) since that requires passing a Zone, | 159 // We don't call Initialize(0) since that requires passing a Zone, |
160 // which we don't really need. | 160 // which we don't really need. |
161 data_ = NULL; | 161 data_ = NULL; |
162 capacity_ = 0; | 162 capacity_ = 0; |
163 length_ = 0; | 163 length_ = 0; |
164 } | 164 } |
165 | 165 |
166 | 166 |
167 template<typename T, class P> | 167 template<typename T, class P> |
168 void List<T, P>::Rewind(int pos) { | 168 void List<T, P>::Rewind(int pos) { |
169 ASSERT(pos <= length_); | |
170 length_ = pos; | 169 length_ = pos; |
171 } | 170 } |
172 | 171 |
173 | 172 |
174 template<typename T, class P> | 173 template<typename T, class P> |
175 void List<T, P>::Trim(P alloc) { | 174 void List<T, P>::Trim(P alloc) { |
176 if (length_ < capacity_ / 4) { | 175 if (length_ < capacity_ / 4) { |
177 Resize(capacity_ / 2, alloc); | 176 Resize(capacity_ / 2, alloc); |
178 } | 177 } |
179 } | 178 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 273 |
275 template <typename T> | 274 template <typename T> |
276 int SortedListBSearch(const List<T>& list, T elem) { | 275 int SortedListBSearch(const List<T>& list, T elem) { |
277 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); | 276 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); |
278 } | 277 } |
279 | 278 |
280 | 279 |
281 } } // namespace v8::internal | 280 } } // namespace v8::internal |
282 | 281 |
283 #endif // V8_LIST_INL_H_ | 282 #endif // V8_LIST_INL_H_ |
OLD | NEW |