From 9b3068bedd748d6e7f3fda66d70cb4babd41a4c2 Mon Sep 17 00:00:00 2001 From: "erik.corry@gmail.com" Date: Fri, 10 Aug 2012 13:45:22 +0000 Subject: [PATCH] Fix intermittent failure in ReleaseOverReservedPages on x64. BUG=v8:2216 Review URL: https://chromiumcodereview.appspot.com/10828253 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12292 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mark-compact.cc | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/mark-compact.cc b/src/mark-compact.cc index 658b02d4f..26b01ae01 100644 --- a/src/mark-compact.cc +++ b/src/mark-compact.cc @@ -631,29 +631,28 @@ void MarkCompactCollector::CollectEvacuationCandidates(PagedSpace* space) { intptr_t over_reserved = reserved - space->SizeOfObjects(); static const intptr_t kFreenessThreshold = 50; - if (over_reserved >= 2 * space->AreaSize()) { + if (reduce_memory_footprint_ && over_reserved >= space->AreaSize()) { // If reduction of memory footprint was requested, we are aggressive // about choosing pages to free. We expect that half-empty pages // are easier to compact so slightly bump the limit. - if (reduce_memory_footprint_) { - mode = REDUCE_MEMORY_FOOTPRINT; - max_evacuation_candidates += 2; - } + mode = REDUCE_MEMORY_FOOTPRINT; + max_evacuation_candidates += 2; + } + + if (over_reserved > reserved / 3 && over_reserved >= 2 * space->AreaSize()) { // If over-usage is very high (more than a third of the space), we // try to free all mostly empty pages. We expect that almost empty // pages are even easier to compact so bump the limit even more. - if (over_reserved > reserved / 3) { - mode = REDUCE_MEMORY_FOOTPRINT; - max_evacuation_candidates *= 2; - } + mode = REDUCE_MEMORY_FOOTPRINT; + max_evacuation_candidates *= 2; + } - if (FLAG_trace_fragmentation && mode == REDUCE_MEMORY_FOOTPRINT) { - PrintF("Estimated over reserved memory: %.1f / %.1f MB (threshold %d)\n", - static_cast(over_reserved) / MB, - static_cast(reserved) / MB, - static_cast(kFreenessThreshold)); - } + if (FLAG_trace_fragmentation && mode == REDUCE_MEMORY_FOOTPRINT) { + PrintF("Estimated over reserved memory: %.1f / %.1f MB (threshold %d)\n", + static_cast(over_reserved) / MB, + static_cast(reserved) / MB, + static_cast(kFreenessThreshold)); } intptr_t estimated_release = 0; -- 2.34.1