| 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() { return Vector<const T>(data_, length_); } | 83 Vector<const T> ToConstVector() const { |
| 84 return Vector<const T>(data_, length_); |
| 85 } |
| 84 | 86 |
| 85 // Adds a copy of the given 'element' to the end of the list, | 87 // Adds a copy of the given 'element' to the end of the list, |
| 86 // expanding the list if necessary. | 88 // expanding the list if necessary. |
| 87 void Add(const T& element, AllocationPolicy allocator = AllocationPolicy()); | 89 void Add(const T& element, AllocationPolicy allocator = AllocationPolicy()); |
| 88 | 90 |
| 89 // Add all the elements from the argument list to this list. | 91 // Add all the elements from the argument list to this list. |
| 90 void AddAll(const List<T, AllocationPolicy>& other, | 92 void AddAll(const List<T, AllocationPolicy>& other, |
| 91 AllocationPolicy allocator = AllocationPolicy()); | 93 AllocationPolicy allocator = AllocationPolicy()); |
| 92 | 94 |
| 93 // Add all the elements from the vector to this list. | 95 // Add all the elements from the vector to this list. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 template <typename T, class P> | 208 template <typename T, class P> |
| 207 int SortedListBSearch(const List<T>& list, P cmp); | 209 int SortedListBSearch(const List<T>& list, P cmp); |
| 208 template <typename T> | 210 template <typename T> |
| 209 int SortedListBSearch(const List<T>& list, T elem); | 211 int SortedListBSearch(const List<T>& list, T elem); |
| 210 | 212 |
| 211 | 213 |
| 212 } } // namespace v8::internal | 214 } } // namespace v8::internal |
| 213 | 215 |
| 214 | 216 |
| 215 #endif // V8_LIST_H_ | 217 #endif // V8_LIST_H_ |
| OLD | NEW |