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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // require the operator to be visible. MSVC requires the delete | 156 // require the operator to be visible. MSVC requires the delete |
157 // operator to be public. | 157 // operator to be public. |
158 | 158 |
159 // ZoneObjects should never be deleted individually; use | 159 // ZoneObjects should never be deleted individually; use |
160 // Zone::DeleteAll() to delete all zone objects in one go. | 160 // Zone::DeleteAll() to delete all zone objects in one go. |
161 void operator delete(void*, size_t) { UNREACHABLE(); } | 161 void operator delete(void*, size_t) { UNREACHABLE(); } |
162 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } | 162 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } |
163 }; | 163 }; |
164 | 164 |
165 | 165 |
166 class AssertNoZoneAllocation { | |
167 public: | |
168 inline AssertNoZoneAllocation(); | |
169 inline ~AssertNoZoneAllocation(); | |
170 private: | |
171 bool prev_; | |
172 }; | |
173 | |
174 | |
175 // The ZoneListAllocationPolicy is used to specialize the GenericList | 166 // The ZoneListAllocationPolicy is used to specialize the GenericList |
176 // implementation to allocate ZoneLists and their elements in the | 167 // implementation to allocate ZoneLists and their elements in the |
177 // Zone. | 168 // Zone. |
178 class ZoneListAllocationPolicy { | 169 class ZoneListAllocationPolicy { |
179 public: | 170 public: |
180 // Allocate 'size' bytes of memory in the zone. | 171 // Allocate 'size' bytes of memory in the zone. |
181 static void* New(int size); | 172 static void* New(int size); |
182 | 173 |
183 // De-allocation attempts are silently ignored. | 174 // De-allocation attempts are silently ignored. |
184 static void Delete(void* p) { } | 175 static void Delete(void* p) { } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 public: | 235 public: |
245 ZoneSplayTree() | 236 ZoneSplayTree() |
246 : SplayTree<Config, ZoneListAllocationPolicy>() {} | 237 : SplayTree<Config, ZoneListAllocationPolicy>() {} |
247 ~ZoneSplayTree(); | 238 ~ZoneSplayTree(); |
248 }; | 239 }; |
249 | 240 |
250 | 241 |
251 } } // namespace v8::internal | 242 } } // namespace v8::internal |
252 | 243 |
253 #endif // V8_ZONE_H_ | 244 #endif // V8_ZONE_H_ |
OLD | NEW |