| 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 |
| 152 bool Contains(const T& elm) const; | 155 bool Contains(const T& elm) const; |
| 153 int CountOccurrences(const T& elm, int start, int end) const; | 156 int CountOccurrences(const T& elm, int start, int end) const; |
| 154 | 157 |
| 155 // Iterate through all list entries, starting at index 0. | 158 // Iterate through all list entries, starting at index 0. |
| 156 void Iterate(void (*callback)(T* x)); | 159 void Iterate(void (*callback)(T* x)); |
| 157 template<class Visitor> | 160 template<class Visitor> |
| 158 void Iterate(Visitor* visitor); | 161 void Iterate(Visitor* visitor); |
| 159 | 162 |
| 160 // Sort all list entries (using QuickSort) | 163 // Sort all list entries (using QuickSort) |
| 161 void Sort(int (*cmp)(const T* x, const T* y)); | 164 void Sort(int (*cmp)(const T* x, const T* y)); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 template <typename T, class P> | 209 template <typename T, class P> |
| 207 int SortedListBSearch(const List<T>& list, P cmp); | 210 int SortedListBSearch(const List<T>& list, P cmp); |
| 208 template <typename T> | 211 template <typename T> |
| 209 int SortedListBSearch(const List<T>& list, T elem); | 212 int SortedListBSearch(const List<T>& list, T elem); |
| 210 | 213 |
| 211 | 214 |
| 212 } } // namespace v8::internal | 215 } } // namespace v8::internal |
| 213 | 216 |
| 214 | 217 |
| 215 #endif // V8_LIST_H_ | 218 #endif // V8_LIST_H_ |
| OLD | NEW |