| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return segment_bytes_allocated_ > kExcessLimit; | 58 return segment_bytes_allocated_ > kExcessLimit; |
| 59 } | 59 } |
| 60 | 60 |
| 61 size_t allocation_size() const { return allocation_size_; } | 61 size_t allocation_size() const { return allocation_size_; } |
| 62 | 62 |
| 63 AccountingAllocator* allocator() const { return allocator_; } | 63 AccountingAllocator* allocator() const { return allocator_; } |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 // All pointers returned from New() have this alignment. In addition, if the | 66 // All pointers returned from New() have this alignment. In addition, if the |
| 67 // object being allocated has a size that is divisible by 8 then its alignment | 67 // object being allocated has a size that is divisible by 8 then its alignment |
| 68 // will be 8. ASan requires 8-byte alignment. | 68 // will be 8. ASan requires 8-byte alignment. MIPS also requires 8-byte |
| 69 #ifdef V8_USE_ADDRESS_SANITIZER | 69 // alignment. |
| 70 #if defined(V8_USE_ADDRESS_SANITIZER) || defined(V8_TARGET_ARCH_MIPS) |
| 70 static const size_t kAlignment = 8; | 71 static const size_t kAlignment = 8; |
| 71 STATIC_ASSERT(kPointerSize <= 8); | 72 STATIC_ASSERT(kPointerSize <= 8); |
| 72 #else | 73 #else |
| 73 static const size_t kAlignment = kPointerSize; | 74 static const size_t kAlignment = kPointerSize; |
| 74 #endif | 75 #endif |
| 75 | 76 |
| 76 // Never allocate segments smaller than this size in bytes. | 77 // Never allocate segments smaller than this size in bytes. |
| 77 static const size_t kMinimumSegmentSize = 8 * KB; | 78 static const size_t kMinimumSegmentSize = 8 * KB; |
| 78 | 79 |
| 79 // Never allocate segments larger than this size in bytes. | 80 // Never allocate segments larger than this size in bytes. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 235 |
| 235 typedef base::PointerTemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; | 236 typedef base::PointerTemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; |
| 236 | 237 |
| 237 typedef base::CustomMatcherTemplateHashMapImpl<ZoneAllocationPolicy> | 238 typedef base::CustomMatcherTemplateHashMapImpl<ZoneAllocationPolicy> |
| 238 CustomMatcherZoneHashMap; | 239 CustomMatcherZoneHashMap; |
| 239 | 240 |
| 240 } // namespace internal | 241 } // namespace internal |
| 241 } // namespace v8 | 242 } // namespace v8 |
| 242 | 243 |
| 243 #endif // V8_ZONE_ZONE_H_ | 244 #endif // V8_ZONE_ZONE_H_ |
| OLD | NEW |