Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: src/zone/zone.h

Issue 2672203002: Ensure we align zone memory at 8 byte boundaries on all platforms (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/zone/zone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return segment_bytes_allocated_ > kExcessLimit; 56 return segment_bytes_allocated_ > kExcessLimit;
57 } 57 }
58 58
59 const char* name() const { return name_; } 59 const char* name() const { return name_; }
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() are 8-byte aligned.
67 // object being allocated has a size that is divisible by 8 then its alignment 67 static const size_t kAlignmentInBytes = 8;
68 // will be 8. ASan requires 8-byte alignment. MIPS also requires 8-byte
69 // alignment.
70 #if defined(V8_USE_ADDRESS_SANITIZER) || defined(V8_TARGET_ARCH_MIPS)
71 static const size_t kAlignment = 8;
72 STATIC_ASSERT(kPointerSize <= 8);
73 #else
74 static const size_t kAlignment = kPointerSize;
75 #endif
76 68
77 // Never allocate segments smaller than this size in bytes. 69 // Never allocate segments smaller than this size in bytes.
78 static const size_t kMinimumSegmentSize = 8 * KB; 70 static const size_t kMinimumSegmentSize = 8 * KB;
79 71
80 // Never allocate segments larger than this size in bytes. 72 // Never allocate segments larger than this size in bytes.
81 static const size_t kMaximumSegmentSize = 1 * MB; 73 static const size_t kMaximumSegmentSize = 1 * MB;
82 74
83 // Report zone excess when allocation exceeds this limit. 75 // Report zone excess when allocation exceeds this limit.
84 static const size_t kExcessLimit = 256 * MB; 76 static const size_t kExcessLimit = 256 * MB;
85 77
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 222
231 typedef base::PointerTemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; 223 typedef base::PointerTemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap;
232 224
233 typedef base::CustomMatcherTemplateHashMapImpl<ZoneAllocationPolicy> 225 typedef base::CustomMatcherTemplateHashMapImpl<ZoneAllocationPolicy>
234 CustomMatcherZoneHashMap; 226 CustomMatcherZoneHashMap;
235 227
236 } // namespace internal 228 } // namespace internal
237 } // namespace v8 229 } // namespace v8
238 230
239 #endif // V8_ZONE_ZONE_H_ 231 #endif // V8_ZONE_ZONE_H_
OLDNEW
« no previous file with comments | « no previous file | src/zone/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698