| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 } | 60 } |
| 61 | 61 |
| 62 INLINE(void* operator new(size_t size)) { | 62 INLINE(void* operator new(size_t size)) { |
| 63 return P::New(static_cast<int>(size)); | 63 return P::New(static_cast<int>(size)); |
| 64 } | 64 } |
| 65 INLINE(void operator delete(void* p, size_t)) { return P::Delete(p); } | 65 INLINE(void operator delete(void* p, size_t)) { return P::Delete(p); } |
| 66 | 66 |
| 67 // Returns a reference to the element at index i. This reference is | 67 // Returns a reference to the element at index i. This reference is |
| 68 // not safe to use after operations that can change the list's | 68 // not safe to use after operations that can change the list's |
| 69 // backing store (eg, Add). | 69 // backing store (eg, Add). |
| 70 inline T& operator[](int i) const { | 70 inline T& operator[](int i) const { |
| 71 ASSERT(0 <= i); | 71 ASSERT(0 <= i); |
| 72 ASSERT(i < length_); | 72 ASSERT(i < length_); |
| 73 return data_[i]; | 73 return data_[i]; |
| 74 } | 74 } |
| 75 inline T& at(int i) const { return operator[](i); } | 75 inline T& at(int i) const { return operator[](i); } |
| 76 inline T& last() const { return at(length_ - 1); } | 76 inline T& last() const { return at(length_ - 1); } |
| 77 inline T& first() const { return at(0); } | 77 inline T& first() const { return at(0); } |
| 78 | 78 |
| 79 INLINE(bool is_empty() const) { return length_ == 0; } | 79 INLINE(bool is_empty() const) { return length_ == 0; } |
| 80 INLINE(int length() const) { return length_; } | 80 INLINE(int length() const) { return length_; } |
| 81 INLINE(int capacity() const) { return capacity_; } | 81 INLINE(int capacity() const) { return capacity_; } |
| 82 | 82 |
| 83 Vector<T> ToVector() { return Vector<T>(data_, length_); } | 83 Vector<T> ToVector() { return Vector<T>(data_, length_); } |
| 84 | 84 |
| 85 Vector<const T> ToConstVector() { return Vector<const T>(data_, length_); } | 85 Vector<const T> ToConstVector() { return Vector<const T>(data_, length_); } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 // Add() is inlined, ResizeAdd() called by Add() is inlined except for | 153 // Add() is inlined, ResizeAdd() called by Add() is inlined except for |
| 154 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). | 154 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). |
| 155 template <> | 155 template <> |
| 156 void List<FrameElement, | 156 void List<FrameElement, |
| 157 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); | 157 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); |
| 158 | 158 |
| 159 } } // namespace v8::internal | 159 } } // namespace v8::internal |
| 160 | 160 |
| 161 #endif // V8_LIST_H_ | 161 #endif // V8_LIST_H_ |
| OLD | NEW |