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

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

Issue 1748363005: Use a bitmap to record PageMemoryRegion usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « third_party/WebKit/Source/platform/heap/PageMemory.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 // 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/Assertions.h" 8 #include "wtf/Assertions.h"
9 #include "wtf/PageAllocator.h" 9 #include "wtf/PageAllocator.h"
10 10
(...skipping 13 matching lines...) Expand all
24 void MemoryRegion::decommit() 24 void MemoryRegion::decommit()
25 { 25 {
26 WTF::decommitSystemPages(m_base, m_size); 26 WTF::decommitSystemPages(m_base, m_size);
27 WTF::setSystemPagesInaccessible(m_base, m_size); 27 WTF::setSystemPagesInaccessible(m_base, m_size);
28 } 28 }
29 29
30 30
31 PageMemoryRegion::PageMemoryRegion(Address base, size_t size, unsigned numPages) 31 PageMemoryRegion::PageMemoryRegion(Address base, size_t size, unsigned numPages)
32 : MemoryRegion(base, size) 32 : MemoryRegion(base, size)
33 , m_isLargePage(numPages == 1) 33 , m_isLargePage(numPages == 1)
34 , m_inUseBitmap(0)
34 , m_numPages(numPages) 35 , m_numPages(numPages)
35 { 36 {
37 static_assert(blinkPagesPerRegion < 8 * sizeof(unsigned), "PageMemoryRegion' s in-use bitmap must fit within a word.");
36 Heap::addPageMemoryRegion(this); 38 Heap::addPageMemoryRegion(this);
37 for (size_t i = 0; i < blinkPagesPerRegion; ++i)
38 m_inUse[i] = false;
39 } 39 }
40 40
41 PageMemoryRegion::~PageMemoryRegion() 41 PageMemoryRegion::~PageMemoryRegion()
42 { 42 {
43 Heap::removePageMemoryRegion(this); 43 Heap::removePageMemoryRegion(this);
44 release(); 44 release();
45 } 45 }
46 46
47 // TODO(haraken): Like partitionOutOfMemoryWithLotsOfUncommitedPages(), 47 // TODO(haraken): Like partitionOutOfMemoryWithLotsOfUncommitedPages(),
48 // we should probably have a way to distinguish physical memory OOM from 48 // we should probably have a way to distinguish physical memory OOM from
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Overallocate by 2 times OS page size to have space for a 156 // Overallocate by 2 times OS page size to have space for a
157 // guard page at the beginning and end of blink heap page. 157 // guard page at the beginning and end of blink heap page.
158 size_t allocationSize = payloadSize + 2 * blinkGuardPageSize; 158 size_t allocationSize = payloadSize + 2 * blinkGuardPageSize;
159 PageMemoryRegion* pageMemoryRegion = PageMemoryRegion::allocateLargePage(all ocationSize); 159 PageMemoryRegion* pageMemoryRegion = PageMemoryRegion::allocateLargePage(all ocationSize);
160 PageMemory* storage = setupPageMemoryInRegion(pageMemoryRegion, 0, payloadSi ze); 160 PageMemory* storage = setupPageMemoryInRegion(pageMemoryRegion, 0, payloadSi ze);
161 RELEASE_ASSERT(storage->commit()); 161 RELEASE_ASSERT(storage->commit());
162 return storage; 162 return storage;
163 } 163 }
164 164
165 } // namespace blink 165 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/PageMemory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698