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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 INLINE(explicit List(int capacity)) { Initialize(capacity); } | 52 INLINE(explicit List(int capacity)) { Initialize(capacity); } |
53 INLINE(~List()) { DeleteData(data_); } | 53 INLINE(~List()) { DeleteData(data_); } |
54 | 54 |
55 // Deallocates memory used by the list and leaves the list in a consistent | 55 // Deallocates memory used by the list and leaves the list in a consistent |
56 // empty state. | 56 // empty state. |
57 void Free() { | 57 void Free() { |
58 DeleteData(data_); | 58 DeleteData(data_); |
59 Initialize(0); | 59 Initialize(0); |
60 } | 60 } |
61 | 61 |
62 INLINE(void* operator new(size_t size)) { return P::New(size); } | 62 INLINE(void* operator new(size_t size)) { |
| 63 return P::New(static_cast<int>(size)); |
| 64 } |
63 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); } |
64 | 66 |
65 // 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 |
66 // 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 |
67 // backing store (eg, Add). | 69 // backing store (eg, Add). |
68 inline T& operator[](int i) const { | 70 inline T& operator[](int i) const { |
69 ASSERT(0 <= i && i < length_); | 71 ASSERT(0 <= i && i < length_); |
70 return data_[i]; | 72 return data_[i]; |
71 } | 73 } |
72 inline T& at(int i) const { return operator[](i); } | 74 inline T& at(int i) const { return operator[](i); } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 149 |
148 // Add() is inlined, ResizeAdd() called by Add() is inlined except for | 150 // Add() is inlined, ResizeAdd() called by Add() is inlined except for |
149 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). | 151 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). |
150 template <> | 152 template <> |
151 void List<FrameElement, | 153 void List<FrameElement, |
152 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); | 154 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); |
153 | 155 |
154 } } // namespace v8::internal | 156 } } // namespace v8::internal |
155 | 157 |
156 #endif // V8_LIST_H_ | 158 #endif // V8_LIST_H_ |
OLD | NEW |