OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 Initialize(0); | 60 Initialize(0); |
61 } | 61 } |
62 | 62 |
63 INLINE(void* operator new(size_t size)) { | 63 INLINE(void* operator new(size_t size)) { |
64 return P::New(static_cast<int>(size)); | 64 return P::New(static_cast<int>(size)); |
65 } | 65 } |
66 INLINE(void operator delete(void* p, size_t)) { return P::Delete(p); } | 66 INLINE(void operator delete(void* p, size_t)) { return P::Delete(p); } |
67 | 67 |
68 // Returns a reference to the element at index i. This reference is | 68 // Returns a reference to the element at index i. This reference is |
69 // not safe to use after operations that can change the list's | 69 // not safe to use after operations that can change the list's |
70 // backing store (eg, Add). | 70 // backing store (e.g. Add). |
71 inline T& operator[](int i) const { | 71 inline T& operator[](int i) const { |
72 ASSERT(0 <= i); | 72 ASSERT(0 <= i); |
73 ASSERT(i < length_); | 73 ASSERT(i < length_); |
74 return data_[i]; | 74 return data_[i]; |
75 } | 75 } |
76 inline T& at(int i) const { return operator[](i); } | 76 inline T& at(int i) const { return operator[](i); } |
77 inline T& last() const { return at(length_ - 1); } | 77 inline T& last() const { return at(length_ - 1); } |
78 inline T& first() const { return at(0); } | 78 inline T& first() const { return at(0); } |
79 | 79 |
80 INLINE(bool is_empty() const) { return length_ == 0; } | 80 INLINE(bool is_empty() const) { return length_ == 0; } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 int SortedListBSearch( | 177 int SortedListBSearch( |
178 const List<T>& list, T elem, int (*cmp)(const T* x, const T* y)); | 178 const List<T>& list, T elem, int (*cmp)(const T* x, const T* y)); |
179 template <typename T> | 179 template <typename T> |
180 int SortedListBSearch(const List<T>& list, T elem); | 180 int SortedListBSearch(const List<T>& list, T elem); |
181 | 181 |
182 | 182 |
183 } } // namespace v8::internal | 183 } } // namespace v8::internal |
184 | 184 |
185 | 185 |
186 #endif // V8_LIST_H_ | 186 #endif // V8_LIST_H_ |
OLD | NEW |