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

Unified Diff: src/heap/heap.cc

Issue 1148633005: Uncommit and shrink semi-spaces only on low allocation rate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 5a10a5cd210ac4da9700d1a746410fc787f93c6c..ac8ceef4101da5b65a65a9667dd08657833b1a62 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4565,8 +4565,16 @@ void Heap::MakeHeapIterable() {
}
-void Heap::ReduceNewSpaceSize(GCIdleTimeAction action) {
- if (action.reduce_memory &&
+bool Heap::HasLowAllocationRate(GCIdleTimeHandler::HeapState heap_state) {
+ static const size_t kLowAllocationRate = 1000;
+ return heap_state.current_new_space_allocation_throughput_in_bytes_per_ms <
ulan 2015/05/21 15:21:25 check for heap_state.current_new_space_allocation_
Hannes Payer (out of office) 2015/05/21 17:17:03 Good point! Done.
+ kLowAllocationRate;
+}
+
+
+void Heap::ReduceNewSpaceSize(GCIdleTimeAction action,
+ GCIdleTimeHandler::HeapState heap_state) {
+ if (HasLowAllocationRate(heap_state) &&
(action.type == DO_SCAVENGE || action.type == DO_FULL_GC ||
(action.type == DO_INCREMENTAL_MARKING &&
incremental_marking()->IsStopped()))) {
@@ -4635,6 +4643,8 @@ GCIdleTimeHandler::HeapState Heap::ComputeHeapState(bool reduce_memory) {
heap_state.new_space_capacity = new_space_.Capacity();
heap_state.new_space_allocation_throughput_in_bytes_per_ms =
tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond();
+ heap_state.current_new_space_allocation_throughput_in_bytes_per_ms =
+ tracer()->CurrentNewSpaceAllocationThroughputInBytesPerMillisecond();
return heap_state;
}
@@ -4697,7 +4707,7 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
break;
}
- ReduceNewSpaceSize(action);
+ ReduceNewSpaceSize(action, heap_state);
return result;
}
« src/heap/gc-tracer.cc ('K') | « src/heap/heap.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698