| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 template<typename T, class P> | 207 template<typename T, class P> |
| 208 void List<T, P>::Sort(int (*cmp)(const T* x, const T* y)) { | 208 void List<T, P>::Sort(int (*cmp)(const T* x, const T* y)) { |
| 209 ToVector().Sort(cmp); | 209 ToVector().Sort(cmp); |
| 210 #ifdef DEBUG | 210 #ifdef DEBUG |
| 211 for (int i = 1; i < length_; i++) | 211 for (int i = 1; i < length_; i++) |
| 212 ASSERT(cmp(&data_[i - 1], &data_[i]) <= 0); | 212 ASSERT(cmp(&data_[i - 1], &data_[i]) <= 0); |
| 213 #endif | 213 #endif |
| 214 } | 214 } |
| 215 | 215 |
| 216 template<typename T, class P> |
| 217 void List<T, P>::SortBetter() { |
| 218 ToVector().SortBetter(); |
| 219 } |
| 220 |
| 216 | 221 |
| 217 template<typename T, class P> | 222 template<typename T, class P> |
| 218 void List<T, P>::Sort() { | 223 void List<T, P>::Sort() { |
| 219 Sort(PointerValueCompare<T>); | 224 Sort(PointerValueCompare<T>); |
| 220 } | 225 } |
| 221 | 226 |
| 222 | 227 |
| 223 template<typename T, class P> | 228 template<typename T, class P> |
| 224 void List<T, P>::Initialize(int capacity, P allocator) { | 229 void List<T, P>::Initialize(int capacity, P allocator) { |
| 225 ASSERT(capacity >= 0); | 230 ASSERT(capacity >= 0); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 271 |
| 267 template <typename T> | 272 template <typename T> |
| 268 int SortedListBSearch(const List<T>& list, T elem) { | 273 int SortedListBSearch(const List<T>& list, T elem) { |
| 269 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); | 274 return SortedListBSearch<T, ElementCmp<T> > (list, ElementCmp<T>(elem)); |
| 270 } | 275 } |
| 271 | 276 |
| 272 | 277 |
| 273 } } // namespace v8::internal | 278 } } // namespace v8::internal |
| 274 | 279 |
| 275 #endif // V8_LIST_INL_H_ | 280 #endif // V8_LIST_INL_H_ |
| OLD | NEW |