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

Unified Diff: src/heap.cc

Issue 8084002: Start incremental marking on idle notification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | « src/heap.h ('k') | src/incremental-marking.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 522861deda05e2a163861ac527be202631387441..945587f92fb4e63b301d846c4f2e648796c08ca7 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -140,6 +140,7 @@ Heap::Heap()
store_buffer_(this),
marking_(this),
incremental_marking_(this),
+ idle_work_(IDLE_INCREMENTAL_MARKING),
number_idle_notifications_(0),
last_idle_notification_gc_count_(0),
last_idle_notification_gc_count_init_(false),
@@ -4515,6 +4516,36 @@ void Heap::EnsureHeapIsIterable() {
bool Heap::IdleNotification() {
+ switch (idle_work_) {
+ case IDLE_INCREMENTAL_MARKING:
+ if (IdleIncrementalMarking()) {
+ idle_work_ = IDLE_GLOBAL_GC;
+ }
+ break;
+ case IDLE_GLOBAL_GC:
+ if (IdleGlobalGC()) {
+ idle_work_ = IDLE_INCREMENTAL_MARKING;
+ return true;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ return false;
+}
+
+bool Heap::IdleIncrementalMarking() {
+ if (incremental_marking()->IsStopped()) {
+ if (!incremental_marking()->WorthActivating()) {
+ return true;
+ }
+ incremental_marking()->Start();
+ }
+ incremental_marking()->Step(IncrementalMarking::kStepFakeAllocatedBytes);
+ return incremental_marking()->IsComplete();
Vyacheslav Egorov (Chromium) 2011/10/12 07:41:00 when it's complete it makes sense to do a finishin
+}
+
+bool Heap::IdleGlobalGC() {
static const int kIdlesBeforeScavenge = 4;
static const int kIdlesBeforeMarkSweep = 7;
static const int kIdlesBeforeMarkCompact = 8;
« no previous file with comments | « src/heap.h ('k') | src/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698