| 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 "src/checks.h" | 8 #include "src/checks.h" |
| 9 #include "src/utils.h" | 9 #include "src/utils.h" |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 typedef T* iterator; | 73 typedef T* iterator; |
| 74 inline iterator begin() const { return &data_[0]; } | 74 inline iterator begin() const { return &data_[0]; } |
| 75 inline iterator end() const { return &data_[length_]; } | 75 inline iterator end() const { return &data_[length_]; } |
| 76 | 76 |
| 77 INLINE(bool is_empty() const) { return length_ == 0; } | 77 INLINE(bool is_empty() const) { return length_ == 0; } |
| 78 INLINE(int length() const) { return length_; } | 78 INLINE(int length() const) { return length_; } |
| 79 INLINE(int capacity() const) { return capacity_; } | 79 INLINE(int capacity() const) { return capacity_; } |
| 80 | 80 |
| 81 Vector<T> ToVector() const { return Vector<T>(data_, length_); } | 81 Vector<T> ToVector() const { return Vector<T>(data_, length_); } |
| 82 | 82 |
| 83 Vector<const T> ToConstVector() const { | 83 Vector<const T> ToConstVector() { return Vector<const T>(data_, length_); } |
| 84 return Vector<const T>(data_, length_); | |
| 85 } | |
| 86 | 84 |
| 87 // Adds a copy of the given 'element' to the end of the list, | 85 // Adds a copy of the given 'element' to the end of the list, |
| 88 // expanding the list if necessary. | 86 // expanding the list if necessary. |
| 89 void Add(const T& element, AllocationPolicy allocator = AllocationPolicy()); | 87 void Add(const T& element, AllocationPolicy allocator = AllocationPolicy()); |
| 90 | 88 |
| 91 // Add all the elements from the argument list to this list. | 89 // Add all the elements from the argument list to this list. |
| 92 void AddAll(const List<T, AllocationPolicy>& other, | 90 void AddAll(const List<T, AllocationPolicy>& other, |
| 93 AllocationPolicy allocator = AllocationPolicy()); | 91 AllocationPolicy allocator = AllocationPolicy()); |
| 94 | 92 |
| 95 // Add all the elements from the vector to this list. | 93 // Add all the elements from the vector to this list. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 template <typename T, class P> | 206 template <typename T, class P> |
| 209 int SortedListBSearch(const List<T>& list, P cmp); | 207 int SortedListBSearch(const List<T>& list, P cmp); |
| 210 template <typename T> | 208 template <typename T> |
| 211 int SortedListBSearch(const List<T>& list, T elem); | 209 int SortedListBSearch(const List<T>& list, T elem); |
| 212 | 210 |
| 213 | 211 |
| 214 } } // namespace v8::internal | 212 } } // namespace v8::internal |
| 215 | 213 |
| 216 | 214 |
| 217 #endif // V8_LIST_H_ | 215 #endif // V8_LIST_H_ |
| OLD | NEW |