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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 INLINE(void Initialize(int capacity)); | 111 INLINE(void Initialize(int capacity)); |
112 | 112 |
113 private: | 113 private: |
114 T* data_; | 114 T* data_; |
115 int capacity_; | 115 int capacity_; |
116 int length_; | 116 int length_; |
117 | 117 |
118 INLINE(T* NewData(int n)) { return static_cast<T*>(P::New(n * sizeof(T))); } | 118 INLINE(T* NewData(int n)) { return static_cast<T*>(P::New(n * sizeof(T))); } |
119 INLINE(void DeleteData(T* data)) { P::Delete(data); } | 119 INLINE(void DeleteData(T* data)) { P::Delete(data); } |
120 | 120 |
| 121 // Increase the capacity of a full list, and add an element. |
| 122 // List must be full already. |
| 123 void ResizeAdd(const T& element); |
| 124 |
| 125 // Inlined implementation of ResizeAdd, shared by inlined and |
| 126 // non-inlined versions of ResizeAdd. |
| 127 void ResizeAddInternal(const T& element); |
| 128 |
121 DISALLOW_COPY_AND_ASSIGN(List); | 129 DISALLOW_COPY_AND_ASSIGN(List); |
122 }; | 130 }; |
123 | 131 |
| 132 class FrameElement; |
| 133 |
| 134 // Add() is inlined, ResizeAdd() called by Add() is inlined except for |
| 135 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). |
| 136 template <> |
| 137 void List<FrameElement, |
| 138 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); |
124 | 139 |
125 } } // namespace v8::internal | 140 } } // namespace v8::internal |
126 | 141 |
127 #endif // V8_LIST_H_ | 142 #endif // V8_LIST_H_ |
OLD | NEW |