| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 && i < length_); | 71 ASSERT(0 <= i); |
| 72 ASSERT(i < length_); |
| 72 return data_[i]; | 73 return data_[i]; |
| 73 } | 74 } |
| 74 inline T& at(int i) const { return operator[](i); } | 75 inline T& at(int i) const { return operator[](i); } |
| 75 inline T& last() const { return at(length_ - 1); } | 76 inline T& last() const { return at(length_ - 1); } |
| 76 inline T& first() const { return at(0); } | 77 inline T& first() const { return at(0); } |
| 77 | 78 |
| 78 INLINE(bool is_empty() const) { return length_ == 0; } | 79 INLINE(bool is_empty() const) { return length_ == 0; } |
| 79 INLINE(int length() const) { return length_; } | 80 INLINE(int length() const) { return length_; } |
| 80 INLINE(int capacity() const) { return capacity_; } | 81 INLINE(int capacity() const) { return capacity_; } |
| 81 | 82 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 150 |
| 150 // Add() is inlined, ResizeAdd() called by Add() is inlined except for | 151 // Add() is inlined, ResizeAdd() called by Add() is inlined except for |
| 151 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). | 152 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). |
| 152 template <> | 153 template <> |
| 153 void List<FrameElement, | 154 void List<FrameElement, |
| 154 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); | 155 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); |
| 155 | 156 |
| 156 } } // namespace v8::internal | 157 } } // namespace v8::internal |
| 157 | 158 |
| 158 #endif // V8_LIST_H_ | 159 #endif // V8_LIST_H_ |
| OLD | NEW |