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

Unified Diff: src/heap/heap.cc

Issue 662543008: Shrink new space in idle notification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 2349f2fa4fe3a013e3510aba3f85a4f4d2a6a4a8..38e4971f4aa55933194c8a4053f3b07a9185d438 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1570,6 +1570,8 @@ void Heap::Scavenge() {
LOG(isolate_, ResourceEvent("scavenge", "end"));
gc_state_ = NOT_IN_GC;
+
+ gc_idle_time_handler_.NotifyScavenge();
}
@@ -4301,6 +4303,23 @@ void Heap::MakeHeapIterable() {
}
+void Heap::IdleMarkCompact(const char* message) {
+ bool uncommit = false;
+ if (gc_count_at_last_idle_gc_ == gc_count_) {
+ // No GC since the last full GC, the mutator is probably not active.
+ isolate_->compilation_cache()->Clear();
+ uncommit = true;
+ }
+ CollectAllGarbage(kReduceMemoryFootprintMask, message);
+ gc_idle_time_handler_.NotifyIdleMarkCompact();
+ gc_count_at_last_idle_gc_ = gc_count_;
+ if (uncommit) {
+ new_space_.Shrink();
+ UncommitFromSpace();
+ }
+}
+
+
void Heap::TryFinalizeIdleIncrementalMarking(
size_t idle_time_in_ms, size_t size_of_objects,
size_t mark_compact_speed_in_bytes_per_ms) {
@@ -4309,20 +4328,7 @@ void Heap::TryFinalizeIdleIncrementalMarking(
gc_idle_time_handler_.ShouldDoMarkCompact(
idle_time_in_ms, size_of_objects,
mark_compact_speed_in_bytes_per_ms))) {
- bool uncommit = false;
- if (gc_count_at_last_idle_gc_ == gc_count_) {
- // No GC since the last full GC, the mutator is probably not active.
- isolate_->compilation_cache()->Clear();
- uncommit = true;
- }
- CollectAllGarbage(kReduceMemoryFootprintMask,
- "idle notification: finalize incremental");
- gc_idle_time_handler_.NotifyIdleMarkCompact();
- gc_count_at_last_idle_gc_ = gc_count_;
- if (uncommit) {
- new_space_.Shrink();
- UncommitFromSpace();
- }
+ IdleMarkCompact("idle notification: finalize incremental");
}
}
@@ -4392,11 +4398,14 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
}
case DO_FULL_GC: {
HistogramTimerScope scope(isolate_->counters()->gc_context());
- const char* message = contexts_disposed_
- ? "idle notification: contexts disposed"
- : "idle notification: finalize idle round";
- CollectAllGarbage(kReduceMemoryFootprintMask, message);
- gc_idle_time_handler_.NotifyIdleMarkCompact();
+ if (contexts_disposed_) {
+ CollectAllGarbage(kReduceMemoryFootprintMask,
ulan 2014/10/23 15:09:09 First version didn't have this branch and uncondit
+ "idle notification: contexts disposed");
+ gc_idle_time_handler_.NotifyIdleMarkCompact();
+ gc_count_at_last_idle_gc_ = gc_count_;
+ } else {
+ IdleMarkCompact("idle notification: finalize idle round");
+ }
break;
}
case DO_SCAVENGE:
« 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