| 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 <algorithm> | 8 #include <algorithm> | 
| 9 | 9 | 
| 10 #include "src/checks.h" | 10 #include "src/checks.h" | 
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 122   bool RemoveElement(const T& elm); | 122   bool RemoveElement(const T& elm); | 
| 123 | 123 | 
| 124   // Removes the last element without deleting it even if T is a | 124   // Removes the last element without deleting it even if T is a | 
| 125   // pointer type. Returns the removed element. | 125   // pointer type. Returns the removed element. | 
| 126   INLINE(T RemoveLast()) { return Remove(length_ - 1); } | 126   INLINE(T RemoveLast()) { return Remove(length_ - 1); } | 
| 127 | 127 | 
| 128   // Deletes current list contents and allocates space for 'length' elements. | 128   // Deletes current list contents and allocates space for 'length' elements. | 
| 129   INLINE(void Allocate(int length, | 129   INLINE(void Allocate(int length, | 
| 130                        AllocationPolicy allocator = AllocationPolicy())); | 130                        AllocationPolicy allocator = AllocationPolicy())); | 
| 131 | 131 | 
| 132   // Clears the list by setting the length to zero. Even if T is a | 132   // Clears the list by freeing the storage memory. If you want to keep the | 
|  | 133   // memory, use Rewind(0) instead. Be aware, that even if T is a | 
| 133   // pointer type, clearing the list doesn't delete the entries. | 134   // pointer type, clearing the list doesn't delete the entries. | 
| 134   INLINE(void Clear()); | 135   INLINE(void Clear()); | 
| 135 | 136 | 
| 136   // Drops all but the first 'pos' elements from the list. | 137   // Drops all but the first 'pos' elements from the list. | 
| 137   INLINE(void Rewind(int pos)); | 138   INLINE(void Rewind(int pos)); | 
| 138 | 139 | 
| 139   // Drop the last 'count' elements from the list. | 140   // Drop the last 'count' elements from the list. | 
| 140   INLINE(void RewindBy(int count)) { Rewind(length_ - count); } | 141   INLINE(void RewindBy(int count)) { Rewind(length_ - count); } | 
| 141 | 142 | 
| 142   // Swaps the contents of the two lists. | 143   // Swaps the contents of the two lists. | 
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 225 int SortedListBSearch(const List<T>& list, P cmp); | 226 int SortedListBSearch(const List<T>& list, P cmp); | 
| 226 template <typename T> | 227 template <typename T> | 
| 227 int SortedListBSearch(const List<T>& list, T elem); | 228 int SortedListBSearch(const List<T>& list, T elem); | 
| 228 | 229 | 
| 229 | 230 | 
| 230 }  // namespace internal | 231 }  // namespace internal | 
| 231 }  // namespace v8 | 232 }  // namespace v8 | 
| 232 | 233 | 
| 233 | 234 | 
| 234 #endif  // V8_LIST_H_ | 235 #endif  // V8_LIST_H_ | 
| OLD | NEW | 
|---|