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

Unified Diff: third_party/WebKit/Source/platform/heap/PageMemory.h

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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/PageMemory.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/PageMemory.h
diff --git a/third_party/WebKit/Source/platform/heap/PageMemory.h b/third_party/WebKit/Source/platform/heap/PageMemory.h
index 61b7038743f502188ed2a2fea67a378c927a6e85..3bf0e5db6d67844f0462b5a1cf48e7bf04607885 100644
--- a/third_party/WebKit/Source/platform/heap/PageMemory.h
+++ b/third_party/WebKit/Source/platform/heap/PageMemory.h
@@ -68,13 +68,13 @@ public:
void markPageUsed(Address page)
{
- ASSERT(!m_inUse[index(page)]);
- m_inUse[index(page)] = true;
+ ASSERT(!(m_inUseBitmap & index(page)));
+ m_inUseBitmap |= index(page);
}
void markPageUnused(Address page)
{
- m_inUse[index(page)] = false;
+ m_inUseBitmap &= ~index(page);
}
static PageMemoryRegion* allocateLargePage(size_t size)
@@ -90,7 +90,7 @@ public:
BasePage* pageFromAddress(Address address)
{
ASSERT(contains(address));
- if (!m_inUse[index(address)])
+ if (!(m_inUseBitmap & index(address)))
return nullptr;
if (m_isLargePage)
return pageFromObject(base());
@@ -100,20 +100,22 @@ public:
private:
PageMemoryRegion(Address base, size_t, unsigned numPages);
- unsigned index(Address address)
+ // Returns word with the bit set which corresponds to the |address|'
+ // page within a region.
+ unsigned index(Address address) const
{
ASSERT(contains(address));
if (m_isLargePage)
- return 0;
+ return 0x1;
size_t offset = blinkPageAddress(address) - base();
ASSERT(offset % blinkPageSize == 0);
- return offset / blinkPageSize;
+ return 0x1 << (offset / blinkPageSize);
}
static PageMemoryRegion* allocate(size_t, unsigned numPages);
bool m_isLargePage;
- bool m_inUse[blinkPagesPerRegion];
+ unsigned m_inUseBitmap;
unsigned m_numPages;
};
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/PageMemory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698