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

Unified Diff: src/heap/heap.cc

Issue 1284673002: Version 4.5.103.21 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.5
Patch Set: Created 5 years, 4 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 | « src/heap/heap.h ('k') | src/heap/memory-reducer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index d0b29f6b0f35b0d84cae3a58d51fff8baf22bb52..fc36be8041f47bd6520f9a9094d92b4e6004f654 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -109,6 +109,7 @@ Heap::Heap()
#endif // DEBUG
old_generation_allocation_limit_(initial_old_generation_size_),
old_gen_exhausted_(false),
+ optimize_for_memory_usage_(false),
inline_allocation_disabled_(false),
store_buffer_rebuilder_(store_buffer()),
hidden_string_(NULL),
@@ -4967,6 +4968,9 @@ void Heap::CheckAndNotifyBackgroundIdleNotification(double idle_time_in_ms,
event.can_start_incremental_gc = incremental_marking()->IsStopped() &&
incremental_marking()->CanBeActivated();
memory_reducer_.NotifyBackgroundIdleNotification(event);
+ optimize_for_memory_usage_ = true;
+ } else {
+ optimize_for_memory_usage_ = false;
}
}
@@ -5627,6 +5631,8 @@ intptr_t Heap::CalculateOldGenerationAllocationLimit(double factor,
void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size,
double gc_speed,
double mutator_speed) {
+ const double kConservativeHeapGrowingFactor = 1.3;
+
double factor = HeapGrowingFactor(gc_speed, mutator_speed);
if (FLAG_trace_gc_verbose) {
@@ -5644,6 +5650,10 @@ void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size,
factor = Min(factor, kMaxHeapGrowingFactorMemoryConstrained);
}
+ if (memory_reducer_.ShouldGrowHeapSlowly() || optimize_for_memory_usage_) {
+ factor = Min(factor, kConservativeHeapGrowingFactor);
+ }
+
if (FLAG_stress_compaction ||
mark_compact_collector()->reduce_memory_footprint_) {
factor = kMinHeapGrowingFactor;
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/memory-reducer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698