| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 int CountOccurrences(const T& elm, int start, int end) const; | 156 int CountOccurrences(const T& elm, int start, int end) const; |
| 157 | 157 |
| 158 // Iterate through all list entries, starting at index 0. | 158 // Iterate through all list entries, starting at index 0. |
| 159 void Iterate(void (*callback)(T* x)); | 159 void Iterate(void (*callback)(T* x)); |
| 160 template<class Visitor> | 160 template<class Visitor> |
| 161 void Iterate(Visitor* visitor); | 161 void Iterate(Visitor* visitor); |
| 162 | 162 |
| 163 // Sort all list entries (using QuickSort) | 163 // Sort all list entries (using QuickSort) |
| 164 void Sort(int (*cmp)(const T* x, const T* y)); | 164 void Sort(int (*cmp)(const T* x, const T* y)); |
| 165 void Sort(); | 165 void Sort(); |
| 166 void SortBetter(); |
| 166 | 167 |
| 167 INLINE(void Initialize(int capacity, | 168 INLINE(void Initialize(int capacity, |
| 168 AllocationPolicy allocator = AllocationPolicy())); | 169 AllocationPolicy allocator = AllocationPolicy())); |
| 169 | 170 |
| 170 private: | 171 private: |
| 171 T* data_; | 172 T* data_; |
| 172 int capacity_; | 173 int capacity_; |
| 173 int length_; | 174 int length_; |
| 174 | 175 |
| 175 INLINE(T* NewData(int n, AllocationPolicy allocator)) { | 176 INLINE(T* NewData(int n, AllocationPolicy allocator)) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 template <typename T, class P> | 210 template <typename T, class P> |
| 210 int SortedListBSearch(const List<T>& list, P cmp); | 211 int SortedListBSearch(const List<T>& list, P cmp); |
| 211 template <typename T> | 212 template <typename T> |
| 212 int SortedListBSearch(const List<T>& list, T elem); | 213 int SortedListBSearch(const List<T>& list, T elem); |
| 213 | 214 |
| 214 | 215 |
| 215 } } // namespace v8::internal | 216 } } // namespace v8::internal |
| 216 | 217 |
| 217 | 218 |
| 218 #endif // V8_LIST_H_ | 219 #endif // V8_LIST_H_ |
| OLD | NEW |