| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 | 202 |
| 203 template<typename T, class P> | 203 template<typename T, class P> |
| 204 size_t GetMemoryUsedByList(const List<T, P>& list) { | 204 size_t GetMemoryUsedByList(const List<T, P>& list) { |
| 205 return list.length() * sizeof(T) + sizeof(list); | 205 return list.length() * sizeof(T) + sizeof(list); |
| 206 } | 206 } |
| 207 | 207 |
| 208 | 208 |
| 209 class Map; | 209 class Map; |
| 210 template<class> class TypeImpl; | 210 class FieldType; |
| 211 struct HeapTypeConfig; | |
| 212 typedef TypeImpl<HeapTypeConfig> HeapType; | |
| 213 class Code; | 211 class Code; |
| 214 template<typename T> class Handle; | 212 template<typename T> class Handle; |
| 215 typedef List<Map*> MapList; | 213 typedef List<Map*> MapList; |
| 216 typedef List<Code*> CodeList; | 214 typedef List<Code*> CodeList; |
| 217 typedef List<Handle<Map> > MapHandleList; | 215 typedef List<Handle<Map> > MapHandleList; |
| 218 typedef List<Handle<HeapType> > TypeHandleList; | 216 typedef List<Handle<FieldType> > TypeHandleList; |
| 219 typedef List<Handle<Code> > CodeHandleList; | 217 typedef List<Handle<Code> > CodeHandleList; |
| 220 | 218 |
| 221 // Perform binary search for an element in an already sorted | 219 // Perform binary search for an element in an already sorted |
| 222 // list. Returns the index of the element of -1 if it was not found. | 220 // list. Returns the index of the element of -1 if it was not found. |
| 223 // |cmp| is a predicate that takes a pointer to an element of the List | 221 // |cmp| is a predicate that takes a pointer to an element of the List |
| 224 // and returns +1 if it is greater, -1 if it is less than the element | 222 // and returns +1 if it is greater, -1 if it is less than the element |
| 225 // being searched. | 223 // being searched. |
| 226 template <typename T, class P> | 224 template <typename T, class P> |
| 227 int SortedListBSearch(const List<T>& list, P cmp); | 225 int SortedListBSearch(const List<T>& list, P cmp); |
| 228 template <typename T> | 226 template <typename T> |
| 229 int SortedListBSearch(const List<T>& list, T elem); | 227 int SortedListBSearch(const List<T>& list, T elem); |
| 230 | 228 |
| 231 | 229 |
| 232 } // namespace internal | 230 } // namespace internal |
| 233 } // namespace v8 | 231 } // namespace v8 |
| 234 | 232 |
| 235 | 233 |
| 236 #endif // V8_LIST_H_ | 234 #endif // V8_LIST_H_ |
| OLD | NEW |