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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 108 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
109 #include <stdlib.h> | 109 #include <stdlib.h> |
110 #endif | 110 #endif |
111 | 111 |
112 #if ENABLE(ASSERT) | 112 #if ENABLE(ASSERT) |
113 #include <string.h> | 113 #include <string.h> |
114 #endif | 114 #endif |
115 | 115 |
116 namespace WTF { | 116 namespace WTF { |
117 | 117 |
118 // Maximum size of a partition's mappings. 2046MB. Note that the total amount of | |
119 // bytes allocatable at the API will be smaller. This is because things like | |
120 // guard pages, metadata, page headers and wasted space come out of the total. | |
121 // The 2GB is not necessarily contiguous in virtual address space. | |
122 static const size_t kMaxPartitionSize = 2046u * 1024u * 1024u; | |
123 | |
124 // Allocation granularity of sizeof(void*) bytes. | 118 // Allocation granularity of sizeof(void*) bytes. |
125 static const size_t kAllocationGranularity = sizeof(void*); | 119 static const size_t kAllocationGranularity = sizeof(void*); |
126 static const size_t kAllocationGranularityMask = kAllocationGranularity - 1; | 120 static const size_t kAllocationGranularityMask = kAllocationGranularity - 1; |
127 static const size_t kBucketShift = (kAllocationGranularity == 8) ? 3 : 2; | 121 static const size_t kBucketShift = (kAllocationGranularity == 8) ? 3 : 2; |
128 | 122 |
129 // Underlying partition storage pages are a power-of-two size. It is typical | 123 // Underlying partition storage pages are a power-of-two size. It is typical |
130 // for a partition page to be based on multiple system pages. Most references to | 124 // for a partition page to be based on multiple system pages. Most references to |
131 // "page" refer to partition pages. | 125 // "page" refer to partition pages. |
132 // We also have the concept of "super pages" -- these are the underlying system | 126 // We also have the concept of "super pages" -- these are the underlying system |
133 // allocations we make. Super pages contain multiple partition pages inside them | 127 // allocations we make. Super pages contain multiple partition pages inside them |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 using WTF::partitionAlloc; | 657 using WTF::partitionAlloc; |
664 using WTF::partitionFree; | 658 using WTF::partitionFree; |
665 using WTF::partitionAllocGeneric; | 659 using WTF::partitionAllocGeneric; |
666 using WTF::partitionFreeGeneric; | 660 using WTF::partitionFreeGeneric; |
667 using WTF::partitionReallocGeneric; | 661 using WTF::partitionReallocGeneric; |
668 using WTF::partitionAllocActualSize; | 662 using WTF::partitionAllocActualSize; |
669 using WTF::partitionAllocSupportsGetSize; | 663 using WTF::partitionAllocSupportsGetSize; |
670 using WTF::partitionAllocGetSize; | 664 using WTF::partitionAllocGetSize; |
671 | 665 |
672 #endif // WTF_PartitionAlloc_h | 666 #endif // WTF_PartitionAlloc_h |
OLD | NEW |