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

Side by Side Diff: Source/wtf/PartitionAlloc.h

Issue 1323093004: Clean up and clarify PartitionAlloc (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Undo round/align change Created 5 years, 3 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 | « Source/wtf/PageAllocator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // constant values, we pack _all_ partitionAllocGeneric() sizes perfectly up 134 // constant values, we pack _all_ partitionAllocGeneric() sizes perfectly up
135 // against the end of a system page. 135 // against the end of a system page.
136 static const size_t kPartitionPageShift = 14; // 16KB 136 static const size_t kPartitionPageShift = 14; // 16KB
137 static const size_t kPartitionPageSize = 1 << kPartitionPageShift; 137 static const size_t kPartitionPageSize = 1 << kPartitionPageShift;
138 static const size_t kPartitionPageOffsetMask = kPartitionPageSize - 1; 138 static const size_t kPartitionPageOffsetMask = kPartitionPageSize - 1;
139 static const size_t kPartitionPageBaseMask = ~kPartitionPageOffsetMask; 139 static const size_t kPartitionPageBaseMask = ~kPartitionPageOffsetMask;
140 static const size_t kMaxPartitionPagesPerSlotSpan = 4; 140 static const size_t kMaxPartitionPagesPerSlotSpan = 4;
141 141
142 // To avoid fragmentation via never-used freelist entries, we hand out partition 142 // To avoid fragmentation via never-used freelist entries, we hand out partition
143 // freelist sections gradually, in units of the dominant system page size. 143 // freelist sections gradually, in units of the dominant system page size.
144 // What we're actually doing is avoiding filling the full partition page 144 // What we're actually doing is avoiding filling the full partition page (16 KB)
Jens Widell 2015/09/03 13:11:45 I guess this comment meant to discuss the "bucket
145 // (typically 16KB) will freelist pointers right away. Writing freelist 145 // with freelist pointers right away. Writing freelist pointers will fault and
146 // pointers will fault and dirty a private page, which is very wasteful if we 146 // dirty a private page, which is very wasteful if we never actually store
147 // never actually store objects there. 147 // objects there.
148 static const size_t kNumSystemPagesPerPartitionPage = kPartitionPageSize / kSyst emPageSize; 148 static const size_t kNumSystemPagesPerPartitionPage = kPartitionPageSize / kSyst emPageSize;
149 static const size_t kMaxSystemPagesPerSlotSpan = kNumSystemPagesPerPartitionPage * kMaxPartitionPagesPerSlotSpan; 149 static const size_t kMaxSystemPagesPerSlotSpan = kNumSystemPagesPerPartitionPage * kMaxPartitionPagesPerSlotSpan;
150 150
151 // We reserve virtual address space in 2MB chunks (aligned to 2MB as well). 151 // We reserve virtual address space in 2MB chunks (aligned to 2MB as well).
152 // These chunks are called "super pages". We do this so that we can store 152 // These chunks are called "super pages". We do this so that we can store
153 // metadata in the first few pages of each 2MB aligned section. This leads to 153 // metadata in the first few pages of each 2MB aligned section. This leads to
154 // a very fast free(). We specifically choose 2MB because this virtual address 154 // a very fast free(). We specifically choose 2MB because this virtual address
155 // block represents a full but single PTE allocation on ARM, ia32 and x64. 155 // block represents a full but single PTE allocation on ARM, ia32 and x64.
156 // 156 //
157 // The layout of the super page is as follows. The sizes below are the same 157 // The layout of the super page is as follows. The sizes below are the same
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 using WTF::partitionAlloc; 811 using WTF::partitionAlloc;
812 using WTF::partitionFree; 812 using WTF::partitionFree;
813 using WTF::partitionAllocGeneric; 813 using WTF::partitionAllocGeneric;
814 using WTF::partitionFreeGeneric; 814 using WTF::partitionFreeGeneric;
815 using WTF::partitionReallocGeneric; 815 using WTF::partitionReallocGeneric;
816 using WTF::partitionAllocActualSize; 816 using WTF::partitionAllocActualSize;
817 using WTF::partitionAllocSupportsGetSize; 817 using WTF::partitionAllocSupportsGetSize;
818 using WTF::partitionAllocGetSize; 818 using WTF::partitionAllocGetSize;
819 819
820 #endif // WTF_PartitionAlloc_h 820 #endif // WTF_PartitionAlloc_h
OLDNEW
« no previous file with comments | « Source/wtf/PageAllocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698