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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // In terms of allocation sizes, order 0 covers 0, order 1 covers 1, order 2 | 176 // In terms of allocation sizes, order 0 covers 0, order 1 covers 1, order 2 |
177 // covers 2->3, order 3 covers 4->7, order 4 covers 8->15. | 177 // covers 2->3, order 3 covers 4->7, order 4 covers 8->15. |
178 static const size_t kGenericMinBucketedOrder = 4; // 8 bytes. | 178 static const size_t kGenericMinBucketedOrder = 4; // 8 bytes. |
179 static const size_t kGenericMaxBucketedOrder = 20; // Largest bucketed order is
1<<(20-1) (storing 512KB -> almost 1MB) | 179 static const size_t kGenericMaxBucketedOrder = 20; // Largest bucketed order is
1<<(20-1) (storing 512KB -> almost 1MB) |
180 static const size_t kGenericNumBucketedOrders = (kGenericMaxBucketedOrder - kGen
ericMinBucketedOrder) + 1; | 180 static const size_t kGenericNumBucketedOrders = (kGenericMaxBucketedOrder - kGen
ericMinBucketedOrder) + 1; |
181 static const size_t kGenericNumBucketsPerOrderBits = 3; // Eight buckets per ord
er (for the higher orders), e.g. order 8 is 128, 144, 160, ..., 240 | 181 static const size_t kGenericNumBucketsPerOrderBits = 3; // Eight buckets per ord
er (for the higher orders), e.g. order 8 is 128, 144, 160, ..., 240 |
182 static const size_t kGenericNumBucketsPerOrder = 1 << kGenericNumBucketsPerOrder
Bits; | 182 static const size_t kGenericNumBucketsPerOrder = 1 << kGenericNumBucketsPerOrder
Bits; |
183 static const size_t kGenericSmallestBucket = 1 << (kGenericMinBucketedOrder - 1)
; | 183 static const size_t kGenericSmallestBucket = 1 << (kGenericMinBucketedOrder - 1)
; |
184 static const size_t kGenericMaxBucketSpacing = 1 << ((kGenericMaxBucketedOrder -
1) - kGenericNumBucketsPerOrderBits); | 184 static const size_t kGenericMaxBucketSpacing = 1 << ((kGenericMaxBucketedOrder -
1) - kGenericNumBucketsPerOrderBits); |
185 static const size_t kGenericMaxBucketed = (1 << (kGenericMaxBucketedOrder - 1))
+ ((kGenericNumBucketsPerOrder - 1) * kGenericMaxBucketSpacing); | 185 static const size_t kGenericMaxBucketed = (1 << (kGenericMaxBucketedOrder - 1))
+ ((kGenericNumBucketsPerOrder - 1) * kGenericMaxBucketSpacing); |
186 static const size_t kGenericMinDirectMappedDownsize = 16 * kPartitionPageSize; /
/ Limit when downsizing a direct mapping using realloc(). | 186 static const size_t kGenericMinDirectMappedDownsize = kGenericMaxBucketed + 1; /
/ Limit when downsizing a direct mapping using realloc(). |
187 static const size_t kGenericMaxDirectMapped = INT_MAX - kSystemPageSize; | 187 static const size_t kGenericMaxDirectMapped = INT_MAX - kSystemPageSize; |
188 static const size_t kBitsPerSizet = sizeof(void*) * CHAR_BIT; | 188 static const size_t kBitsPerSizet = sizeof(void*) * CHAR_BIT; |
189 | 189 |
190 // Constants for the memory reclaim logic. | 190 // Constants for the memory reclaim logic. |
191 static const size_t kMaxFreeableSpans = 16; | 191 static const size_t kMaxFreeableSpans = 16; |
192 | 192 |
193 #ifndef NDEBUG | 193 #ifndef NDEBUG |
194 // These two byte values match tcmalloc. | 194 // These two byte values match tcmalloc. |
195 static const unsigned char kUninitializedByte = 0xAB; | 195 static const unsigned char kUninitializedByte = 0xAB; |
196 static const unsigned char kFreedByte = 0xCD; | 196 static const unsigned char kFreedByte = 0xCD; |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 using WTF::partitionAlloc; | 658 using WTF::partitionAlloc; |
659 using WTF::partitionFree; | 659 using WTF::partitionFree; |
660 using WTF::partitionAllocGeneric; | 660 using WTF::partitionAllocGeneric; |
661 using WTF::partitionFreeGeneric; | 661 using WTF::partitionFreeGeneric; |
662 using WTF::partitionReallocGeneric; | 662 using WTF::partitionReallocGeneric; |
663 using WTF::partitionAllocActualSize; | 663 using WTF::partitionAllocActualSize; |
664 using WTF::partitionAllocSupportsGetSize; | 664 using WTF::partitionAllocSupportsGetSize; |
665 using WTF::partitionAllocGetSize; | 665 using WTF::partitionAllocGetSize; |
666 | 666 |
667 #endif // WTF_PartitionAlloc_h | 667 #endif // WTF_PartitionAlloc_h |
OLD | NEW |