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

Unified Diff: src/heap.cc

Issue 199057: Minor change to idle notification handling: perform a scavenge... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 2857)
+++ src/heap.cc (working copy)
@@ -2795,7 +2795,9 @@
bool Heap::IdleNotification() {
- static const int kIdlesBeforeCollection = 7;
+ static const int kIdlesBeforeScavenge = 4;
+ static const int kIdlesBeforeMarkSweep = 7;
+ static const int kIdlesBeforeMarkCompact = 8;
static int number_idle_notifications = 0;
static int last_gc_count = gc_count_;
@@ -2808,19 +2810,22 @@
last_gc_count = gc_count_;
}
- if (number_idle_notifications >= kIdlesBeforeCollection) {
- // The first time through we collect without forcing compaction.
- // The second time through we force compaction and quit.
- bool force_compaction =
- number_idle_notifications > kIdlesBeforeCollection;
- CollectAllGarbage(force_compaction);
+ if (number_idle_notifications == kIdlesBeforeScavenge) {
+ CollectGarbage(0, NEW_SPACE);
+ new_space_.Shrink();
last_gc_count = gc_count_;
- if (force_compaction) {
- // Shrink new space.
- new_space_.Shrink();
- number_idle_notifications = 0;
- finished = true;
- }
+
+ } else if (number_idle_notifications == kIdlesBeforeMarkSweep) {
+ CollectAllGarbage(false);
+ new_space_.Shrink();
+ last_gc_count = gc_count_;
+
+ } else if (number_idle_notifications == kIdlesBeforeMarkCompact) {
+ CollectAllGarbage(true);
+ new_space_.Shrink();
+ last_gc_count = gc_count_;
+ number_idle_notifications = 0;
+ finished = true;
}
// Uncommit unused memory in new space.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698