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

Side by Side Diff: third_party/WebKit/Source/platform/heap/PageMemory.cpp

Issue 2614883006: Change PartitionAlloc to Chromium naming style. (Closed)
Patch Set: Rebase and fix some names. Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium 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 #include "platform/heap/PageMemory.h" 5 #include "platform/heap/PageMemory.h"
6 6
7 #include "platform/heap/Heap.h" 7 #include "platform/heap/Heap.h"
8 #include "wtf/AddressSanitizer.h" 8 #include "wtf/AddressSanitizer.h"
9 #include "wtf/Assertions.h" 9 #include "wtf/Assertions.h"
10 #include "wtf/Atomics.h" 10 #include "wtf/Atomics.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 void MemoryRegion::release() { 14 void MemoryRegion::release() {
15 WTF::freePages(m_base, m_size); 15 WTF::FreePages(m_base, m_size);
16 } 16 }
17 17
18 bool MemoryRegion::commit() { 18 bool MemoryRegion::commit() {
19 WTF::recommitSystemPages(m_base, m_size); 19 WTF::RecommitSystemPages(m_base, m_size);
20 return WTF::setSystemPagesAccessible(m_base, m_size); 20 return WTF::SetSystemPagesAccessible(m_base, m_size);
21 } 21 }
22 22
23 void MemoryRegion::decommit() { 23 void MemoryRegion::decommit() {
24 ASAN_UNPOISON_MEMORY_REGION(m_base, m_size); 24 ASAN_UNPOISON_MEMORY_REGION(m_base, m_size);
25 WTF::decommitSystemPages(m_base, m_size); 25 WTF::DecommitSystemPages(m_base, m_size);
26 WTF::setSystemPagesInaccessible(m_base, m_size); 26 WTF::SetSystemPagesInaccessible(m_base, m_size);
27 } 27 }
28 28
29 PageMemoryRegion::PageMemoryRegion(Address base, 29 PageMemoryRegion::PageMemoryRegion(Address base,
30 size_t size, 30 size_t size,
31 unsigned numPages, 31 unsigned numPages,
32 RegionTree* regionTree) 32 RegionTree* regionTree)
33 : MemoryRegion(base, size), 33 : MemoryRegion(base, size),
34 m_isLargePage(numPages == 1), 34 m_isLargePage(numPages == 1),
35 m_numPages(numPages), 35 m_numPages(numPages),
36 m_regionTree(regionTree) { 36 m_regionTree(regionTree) {
(...skipping 21 matching lines...) Expand all
58 OOM_CRASH(); 58 OOM_CRASH();
59 } 59 }
60 60
61 PageMemoryRegion* PageMemoryRegion::allocate(size_t size, 61 PageMemoryRegion* PageMemoryRegion::allocate(size_t size,
62 unsigned numPages, 62 unsigned numPages,
63 RegionTree* regionTree) { 63 RegionTree* regionTree) {
64 // Round size up to the allocation granularity. 64 // Round size up to the allocation granularity.
65 size = (size + WTF::kPageAllocationGranularityOffsetMask) & 65 size = (size + WTF::kPageAllocationGranularityOffsetMask) &
66 WTF::kPageAllocationGranularityBaseMask; 66 WTF::kPageAllocationGranularityBaseMask;
67 Address base = static_cast<Address>( 67 Address base = static_cast<Address>(
68 WTF::allocPages(nullptr, size, blinkPageSize, WTF::PageInaccessible)); 68 WTF::AllocPages(nullptr, size, blinkPageSize, WTF::PageInaccessible));
69 if (!base) 69 if (!base)
70 blinkGCOutOfMemory(); 70 blinkGCOutOfMemory();
71 return new PageMemoryRegion(base, size, numPages, regionTree); 71 return new PageMemoryRegion(base, size, numPages, regionTree);
72 } 72 }
73 73
74 PageMemoryRegion* RegionTree::lookup(Address address) { 74 PageMemoryRegion* RegionTree::lookup(Address address) {
75 MutexLocker locker(m_mutex); 75 MutexLocker locker(m_mutex);
76 RegionTreeNode* current = m_root; 76 RegionTreeNode* current = m_root;
77 while (current) { 77 while (current) {
78 Address base = current->m_region->base(); 78 Address base = current->m_region->base();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 size_t allocationSize = payloadSize + 2 * blinkGuardPageSize; 176 size_t allocationSize = payloadSize + 2 * blinkGuardPageSize;
177 PageMemoryRegion* pageMemoryRegion = 177 PageMemoryRegion* pageMemoryRegion =
178 PageMemoryRegion::allocateLargePage(allocationSize, regionTree); 178 PageMemoryRegion::allocateLargePage(allocationSize, regionTree);
179 PageMemory* storage = 179 PageMemory* storage =
180 setupPageMemoryInRegion(pageMemoryRegion, 0, payloadSize); 180 setupPageMemoryInRegion(pageMemoryRegion, 0, payloadSize);
181 RELEASE_ASSERT(storage->commit()); 181 RELEASE_ASSERT(storage->commit());
182 return storage; 182 return storage;
183 } 183 }
184 184
185 } // namespace blink 185 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapPage.cpp ('k') | third_party/WebKit/Source/platform/text/BidiCharacterRun.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698