Lines Matching defs:Zone
22 // The Zone supports very fast allocation of small chunks of
24 // the Zone supports deallocating all chunks in one fast
25 // operation. The Zone is used to hold temporary data structures like
28 // Note: There is no need to initialize the Zone; the first time an
35 class Zone {
37 explicit Zone(Isolate* isolate);
38 ~Zone();
39 // Allocate 'size' bytes of memory in the Zone; expands the Zone by
46 // Deletes all objects and free all memory allocated in the Zone. Keeps one
51 // may no longer allocate in the Zone after a call to this method.
86 // Report zone excess when allocation exceeds this limit.
89 // The number of bytes allocated in this zone so far.
94 // the zone.
97 // Expand the Zone to hold at least 'size' more bytes and allocate
99 // memory in the Zone. Should only be called if there isn't enough
100 // room in the Zone already.
122 // allocated in the Zone. Use it as a base class; see ast.h.
125 // Allocate a new ZoneObject of 'size' bytes in the Zone.
126 INLINE(void* operator new(size_t size, Zone* zone));
135 // Zone::DeleteAll() to delete all zone objects in one go.
137 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); }
142 // Zone when the ZoneScope is destroyed (i.e. goes out of scope)
145 explicit ZoneScope(Zone* zone) : zone_(zone) { }
148 Zone* zone() { return zone_; }
151 Zone* zone_;
156 // structures to allocate themselves and their elements in the Zone.
159 explicit ZoneAllocationPolicy(Zone* zone) : zone_(zone) { }
162 Zone* zone() { return zone_; }
165 Zone* zone_;
171 // Zone. ZoneLists cannot be deleted individually; you can delete all
172 // objects in the Zone by calling Zone::DeleteAll().
178 ZoneList(int capacity, Zone* zone)
179 : List<T, ZoneAllocationPolicy>(capacity, ZoneAllocationPolicy(zone)) { }
181 INLINE(void* operator new(size_t size, Zone* zone));
184 ZoneList(const ZoneList<T>& other, Zone* zone)
186 ZoneAllocationPolicy(zone)) {
187 AddAll(other, zone);
190 // We add some convenience wrappers so that we can pass in a Zone
192 INLINE(void Add(const T& element, Zone* zone)) {
193 List<T, ZoneAllocationPolicy>::Add(element, ZoneAllocationPolicy(zone));
195 INLINE(void AddAll(const List<T, ZoneAllocationPolicy>& other, Zone* zone)) {
196 List<T, ZoneAllocationPolicy>::AddAll(other, ZoneAllocationPolicy(zone));
198 INLINE(void AddAll(const Vector<T>& other, Zone* zone)) {
199 List<T, ZoneAllocationPolicy>::AddAll(other, ZoneAllocationPolicy(zone));
201 INLINE(void InsertAt(int index, const T& element, Zone* zone)) {
203 ZoneAllocationPolicy(zone));
205 INLINE(Vector<T> AddBlock(T value, int count, Zone* zone)) {
207 ZoneAllocationPolicy(zone));
209 INLINE(void Allocate(int length, Zone* zone)) {
210 List<T, ZoneAllocationPolicy>::Allocate(length, ZoneAllocationPolicy(zone));
212 INLINE(void Initialize(int capacity, Zone* zone)) {
214 ZoneAllocationPolicy(zone));
218 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); }
222 // A zone splay tree. The config type parameter encapsulates the
224 // The tree itself and all its elements are allocated in the Zone.
228 explicit ZoneSplayTree(Zone* zone)
229 : SplayTree<Config, ZoneAllocationPolicy>(ZoneAllocationPolicy(zone)) {}
232 INLINE(void* operator new(size_t size, Zone* zone));
235 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); }