Reviewers: Erik Corry,
Message:
Please take a look.
http://codereview.chromium.org/10209026/diff/1/src/heap.cc
File src/heap.cc (left):
http://codereview.chromium.org/10209026/diff/1/src/heap.cc#oldcode5063
src/heap.cc:5063: if (!WorthStartingGCWhenIdle()) {
Experiments show that it is better not to finish the idle round too
early.
Description:
Make sure idle notifications perform a round of incremental GCs after
context
disposal.
BUG=2107
Please review this at http://codereview.chromium.org/10209026/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/heap.h
M src/heap.cc
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
322a9067437217653739f95a68a8a0d3046ad3dc..e1f28bf3cf83759819600303fe0b1e59a9203945
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -4992,8 +4992,10 @@ void Heap::AdvanceIdleIncrementalMarking(intptr_t
step_size) {
bool Heap::IdleNotification(int hint) {
const int kMaxHint = 1000;
- intptr_t size_factor = Min(Max(hint, 30), kMaxHint) / 10;
- // The size factor is in range [3..100].
+ intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4;
+ // The size factor is in range [5..250]. The numbers here are chosen from
+ // experiments. If you changes them, make sure to test with
+ // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.*
intptr_t step_size = size_factor *
IncrementalMarking::kAllocatedThreshold;
if (contexts_disposed_ > 0) {
@@ -5017,11 +5019,14 @@ bool Heap::IdleNotification(int hint) {
// Take into account that we might have decided to delay full
collection
// because incremental marking is in progress.
ASSERT((contexts_disposed_ == 0) |
| !incremental_marking()->IsStopped());
+ // After context disposal there is likely a lot of garbage remaining,
reset
+ // the idle notification counters in order to trigger more incremental
GCs
+ // on subsequent idle notifications.
+ StartIdleRound();
return false;
}
- if (hint >= kMaxHint || !FLAG_incremental_marking ||
- FLAG_expose_gc || Serializer::enabled()) {
+ if (!FLAG_incremental_marking || FLAG_expose_gc ||
Serializer::enabled()) {
return IdleGlobalGC();
}
@@ -5060,10 +5065,6 @@ bool Heap::IdleNotification(int hint) {
}
if (incremental_marking()->IsStopped()) {
- if (!WorthStartingGCWhenIdle()) {
- FinishIdleRound();
- return true;
- }
incremental_marking()->Start();
}
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index
10d3e3a39cd17c49bd322393758864ae01994692..b91416fb08f7fb4b1dbd239d14ea485c05b0cf61
100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -1990,13 +1990,6 @@ class Heap {
return (scavenges_since_last_idle_round_ >= kIdleScavengeThreshold);
}
- bool WorthStartingGCWhenIdle() {
- if (contexts_disposed_ > 0) {
- return true;
- }
- return incremental_marking()->WorthActivating();
- }
-
// Estimates how many milliseconds a Mark-Sweep would take to complete.
// In idle notification handler we assume that this function will return:
// - a number less than 10 for small heaps, which are less than 8Mb.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev