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

Unified Diff: src/incremental-marking.cc

Issue 8494012: Clean up the marking speed heuristics. This reduces the (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 1 month 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/incremental-marking.h ('k') | src/incremental-marking-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/incremental-marking.cc
===================================================================
--- src/incremental-marking.cc (revision 9899)
+++ src/incremental-marking.cc (working copy)
@@ -747,6 +747,7 @@
if (state_ == MARKING && no_marking_scope_depth_ > 0) return;
intptr_t bytes_to_process = allocated_ * allocation_marking_factor_;
+ bytes_scanned_ += bytes_to_process;
ulan 2011/11/07 17:24:50 Should the heuristics below be active in SWEEPING
Erik Corry 2011/11/08 10:29:34 Added a reset of this variable when we start marki
double start = 0;
@@ -808,33 +809,50 @@
bool speed_up = false;
+ if ((steps_count_ % kAllocationMarkingFactorSpeedupInterval) == 0) {
+ if (FLAG_trace_gc) {
+ PrintF("Speed up marking after %d steps\n",
+ static_cast<int>(kAllocationMarkingFactorSpeedupInterval));
+ }
+ speed_up = true;
+ }
+
if (old_generation_space_available_at_start_of_incremental_ < 10 * MB ||
- SpaceLeftInOldSpace() <
- old_generation_space_available_at_start_of_incremental_ >> 1) {
- // Half of the space that was available is gone while we were
+ SpaceLeftInOldSpace() * (allocation_marking_factor_ + 1) <
+ old_generation_space_available_at_start_of_incremental_) {
+ // 1/n of the space that was available is gone while we were
ulan 2011/11/07 17:24:50 I think the condition says that 1/n is left and (n
Erik Corry 2011/11/08 10:29:34 Done.
// incrementally marking.
+ if (FLAG_trace_gc) PrintF("Speed up marking because of low space left\n");
speed_up = true;
- old_generation_space_available_at_start_of_incremental_ =
- SpaceLeftInOldSpace();
}
if (heap_->PromotedTotalSize() >
- old_generation_space_used_at_start_of_incremental_ << 1) {
- // Size of old space doubled while we were incrementally marking.
+ (allocation_marking_factor_ + 1) *
+ old_generation_space_used_at_start_of_incremental_) {
+ // Size of old space multiplied by n while we were incrementally marking.
speed_up = true;
- old_generation_space_used_at_start_of_incremental_ =
- heap_->PromotedTotalSize();
+ if (FLAG_trace_gc) {
+ PrintF("Speed up marking because of heap size increase\n");
+ }
}
- if ((steps_count_ % kAllocationMarkingFactorSpeedupInterval) == 0 &&
- allocation_marking_factor_ < kMaxAllocationMarkingFactor) {
+ // We try to scan at at least twice the speed that we are allocating.
+ if ((bytes_scanned_ >> 1)
+ + heap_->MaxSemiSpaceSize() // A single scavenge cannot trigger this.
+ + allocation_marking_factor_ * MB < // Delay before upping again.
ulan 2011/11/07 17:24:50 Possible overflow in allocation_marking_factor_ *
Erik Corry 2011/11/08 10:29:34 Reduced max allocation marking factor to 1000 to a
+ heap_->PromotedTotalSize()
+ - old_generation_space_used_at_start_of_incremental_) {
+ if (FLAG_trace_gc) {
+ PrintF("Speed up marking because marker was not keeping up\n");
+ }
speed_up = true;
}
if (speed_up) {
allocation_marking_factor_ += kAllocationMarkingFactorSpeedup;
allocation_marking_factor_ =
- static_cast<int>(allocation_marking_factor_ * 1.3);
+ Min(kMaxAllocationMarkingFactor,
+ static_cast<intptr_t>(allocation_marking_factor_ * 1.3));
if (FLAG_trace_gc) {
PrintF("Marking speed increased to %d\n", allocation_marking_factor_);
}
@@ -862,6 +880,7 @@
steps_took_since_last_gc_ = 0;
bytes_rescanned_ = 0;
allocation_marking_factor_ = kInitialAllocationMarkingFactor;
+ bytes_scanned_ = 0;
}
« no previous file with comments | « src/incremental-marking.h ('k') | src/incremental-marking-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698