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

Unified Diff: src/heap/heap.cc

Issue 1140693003: Shrink active semi-space and uncommit other semi-space only in idle memory mode. (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
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | 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 181bc2ca78232f440fdafeccf89e1f346fd0dbcf..7c1fff2af61b2361534108f74c46e762948bcced 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4578,18 +4578,8 @@ void Heap::MakeHeapIterable() {
DCHECK(IsHeapIterable());
}
-
-void Heap::ReduceNewSpaceSize(bool is_long_idle_notification) {
- if (is_long_idle_notification) {
- new_space_.Shrink();
- UncommitFromSpace();
- }
-}
-
-
bool Heap::TryFinalizeIdleIncrementalMarking(
- bool is_long_idle_notification, double idle_time_in_ms,
- size_t size_of_objects,
+ double idle_time_in_ms, size_t size_of_objects,
size_t final_incremental_mark_compact_speed_in_bytes_per_ms) {
if (FLAG_overapproximate_weak_closure &&
(incremental_marking()->IsReadyToOverApproximateWeakClosure() ||
@@ -4607,7 +4597,6 @@ bool Heap::TryFinalizeIdleIncrementalMarking(
final_incremental_mark_compact_speed_in_bytes_per_ms))) {
CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental");
gc_idle_time_handler_.NotifyIdleMarkCompact();
- ReduceNewSpaceSize(is_long_idle_notification);
return true;
}
return false;
@@ -4714,8 +4703,7 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
!mark_compact_collector_.marking_deque()->IsEmpty());
if (remaining_idle_time_in_ms > 0.0) {
action.additional_work = TryFinalizeIdleIncrementalMarking(
- is_long_idle_notification, remaining_idle_time_in_ms,
- heap_state.size_of_objects,
+ remaining_idle_time_in_ms, heap_state.size_of_objects,
heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms);
}
break;
@@ -4732,13 +4720,11 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
"idle notification: finalize idle round");
}
gc_count_at_last_idle_gc_ = gc_count_;
- ReduceNewSpaceSize(is_long_idle_notification);
gc_idle_time_handler_.NotifyIdleMarkCompact();
break;
}
case DO_SCAVENGE:
CollectGarbage(NEW_SPACE, "idle notification: scavenge");
- ReduceNewSpaceSize(is_long_idle_notification);
break;
case DO_FINALIZE_SWEEPING:
mark_compact_collector()->EnsureSweepingCompleted();
@@ -4747,6 +4733,11 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
break;
}
+ if (action.reduce_memory) {
+ new_space_.Shrink();
+ UncommitFromSpace();
+ }
+
double current_time = MonotonicallyIncreasingTimeInMs();
last_idle_notification_time_ = current_time;
double deadline_difference = deadline_in_ms - current_time;
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698