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); | |
153 void Sort(int (*cmp)(const T* x, const T* y)); | 152 void Sort(int (*cmp)(const T* x, const T* y)); |
154 void Sort(); | 153 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(); | |
159 | 154 |
160 INLINE(void Initialize(int capacity, | 155 INLINE(void Initialize(int capacity, |
161 AllocationPolicy allocator = AllocationPolicy())); | 156 AllocationPolicy allocator = AllocationPolicy())); |
162 | 157 |
163 private: | 158 private: |
164 T* data_; | 159 T* data_; |
165 int capacity_; | 160 int capacity_; |
166 int length_; | 161 int length_; |
167 | 162 |
168 INLINE(T* NewData(int n, AllocationPolicy allocator)) { | 163 INLINE(T* NewData(int n, AllocationPolicy allocator)) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 template <typename T, class P> | 208 template <typename T, class P> |
214 int SortedListBSearch(const List<T>& list, P cmp); | 209 int SortedListBSearch(const List<T>& list, P cmp); |
215 template <typename T> | 210 template <typename T> |
216 int SortedListBSearch(const List<T>& list, T elem); | 211 int SortedListBSearch(const List<T>& list, T elem); |
217 | 212 |
218 | 213 |
219 } } // namespace v8::internal | 214 } } // namespace v8::internal |
220 | 215 |
221 | 216 |
222 #endif // V8_LIST_H_ | 217 #endif // V8_LIST_H_ |
OLD | NEW |