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

Unified Diff: Source/platform/heap/HeapPage.cpp

Issue 1319163003: Oilpan: Remove a redundant loop from NormalPageHeap::allocatePage() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/HeapPage.cpp
diff --git a/Source/platform/heap/HeapPage.cpp b/Source/platform/heap/HeapPage.cpp
index 7733e6875fa651b1ef1e793a532c5a26cac8a169..85ca1afc8c9edc7b8ea0ae5b17d38c0f39776149 100644
--- a/Source/platform/heap/HeapPage.cpp
+++ b/Source/platform/heap/HeapPage.cpp
@@ -521,9 +521,8 @@ void NormalPageHeap::allocatePage()
{
threadState()->shouldFlushHeapDoesNotContainCache();
PageMemory* pageMemory = Heap::freePagePool()->takeFreePage(heapIndex());
- // We continue allocating page memory until we succeed in committing one.
- size_t numberOfTrials = 0;
- while (!pageMemory) {
+
+ if (!pageMemory) {
// Allocate a memory region for blinkPagesPerRegion pages that
// will each have the following layout.
//
@@ -537,20 +536,18 @@ void NormalPageHeap::allocatePage()
// Take the first possible page ensuring that this thread actually
// gets a page and add the rest to the page pool.
if (!pageMemory) {
- if (memory->commit())
- pageMemory = memory;
- else
- delete memory;
+ bool result = memory->commit();
+ // If you hit the ASSERT, it will mean that you're hitting
+ // the limit of the number of mmapped regions OS can support
+ // (e.g., /proc/sys/vm/max_map_count in Linux).
+ RELEASE_ASSERT(result);
+ pageMemory = memory;
} else {
Heap::freePagePool()->addFreePage(heapIndex(), memory);
}
}
- ++numberOfTrials;
- // If you hit the ASSERT, it means that you're hitting the limit of
- // the number of mmapped regions OS can support
- // (e.g., /proc/sys/vm/max_map_count in Linux).
- RELEASE_ASSERT(numberOfTrials < 64);
}
+
NormalPage* page = new (pageMemory->writableStart()) NormalPage(pageMemory, this);
page->link(&m_firstPage);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698