| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 // Delete all objects and free all memory allocated in the Zone. | 68 // Delete all objects and free all memory allocated in the Zone. |
| 69 void DeleteAll(); | 69 void DeleteAll(); |
| 70 | 70 |
| 71 // Returns true if more memory has been allocated in zones than | 71 // Returns true if more memory has been allocated in zones than |
| 72 // the limit allows. | 72 // the limit allows. |
| 73 inline bool excess_allocation(); | 73 inline bool excess_allocation(); |
| 74 | 74 |
| 75 inline void adjust_segment_bytes_allocated(int delta); | 75 inline void adjust_segment_bytes_allocated(int delta); |
| 76 | 76 |
| 77 inline Isolate* isolate() { return isolate_; } |
| 78 |
| 77 static unsigned allocation_size_; | 79 static unsigned allocation_size_; |
| 78 | 80 |
| 79 private: | 81 private: |
| 80 friend class Isolate; | 82 friend class Isolate; |
| 81 friend class ZoneScope; | 83 friend class ZoneScope; |
| 82 | 84 |
| 83 // All pointers returned from New() have this alignment. | 85 // All pointers returned from New() have this alignment. |
| 84 static const int kAlignment = kPointerSize; | 86 static const int kAlignment = kPointerSize; |
| 85 | 87 |
| 86 // Never allocate segments smaller than this size in bytes. | 88 // Never allocate segments smaller than this size in bytes. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 bool prev_; | 159 bool prev_; |
| 158 }; | 160 }; |
| 159 | 161 |
| 160 | 162 |
| 161 // The ZoneListAllocationPolicy is used to specialize the GenericList | 163 // The ZoneListAllocationPolicy is used to specialize the GenericList |
| 162 // implementation to allocate ZoneLists and their elements in the | 164 // implementation to allocate ZoneLists and their elements in the |
| 163 // Zone. | 165 // Zone. |
| 164 class ZoneListAllocationPolicy { | 166 class ZoneListAllocationPolicy { |
| 165 public: | 167 public: |
| 166 // Allocate 'size' bytes of memory in the zone. | 168 // Allocate 'size' bytes of memory in the zone. |
| 167 INLINE(static void* New(int size)); | 169 static void* New(int size); |
| 168 | 170 |
| 169 // De-allocation attempts are silently ignored. | 171 // De-allocation attempts are silently ignored. |
| 170 static void Delete(void* p) { } | 172 static void Delete(void* p) { } |
| 171 }; | 173 }; |
| 172 | 174 |
| 173 | 175 |
| 174 // ZoneLists are growable lists with constant-time access to the | 176 // ZoneLists are growable lists with constant-time access to the |
| 175 // elements. The list itself and all its elements are allocated in the | 177 // elements. The list itself and all its elements are allocated in the |
| 176 // Zone. ZoneLists cannot be deleted individually; you can delete all | 178 // Zone. ZoneLists cannot be deleted individually; you can delete all |
| 177 // objects in the Zone by calling Zone::DeleteAll(). | 179 // objects in the Zone by calling Zone::DeleteAll(). |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 public: | 233 public: |
| 232 ZoneSplayTree() | 234 ZoneSplayTree() |
| 233 : SplayTree<Config, ZoneListAllocationPolicy>() {} | 235 : SplayTree<Config, ZoneListAllocationPolicy>() {} |
| 234 ~ZoneSplayTree(); | 236 ~ZoneSplayTree(); |
| 235 }; | 237 }; |
| 236 | 238 |
| 237 | 239 |
| 238 } } // namespace v8::internal | 240 } } // namespace v8::internal |
| 239 | 241 |
| 240 #endif // V8_ZONE_H_ | 242 #endif // V8_ZONE_H_ |
| OLD | NEW |