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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 private: | 168 private: |
169 Zone* zone_; | 169 Zone* zone_; |
170 }; | 170 }; |
171 | 171 |
172 | 172 |
173 // The ZoneAllocationPolicy is used to specialize generic data | 173 // The ZoneAllocationPolicy is used to specialize generic data |
174 // structures to allocate themselves and their elements in the Zone. | 174 // structures to allocate themselves and their elements in the Zone. |
175 struct ZoneAllocationPolicy { | 175 struct ZoneAllocationPolicy { |
176 public: | 176 public: |
177 class Deleter { | |
178 public: | |
179 INLINE(explicit Deleter(const ZoneAllocationPolicy&)) {} | |
180 INLINE(static void Delete(void *pointer)) { } | |
181 }; | |
182 explicit ZoneAllocationPolicy(Zone* zone) : zone_(zone) { } | 177 explicit ZoneAllocationPolicy(Zone* zone) : zone_(zone) { } |
183 INLINE(void* New(size_t size)); | 178 INLINE(void* New(size_t size)); |
184 INLINE(static void Delete(void *pointer)) { } | 179 INLINE(static void Delete(void *pointer)) { } |
185 Zone* zone() { return zone_; } | 180 Zone* zone() { return zone_; } |
186 | 181 |
187 private: | 182 private: |
188 Zone* zone_; | 183 Zone* zone_; |
189 }; | 184 }; |
190 | 185 |
191 | 186 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 void operator delete(void* pointer) { UNREACHABLE(); } | 252 void operator delete(void* pointer) { UNREACHABLE(); } |
258 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } | 253 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } |
259 }; | 254 }; |
260 | 255 |
261 | 256 |
262 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; | 257 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; |
263 | 258 |
264 } } // namespace v8::internal | 259 } } // namespace v8::internal |
265 | 260 |
266 #endif // V8_ZONE_H_ | 261 #endif // V8_ZONE_H_ |
OLD | NEW |