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 }; |
177 explicit ZoneAllocationPolicy(Zone* zone) : zone_(zone) { } | 182 explicit ZoneAllocationPolicy(Zone* zone) : zone_(zone) { } |
178 INLINE(void* New(size_t size)); | 183 INLINE(void* New(size_t size)); |
179 INLINE(static void Delete(void *pointer)) { } | 184 INLINE(static void Delete(void *pointer)) { } |
180 Zone* zone() { return zone_; } | 185 Zone* zone() { return zone_; } |
181 | 186 |
182 private: | 187 private: |
183 Zone* zone_; | 188 Zone* zone_; |
184 }; | 189 }; |
185 | 190 |
186 | 191 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 void operator delete(void* pointer) { UNREACHABLE(); } | 257 void operator delete(void* pointer) { UNREACHABLE(); } |
253 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } | 258 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } |
254 }; | 259 }; |
255 | 260 |
256 | 261 |
257 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; | 262 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; |
258 | 263 |
259 } } // namespace v8::internal | 264 } } // namespace v8::internal |
260 | 265 |
261 #endif // V8_ZONE_H_ | 266 #endif // V8_ZONE_H_ |
OLD | NEW |