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_H_ | 5 #ifndef V8_ZONE_H_ |
6 #define V8_ZONE_H_ | 6 #define V8_ZONE_H_ |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Deletes the last small segment kept around by DeleteAll(). You | 56 // Deletes the last small segment kept around by DeleteAll(). You |
57 // may no longer allocate in the Zone after a call to this method. | 57 // may no longer allocate in the Zone after a call to this method. |
58 void DeleteKeptSegment(); | 58 void DeleteKeptSegment(); |
59 | 59 |
60 // Returns true if more memory has been allocated in zones than | 60 // Returns true if more memory has been allocated in zones than |
61 // the limit allows. | 61 // the limit allows. |
62 inline bool excess_allocation(); | 62 inline bool excess_allocation(); |
63 | 63 |
64 inline void adjust_segment_bytes_allocated(int delta); | 64 inline void adjust_segment_bytes_allocated(int delta); |
65 | 65 |
66 inline unsigned allocation_size() { return allocation_size_; } | 66 inline unsigned allocation_size() const { return allocation_size_; } |
67 | 67 |
68 inline Isolate* isolate() { return isolate_; } | 68 inline Isolate* isolate() const { return isolate_; } |
69 | 69 |
70 private: | 70 private: |
71 friend class Isolate; | 71 friend class Isolate; |
72 | 72 |
73 // All pointers returned from New() have this alignment. In addition, if the | 73 // All pointers returned from New() have this alignment. In addition, if the |
74 // object being allocated has a size that is divisible by 8 then its alignment | 74 // object being allocated has a size that is divisible by 8 then its alignment |
75 // will be 8. ASan requires 8-byte alignment. | 75 // will be 8. ASan requires 8-byte alignment. |
76 #ifdef V8_USE_ADDRESS_SANITIZER | 76 #ifdef V8_USE_ADDRESS_SANITIZER |
77 static const int kAlignment = 8; | 77 static const int kAlignment = 8; |
78 STATIC_ASSERT(kPointerSize <= 8); | 78 STATIC_ASSERT(kPointerSize <= 8); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 void operator delete(void* pointer) { UNREACHABLE(); } | 240 void operator delete(void* pointer) { UNREACHABLE(); } |
241 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } | 241 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } |
242 }; | 242 }; |
243 | 243 |
244 | 244 |
245 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; | 245 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; |
246 | 246 |
247 } } // namespace v8::internal | 247 } } // namespace v8::internal |
248 | 248 |
249 #endif // V8_ZONE_H_ | 249 #endif // V8_ZONE_H_ |
OLD | NEW |