OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 static const size_t kGenericSmallestBucket = 1 << (kGenericMinBucketedOrder - 1)
; | 177 static const size_t kGenericSmallestBucket = 1 << (kGenericMinBucketedOrder - 1)
; |
178 static const size_t kGenericMaxBucketSpacing = 1 << ((kGenericMaxBucketedOrder -
1) - kGenericNumBucketsPerOrderBits); | 178 static const size_t kGenericMaxBucketSpacing = 1 << ((kGenericMaxBucketedOrder -
1) - kGenericNumBucketsPerOrderBits); |
179 static const size_t kGenericMaxBucketed = (1 << (kGenericMaxBucketedOrder - 1))
+ ((kGenericNumBucketsPerOrder - 1) * kGenericMaxBucketSpacing); | 179 static const size_t kGenericMaxBucketed = (1 << (kGenericMaxBucketedOrder - 1))
+ ((kGenericNumBucketsPerOrder - 1) * kGenericMaxBucketSpacing); |
180 static const size_t kGenericMinDirectMappedDownsize = kGenericMaxBucketed + 1; /
/ Limit when downsizing a direct mapping using realloc(). | 180 static const size_t kGenericMinDirectMappedDownsize = kGenericMaxBucketed + 1; /
/ Limit when downsizing a direct mapping using realloc(). |
181 static const size_t kGenericMaxDirectMapped = INT_MAX - kSystemPageSize; | 181 static const size_t kGenericMaxDirectMapped = INT_MAX - kSystemPageSize; |
182 static const size_t kBitsPerSizet = sizeof(void*) * CHAR_BIT; | 182 static const size_t kBitsPerSizet = sizeof(void*) * CHAR_BIT; |
183 | 183 |
184 // Constants for the memory reclaim logic. | 184 // Constants for the memory reclaim logic. |
185 static const size_t kMaxFreeableSpans = 16; | 185 static const size_t kMaxFreeableSpans = 16; |
186 | 186 |
| 187 // If the total size in bytes of allocated but not committed pages exceeds this |
| 188 // value (probably it is a "out of virtual address space" crash), |
| 189 // a special crash stack trace is generated at |partitionOutOfMemory|. |
| 190 // This is to distinguish "out of virtual address space" from |
| 191 // "out of physical memory" in crash reports. |
| 192 static const size_t kReasonableSizeOfUnusedPages = 1024 * 1024 * 1024; // 1GiB |
| 193 |
187 #if ENABLE(ASSERT) | 194 #if ENABLE(ASSERT) |
188 // These two byte values match tcmalloc. | 195 // These two byte values match tcmalloc. |
189 static const unsigned char kUninitializedByte = 0xAB; | 196 static const unsigned char kUninitializedByte = 0xAB; |
190 static const unsigned char kFreedByte = 0xCD; | 197 static const unsigned char kFreedByte = 0xCD; |
191 static const uint32_t kCookieValue = 0xDEADBEEFu; | 198 static const uint32_t kCookieValue = 0xDEADBEEFu; |
192 static const size_t kCookieSize = 16; // Handles alignment up to XMM instruction
s on Intel. | 199 static const size_t kCookieSize = 16; // Handles alignment up to XMM instruction
s on Intel. |
193 #endif | 200 #endif |
194 | 201 |
195 struct PartitionBucket; | 202 struct PartitionBucket; |
196 struct PartitionRootBase; | 203 struct PartitionRootBase; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 struct PartitionSuperPageExtentEntry { | 250 struct PartitionSuperPageExtentEntry { |
244 PartitionRootBase* root; | 251 PartitionRootBase* root; |
245 char* superPageBase; | 252 char* superPageBase; |
246 char* superPagesEnd; | 253 char* superPagesEnd; |
247 PartitionSuperPageExtentEntry* next; | 254 PartitionSuperPageExtentEntry* next; |
248 }; | 255 }; |
249 | 256 |
250 struct WTF_EXPORT PartitionRootBase { | 257 struct WTF_EXPORT PartitionRootBase { |
251 size_t totalSizeOfCommittedPages; | 258 size_t totalSizeOfCommittedPages; |
252 size_t totalSizeOfSuperPages; | 259 size_t totalSizeOfSuperPages; |
| 260 size_t totalSizeOfDirectMappedPages; |
| 261 // Invariant: totalSizeOfCommittedPages <= totalSizeOfSuperPages + totalSize
OfDirectMappedPages. |
253 unsigned numBuckets; | 262 unsigned numBuckets; |
254 unsigned maxAllocation; | 263 unsigned maxAllocation; |
255 bool initialized; | 264 bool initialized; |
256 char* nextSuperPage; | 265 char* nextSuperPage; |
257 char* nextPartitionPage; | 266 char* nextPartitionPage; |
258 char* nextPartitionPageEnd; | 267 char* nextPartitionPageEnd; |
259 PartitionSuperPageExtentEntry* currentExtent; | 268 PartitionSuperPageExtentEntry* currentExtent; |
260 PartitionSuperPageExtentEntry* firstExtent; | 269 PartitionSuperPageExtentEntry* firstExtent; |
261 PartitionPage* globalEmptyPageRing[kMaxFreeableSpans]; | 270 PartitionPage* globalEmptyPageRing[kMaxFreeableSpans]; |
262 int16_t globalEmptyPageRingIndex; | 271 int16_t globalEmptyPageRingIndex; |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 using WTF::partitionAlloc; | 666 using WTF::partitionAlloc; |
658 using WTF::partitionFree; | 667 using WTF::partitionFree; |
659 using WTF::partitionAllocGeneric; | 668 using WTF::partitionAllocGeneric; |
660 using WTF::partitionFreeGeneric; | 669 using WTF::partitionFreeGeneric; |
661 using WTF::partitionReallocGeneric; | 670 using WTF::partitionReallocGeneric; |
662 using WTF::partitionAllocActualSize; | 671 using WTF::partitionAllocActualSize; |
663 using WTF::partitionAllocSupportsGetSize; | 672 using WTF::partitionAllocSupportsGetSize; |
664 using WTF::partitionAllocGetSize; | 673 using WTF::partitionAllocGetSize; |
665 | 674 |
666 #endif // WTF_PartitionAlloc_h | 675 #endif // WTF_PartitionAlloc_h |
OLD | NEW |