OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_H_ | 5 #ifndef V8_LIST_H_ |
6 #define V8_LIST_H_ | 6 #define V8_LIST_H_ |
7 | 7 |
8 #include "src/checks.h" | 8 #include "src/checks.h" |
9 #include "src/utils.h" | 9 #include "src/utils.h" |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 bool Contains(const T& elm) const; | 143 bool Contains(const T& elm) const; |
144 int CountOccurrences(const T& elm, int start, int end) const; | 144 int CountOccurrences(const T& elm, int start, int end) const; |
145 | 145 |
146 // Iterate through all list entries, starting at index 0. | 146 // Iterate through all list entries, starting at index 0. |
147 void Iterate(void (*callback)(T* x)); | 147 void Iterate(void (*callback)(T* x)); |
148 template<class Visitor> | 148 template<class Visitor> |
149 void Iterate(Visitor* visitor); | 149 void Iterate(Visitor* visitor); |
150 | 150 |
151 // Sort all list entries (using QuickSort) | 151 // Sort all list entries (using QuickSort) |
| 152 void Sort(int (*cmp)(const T* x, const T* y), size_t start, size_t length); |
152 void Sort(int (*cmp)(const T* x, const T* y)); | 153 void Sort(int (*cmp)(const T* x, const T* y)); |
153 void Sort(); | 154 void Sort(); |
| 155 void StableSort(int (*cmp)(const T* x, const T* y), size_t start, |
| 156 size_t length); |
| 157 void StableSort(int (*cmp)(const T* x, const T* y)); |
| 158 void StableSort(); |
154 | 159 |
155 INLINE(void Initialize(int capacity, | 160 INLINE(void Initialize(int capacity, |
156 AllocationPolicy allocator = AllocationPolicy())); | 161 AllocationPolicy allocator = AllocationPolicy())); |
157 | 162 |
158 private: | 163 private: |
159 T* data_; | 164 T* data_; |
160 int capacity_; | 165 int capacity_; |
161 int length_; | 166 int length_; |
162 | 167 |
163 INLINE(T* NewData(int n, AllocationPolicy allocator)) { | 168 INLINE(T* NewData(int n, AllocationPolicy allocator)) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 template <typename T, class P> | 213 template <typename T, class P> |
209 int SortedListBSearch(const List<T>& list, P cmp); | 214 int SortedListBSearch(const List<T>& list, P cmp); |
210 template <typename T> | 215 template <typename T> |
211 int SortedListBSearch(const List<T>& list, T elem); | 216 int SortedListBSearch(const List<T>& list, T elem); |
212 | 217 |
213 | 218 |
214 } } // namespace v8::internal | 219 } } // namespace v8::internal |
215 | 220 |
216 | 221 |
217 #endif // V8_LIST_H_ | 222 #endif // V8_LIST_H_ |
OLD | NEW |