OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // pointer type, clearing the list doesn't delete the entries. | 110 // pointer type, clearing the list doesn't delete the entries. |
111 INLINE(void Clear()); | 111 INLINE(void Clear()); |
112 | 112 |
113 // Drops all but the first 'pos' elements from the list. | 113 // Drops all but the first 'pos' elements from the list. |
114 INLINE(void Rewind(int pos)); | 114 INLINE(void Rewind(int pos)); |
115 | 115 |
116 bool Contains(const T& elm); | 116 bool Contains(const T& elm); |
117 | 117 |
118 // Iterate through all list entries, starting at index 0. | 118 // Iterate through all list entries, starting at index 0. |
119 void Iterate(void (*callback)(T* x)); | 119 void Iterate(void (*callback)(T* x)); |
| 120 template<class Visitor> |
| 121 void Iterate(Visitor* visitor); |
120 | 122 |
121 // Sort all list entries (using QuickSort) | 123 // Sort all list entries (using QuickSort) |
122 void Sort(int (*cmp)(const T* x, const T* y)); | 124 void Sort(int (*cmp)(const T* x, const T* y)); |
123 void Sort(); | 125 void Sort(); |
124 | 126 |
125 INLINE(void Initialize(int capacity)); | 127 INLINE(void Initialize(int capacity)); |
126 | 128 |
127 private: | 129 private: |
128 T* data_; | 130 T* data_; |
129 int capacity_; | 131 int capacity_; |
(...skipping 20 matching lines...) Expand all Loading... |
150 | 152 |
151 // Add() is inlined, ResizeAdd() called by Add() is inlined except for | 153 // Add() is inlined, ResizeAdd() called by Add() is inlined except for |
152 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). | 154 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). |
153 template <> | 155 template <> |
154 void List<FrameElement, | 156 void List<FrameElement, |
155 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); | 157 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); |
156 | 158 |
157 } } // namespace v8::internal | 159 } } // namespace v8::internal |
158 | 160 |
159 #endif // V8_LIST_H_ | 161 #endif // V8_LIST_H_ |
OLD | NEW |