OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 }; | 171 }; |
172 | 172 |
173 | 173 |
174 // ZoneLists are growable lists with constant-time access to the | 174 // ZoneLists are growable lists with constant-time access to the |
175 // elements. The list itself and all its elements are allocated in the | 175 // elements. The list itself and all its elements are allocated in the |
176 // Zone. ZoneLists cannot be deleted individually; you can delete all | 176 // Zone. ZoneLists cannot be deleted individually; you can delete all |
177 // objects in the Zone by calling Zone::DeleteAll(). | 177 // objects in the Zone by calling Zone::DeleteAll(). |
178 template<typename T> | 178 template<typename T> |
179 class ZoneList: public List<T, ZoneListAllocationPolicy> { | 179 class ZoneList: public List<T, ZoneListAllocationPolicy> { |
180 public: | 180 public: |
| 181 inline void* operator new(size_t size); |
| 182 inline void* operator new(size_t size, Zone* zone); |
| 183 |
181 // Construct a new ZoneList with the given capacity; the length is | 184 // Construct a new ZoneList with the given capacity; the length is |
182 // always zero. The capacity must be non-negative. | 185 // always zero. The capacity must be non-negative. |
183 explicit ZoneList(int capacity) | 186 explicit ZoneList(int capacity) |
184 : List<T, ZoneListAllocationPolicy>(capacity) { } | 187 : List<T, ZoneListAllocationPolicy>(capacity) { } |
185 | 188 |
186 // Construct a new ZoneList by copying the elements of the given ZoneList. | 189 // Construct a new ZoneList by copying the elements of the given ZoneList. |
187 explicit ZoneList(const ZoneList<T>& other) | 190 explicit ZoneList(const ZoneList<T>& other) |
188 : List<T, ZoneListAllocationPolicy>(other.length()) { | 191 : List<T, ZoneListAllocationPolicy>(other.length()) { |
189 AddAll(other); | 192 AddAll(other); |
190 } | 193 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 public: | 232 public: |
230 ZoneSplayTree() | 233 ZoneSplayTree() |
231 : SplayTree<Config, ZoneListAllocationPolicy>() {} | 234 : SplayTree<Config, ZoneListAllocationPolicy>() {} |
232 ~ZoneSplayTree(); | 235 ~ZoneSplayTree(); |
233 }; | 236 }; |
234 | 237 |
235 | 238 |
236 } } // namespace v8::internal | 239 } } // namespace v8::internal |
237 | 240 |
238 #endif // V8_ZONE_H_ | 241 #endif // V8_ZONE_H_ |
OLD | NEW |