| 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_); |
| 169 length_ = pos; | 170 length_ = pos; |
| 170 } | 171 } |
| 171 | 172 |
| 172 | 173 |
| 173 template<typename T, class P> | 174 template<typename T, class P> |
| 174 void List<T, P>::Trim(P alloc) { | 175 void List<T, P>::Trim(P alloc) { |
| 175 if (length_ < capacity_ / 4) { | 176 if (length_ < capacity_ / 4) { |
| 176 Resize(capacity_ / 2, alloc); | 177 Resize(capacity_ / 2, alloc); |
| 177 } | 178 } |
| 178 } | 179 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 274 |
| 274 template <typename T> | 275 template <typename T> |
| 275 int SortedListBSearch(const List<T>& list, T elem) { | 276 int SortedListBSearch(const List<T>& list, T elem) { |
| 276 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); | 277 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); |
| 277 } | 278 } |
| 278 | 279 |
| 279 | 280 |
| 280 } } // namespace v8::internal | 281 } } // namespace v8::internal |
| 281 | 282 |
| 282 #endif // V8_LIST_INL_H_ | 283 #endif // V8_LIST_INL_H_ |
| OLD | NEW |