| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Please the MSVC compiler. We should never have to execute this. | 56 // Please the MSVC compiler. We should never have to execute this. |
| 57 INLINE(void operator delete(void* p, AllocationPolicy allocator)) { | 57 INLINE(void operator delete(void* p, AllocationPolicy allocator)) { |
| 58 UNREACHABLE(); | 58 UNREACHABLE(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Returns a reference to the element at index i. This reference is | 61 // Returns a reference to the element at index i. This reference is |
| 62 // not safe to use after operations that can change the list's | 62 // not safe to use after operations that can change the list's |
| 63 // backing store (e.g. Add). | 63 // backing store (e.g. Add). |
| 64 inline T& operator[](int i) const { | 64 inline T& operator[](int i) const { |
| 65 DCHECK(0 <= i); | 65 DCHECK(0 <= i); |
| 66 SLOW_DCHECK(i < length_); | 66 SLOW_DCHECK(static_cast<unsigned>(i) < static_cast<unsigned>(length_)); |
| 67 return data_[i]; | 67 return data_[i]; |
| 68 } | 68 } |
| 69 inline T& at(int i) const { return operator[](i); } | 69 inline T& at(int i) const { return operator[](i); } |
| 70 inline T& last() const { return at(length_ - 1); } | 70 inline T& last() const { return at(length_ - 1); } |
| 71 inline T& first() const { return at(0); } | 71 inline T& first() const { return at(0); } |
| 72 | 72 |
| 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 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 template <typename T, class P> | 208 template <typename T, class P> |
| 209 int SortedListBSearch(const List<T>& list, P cmp); | 209 int SortedListBSearch(const List<T>& list, P cmp); |
| 210 template <typename T> | 210 template <typename T> |
| 211 int SortedListBSearch(const List<T>& list, T elem); | 211 int SortedListBSearch(const List<T>& list, T elem); |
| 212 | 212 |
| 213 | 213 |
| 214 } } // namespace v8::internal | 214 } } // namespace v8::internal |
| 215 | 215 |
| 216 | 216 |
| 217 #endif // V8_LIST_H_ | 217 #endif // V8_LIST_H_ |
| OLD | NEW |