OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // always zero. The capacity must be non-negative. | 195 // always zero. The capacity must be non-negative. |
196 ZoneList(int capacity, Zone* zone) | 196 ZoneList(int capacity, Zone* zone) |
197 : List<T, ZoneAllocationPolicy>(capacity, ZoneAllocationPolicy(zone)) { } | 197 : List<T, ZoneAllocationPolicy>(capacity, ZoneAllocationPolicy(zone)) { } |
198 | 198 |
199 INLINE(void* operator new(size_t size, Zone* zone)); | 199 INLINE(void* operator new(size_t size, Zone* zone)); |
200 | 200 |
201 // Construct a new ZoneList by copying the elements of the given ZoneList. | 201 // Construct a new ZoneList by copying the elements of the given ZoneList. |
202 ZoneList(const ZoneList<T>& other, Zone* zone) | 202 ZoneList(const ZoneList<T>& other, Zone* zone) |
203 : List<T, ZoneAllocationPolicy>(other.length(), | 203 : List<T, ZoneAllocationPolicy>(other.length(), |
204 ZoneAllocationPolicy(zone)) { | 204 ZoneAllocationPolicy(zone)) { |
205 AddAll(other, ZoneAllocationPolicy(zone)); | 205 AddAll(other, zone); |
206 } | 206 } |
207 | 207 |
208 // We add some convenience wrappers so that we can pass in a Zone | 208 // We add some convenience wrappers so that we can pass in a Zone |
209 // instead of a (less convenient) ZoneAllocationPolicy. | 209 // instead of a (less convenient) ZoneAllocationPolicy. |
210 INLINE(void Add(const T& element, Zone* zone)) { | 210 INLINE(void Add(const T& element, Zone* zone)) { |
211 List<T, ZoneAllocationPolicy>::Add(element, ZoneAllocationPolicy(zone)); | 211 List<T, ZoneAllocationPolicy>::Add(element, ZoneAllocationPolicy(zone)); |
212 } | 212 } |
213 INLINE(void AddAll(const List<T, ZoneAllocationPolicy>& other, | 213 INLINE(void AddAll(const List<T, ZoneAllocationPolicy>& other, Zone* zone)) { |
214 Zone* zone)) { | |
215 List<T, ZoneAllocationPolicy>::AddAll(other, ZoneAllocationPolicy(zone)); | 214 List<T, ZoneAllocationPolicy>::AddAll(other, ZoneAllocationPolicy(zone)); |
216 } | 215 } |
217 INLINE(void AddAll(const Vector<T>& other, Zone* zone)) { | 216 INLINE(void AddAll(const Vector<T>& other, Zone* zone)) { |
218 List<T, ZoneAllocationPolicy>::AddAll(other, ZoneAllocationPolicy(zone)); | 217 List<T, ZoneAllocationPolicy>::AddAll(other, ZoneAllocationPolicy(zone)); |
219 } | 218 } |
220 INLINE(void InsertAt(int index, const T& element, Zone* zone)) { | 219 INLINE(void InsertAt(int index, const T& element, Zone* zone)) { |
221 List<T, ZoneAllocationPolicy>::InsertAt(index, element, | 220 List<T, ZoneAllocationPolicy>::InsertAt(index, element, |
222 ZoneAllocationPolicy(zone)); | 221 ZoneAllocationPolicy(zone)); |
223 } | 222 } |
224 INLINE(Vector<T> AddBlock(T value, int count, Zone* zone)) { | 223 INLINE(Vector<T> AddBlock(T value, int count, Zone* zone)) { |
(...skipping 28 matching lines...) Expand all Loading... |
253 void operator delete(void* pointer) { UNREACHABLE(); } | 252 void operator delete(void* pointer) { UNREACHABLE(); } |
254 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } | 253 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } |
255 }; | 254 }; |
256 | 255 |
257 | 256 |
258 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; | 257 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; |
259 | 258 |
260 } } // namespace v8::internal | 259 } } // namespace v8::internal |
261 | 260 |
262 #endif // V8_ZONE_H_ | 261 #endif // V8_ZONE_H_ |
OLD | NEW |