Shrink new space in idle notification.

BUG=chromium:424423
LOG=Y
R=jochen@chromium.org

Review URL: https://codereview.chromium.org/662543008

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24851 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ulan@chromium.org 2014-10-23 15:16:27 +00:00
parent 463f9ebcb8
commit 8d9381129e
2 changed files with 30 additions and 19 deletions

View File

@ -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,
"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:

View File

@ -1975,6 +1975,8 @@ class Heap {
void SelectScavengingVisitorsTable();
void IdleMarkCompact(const char* message);
void TryFinalizeIdleIncrementalMarking(
size_t idle_time_in_ms, size_t size_of_objects,
size_t mark_compact_speed_in_bytes_per_ms);