| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // Please the MSVC compiler. We should never have to execute this. | 58 // Please the MSVC compiler. We should never have to execute this. |
| 59 INLINE(void operator delete(void* p, AllocationPolicy allocator)) { | 59 INLINE(void operator delete(void* p, AllocationPolicy allocator)) { |
| 60 UNREACHABLE(); | 60 UNREACHABLE(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Returns a reference to the element at index i. This reference is | 63 // Returns a reference to the element at index i. This reference is |
| 64 // not safe to use after operations that can change the list's | 64 // not safe to use after operations that can change the list's |
| 65 // backing store (e.g. Add). | 65 // backing store (e.g. Add). |
| 66 inline T& operator[](int i) const { | 66 inline T& operator[](int i) const { |
| 67 DCHECK_LE(0, i); | 67 DCHECK_LE(0, i); |
| 68 DCHECK_GT(length_, i); | 68 DCHECK_GT(static_cast<unsigned>(length_), static_cast<unsigned>(i)); |
| 69 return data_[i]; | 69 return data_[i]; |
| 70 } | 70 } |
| 71 inline T& at(int i) const { return operator[](i); } | 71 inline T& at(int i) const { return operator[](i); } |
| 72 inline T& last() const { return at(length_ - 1); } | 72 inline T& last() const { return at(length_ - 1); } |
| 73 inline T& first() const { return at(0); } | 73 inline T& first() const { return at(0); } |
| 74 | 74 |
| 75 typedef T* iterator; | 75 typedef T* iterator; |
| 76 inline iterator begin() const { return &data_[0]; } | 76 inline iterator begin() const { return &data_[0]; } |
| 77 inline iterator end() const { return &data_[length_]; } | 77 inline iterator end() const { return &data_[length_]; } |
| 78 | 78 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 int SortedListBSearch(const List<T>& list, P cmp); | 226 int SortedListBSearch(const List<T>& list, P cmp); |
| 227 template <typename T> | 227 template <typename T> |
| 228 int SortedListBSearch(const List<T>& list, T elem); | 228 int SortedListBSearch(const List<T>& list, T elem); |
| 229 | 229 |
| 230 | 230 |
| 231 } // namespace internal | 231 } // namespace internal |
| 232 } // namespace v8 | 232 } // namespace v8 |
| 233 | 233 |
| 234 | 234 |
| 235 #endif // V8_LIST_H_ | 235 #endif // V8_LIST_H_ |
| OLD | NEW |