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

Unified Diff: runtime/vm/pages.cc

Issue 534653002: Bump allocation for promotion (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | « runtime/vm/pages.h ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/pages.cc
===================================================================
--- runtime/vm/pages.cc (revision 39806)
+++ runtime/vm/pages.cc (working copy)
@@ -770,17 +770,22 @@
}
-uword PageSpace::TryAllocateDataBump(intptr_t size,
- GrowthPolicy growth_policy) {
+uword PageSpace::TryAllocateDataBumpInternal(intptr_t size,
+ GrowthPolicy growth_policy,
+ bool is_locked) {
ASSERT(size >= kObjectAlignment);
ASSERT(Utils::IsAligned(size, kObjectAlignment));
intptr_t remaining = bump_end_ - bump_top_;
if (remaining < size) {
// Checking this first would be logical, but needlessly slow.
if (size >= kAllocatablePageSize) {
- return TryAllocate(size, HeapPage::kData, growth_policy);
+ return is_locked ?
+ TryAllocateDataLocked(size, growth_policy) :
+ TryAllocate(size, HeapPage::kData, growth_policy);
}
- FreeListElement* block = freelist_[HeapPage::kData].TryAllocateLarge(size);
+ FreeListElement* block = is_locked ?
+ freelist_[HeapPage::kData].TryAllocateLargeLocked(size) :
+ freelist_[HeapPage::kData].TryAllocateLarge(size);
if (block == NULL) {
// Allocating from a new page (if growth policy allows) will have the
// side-effect of populating the freelist with a large block. The next
@@ -789,9 +794,16 @@
return TryAllocateInFreshPage(size,
HeapPage::kData,
growth_policy,
- /* is_locked = */ false);
+ is_locked);
}
intptr_t block_size = block->Size();
+ if (remaining > 0) {
+ if (is_locked) {
+ freelist_[HeapPage::kData].FreeLocked(bump_top_, remaining);
+ } else {
+ freelist_[HeapPage::kData].Free(bump_top_, remaining);
+ }
+ }
bump_top_ = reinterpret_cast<uword>(block);
bump_end_ = bump_top_ + block_size;
remaining = block_size;
@@ -808,6 +820,32 @@
}
+uword PageSpace::TryAllocateDataBump(intptr_t size,
+ GrowthPolicy growth_policy) {
+ return TryAllocateDataBumpInternal(size, growth_policy, false);
+}
+
+
+uword PageSpace::TryAllocateDataBumpLocked(intptr_t size,
+ GrowthPolicy growth_policy) {
+ return TryAllocateDataBumpInternal(size, growth_policy, true);
+}
+
+
+uword PageSpace::TryAllocatePromoLocked(intptr_t size,
+ GrowthPolicy growth_policy) {
+ FreeList* freelist = &freelist_[HeapPage::kData];
+ uword result = freelist->TryAllocateSmallLocked(size);
+ if (result != 0) {
+ usage_.used_in_words += size >> kWordSizeLog2;
+ return result;
+ }
+ result = TryAllocateDataBumpLocked(size, growth_policy);
+ if (result != 0) return result;
+ return TryAllocateDataLocked(size, growth_policy);
+}
+
+
PageSpaceController::PageSpaceController(Heap* heap,
int heap_growth_ratio,
int heap_growth_max,
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698