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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // Clears the list by setting the length to zero. Even if T is a | 142 // Clears the list by setting the length to zero. Even if T is a |
143 // pointer type, clearing the list doesn't delete the entries. | 143 // pointer type, clearing the list doesn't delete the entries. |
144 INLINE(void Clear()); | 144 INLINE(void Clear()); |
145 | 145 |
146 // Drops all but the first 'pos' elements from the list. | 146 // Drops all but the first 'pos' elements from the list. |
147 INLINE(void Rewind(int pos)); | 147 INLINE(void Rewind(int pos)); |
148 | 148 |
149 // Drop the last 'count' elements from the list. | 149 // Drop the last 'count' elements from the list. |
150 INLINE(void RewindBy(int count)) { Rewind(length_ - count); } | 150 INLINE(void RewindBy(int count)) { Rewind(length_ - count); } |
151 | 151 |
152 // Halve the capacity if fill level is less than a quarter. | |
153 INLINE(void Trim(AllocationPolicy allocator = AllocationPolicy())); | |
154 | |
155 bool Contains(const T& elm) const; | 152 bool Contains(const T& elm) const; |
156 int CountOccurrences(const T& elm, int start, int end) const; | 153 int CountOccurrences(const T& elm, int start, int end) const; |
157 | 154 |
158 // Iterate through all list entries, starting at index 0. | 155 // Iterate through all list entries, starting at index 0. |
159 void Iterate(void (*callback)(T* x)); | 156 void Iterate(void (*callback)(T* x)); |
160 template<class Visitor> | 157 template<class Visitor> |
161 void Iterate(Visitor* visitor); | 158 void Iterate(Visitor* visitor); |
162 | 159 |
163 // Sort all list entries (using QuickSort) | 160 // Sort all list entries (using QuickSort) |
164 void Sort(int (*cmp)(const T* x, const T* y)); | 161 void Sort(int (*cmp)(const T* x, const T* y)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 template <typename T, class P> | 206 template <typename T, class P> |
210 int SortedListBSearch(const List<T>& list, P cmp); | 207 int SortedListBSearch(const List<T>& list, P cmp); |
211 template <typename T> | 208 template <typename T> |
212 int SortedListBSearch(const List<T>& list, T elem); | 209 int SortedListBSearch(const List<T>& list, T elem); |
213 | 210 |
214 | 211 |
215 } } // namespace v8::internal | 212 } } // namespace v8::internal |
216 | 213 |
217 | 214 |
218 #endif // V8_LIST_H_ | 215 #endif // V8_LIST_H_ |
OLD | NEW |