| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_ZONE_ZONE_H_ | 5 #ifndef V8_ZONE_ZONE_H_ |
| 6 #define V8_ZONE_ZONE_H_ | 6 #define V8_ZONE_ZONE_H_ |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "src/base/hashmap.h" | 10 #include "src/base/hashmap.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 Address position_; | 110 Address position_; |
| 111 Address limit_; | 111 Address limit_; |
| 112 | 112 |
| 113 AccountingAllocator* allocator_; | 113 AccountingAllocator* allocator_; |
| 114 | 114 |
| 115 Segment* segment_head_; | 115 Segment* segment_head_; |
| 116 const char* name_; | 116 const char* name_; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 // ZoneObject is an abstraction that helps define classes of objects | 119 // ZoneObject is an abstraction that helps define classes of objects |
| 120 // allocated in the Zone. Use it as a base class; see ast.h. | 120 // allocated in the Zone. Use it as an interface; see ast.h. |
| 121 class ZoneObject { | 121 class ZoneObject { |
| 122 public: | 122 public: |
| 123 // Allocate a new ZoneObject of 'size' bytes in the Zone. | 123 // Allocate a new ZoneObject of 'size' bytes in the Zone. |
| 124 void* operator new(size_t size, Zone* zone) { return zone->New(size); } | 124 void* operator new(size_t size, Zone* zone) { return zone->New(size); } |
| 125 | 125 |
| 126 // Ideally, the delete operator should be private instead of | 126 // Ideally, the delete operator should be private instead of |
| 127 // public, but unfortunately the compiler sometimes synthesizes | 127 // public, but unfortunately the compiler sometimes synthesizes |
| 128 // (unused) destructors for classes derived from ZoneObject, which | 128 // (unused) destructors for classes implementing ZoneObject, which |
| 129 // require the operator to be visible. MSVC requires the delete | 129 // require the operator to be visible. MSVC requires the delete |
| 130 // operator to be public. | 130 // operator to be public. |
| 131 | 131 |
| 132 // ZoneObjects should never be deleted individually; use | 132 // ZoneObjects should never be deleted individually; use |
| 133 // Zone::DeleteAll() to delete all zone objects in one go. | 133 // Zone::DeleteAll() to delete all zone objects in one go. |
| 134 void operator delete(void*, size_t) { UNREACHABLE(); } | 134 void operator delete(void*, size_t) { UNREACHABLE(); } |
| 135 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } | 135 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 // The ZoneAllocationPolicy is used to specialize generic data | 138 // The ZoneAllocationPolicy is used to specialize generic data |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 typedef base::PointerTemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; | 224 typedef base::PointerTemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; |
| 225 | 225 |
| 226 typedef base::CustomMatcherTemplateHashMapImpl<ZoneAllocationPolicy> | 226 typedef base::CustomMatcherTemplateHashMapImpl<ZoneAllocationPolicy> |
| 227 CustomMatcherZoneHashMap; | 227 CustomMatcherZoneHashMap; |
| 228 | 228 |
| 229 } // namespace internal | 229 } // namespace internal |
| 230 } // namespace v8 | 230 } // namespace v8 |
| 231 | 231 |
| 232 #endif // V8_ZONE_ZONE_H_ | 232 #endif // V8_ZONE_ZONE_H_ |
| OLD | NEW |