Commit 2ba7f948 authored by hpayer's avatar hpayer Committed by Commit bot

Always shrink initial old generation size based on survival rate.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#26715}
parent b023875e
......@@ -31,7 +31,7 @@ GCTracer::ContextDisposalEvent::ContextDisposalEvent(double time) {
}
GCTracer::PromotionEvent::PromotionEvent(double promotion_ratio) {
GCTracer::SurvivalEvent::SurvivalEvent(double promotion_ratio) {
promotion_ratio_ = promotion_ratio;
}
......@@ -257,8 +257,8 @@ void GCTracer::AddContextDisposalTime(double time) {
}
void GCTracer::AddPromotionRatio(double promotion_ratio) {
promotion_events_.push_front(PromotionEvent(promotion_ratio));
void GCTracer::AddSurvivalRatio(double promotion_ratio) {
survival_events_.push_front(SurvivalEvent(promotion_ratio));
}
......@@ -374,7 +374,7 @@ void GCTracer::PrintNVP() const {
PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_);
PrintF("nodes_promoted=%d ", heap_->nodes_promoted_);
PrintF("promotion_ratio=%.1f%% ", heap_->promotion_ratio_);
PrintF("average_promotion_ratio=%.1f%% ", AveragePromotionRatio());
PrintF("average_survival_ratio=%.1f%% ", AverageSurvivalRatio());
PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_);
PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_);
PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ",
......@@ -572,25 +572,25 @@ double GCTracer::ContextDisposalRateInMilliseconds() const {
}
double GCTracer::AveragePromotionRatio() const {
if (promotion_events_.size() == 0) return 0.0;
double GCTracer::AverageSurvivalRatio() const {
if (survival_events_.size() == 0) return 0.0;
double sum_of_rates = 0.0;
PromotionEventBuffer::const_iterator iter = promotion_events_.begin();
while (iter != promotion_events_.end()) {
SurvivalEventBuffer::const_iterator iter = survival_events_.begin();
while (iter != survival_events_.end()) {
sum_of_rates += iter->promotion_ratio_;
++iter;
}
return sum_of_rates / static_cast<double>(promotion_events_.size());
return sum_of_rates / static_cast<double>(survival_events_.size());
}
bool GCTracer::SurvivalEventsRecorded() const {
return promotion_events_.size() > 0;
return survival_events_.size() > 0;
}
void GCTracer::ResetSurvivalEvents() { promotion_events_.reset(); }
void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); }
}
} // namespace v8::internal
......@@ -165,12 +165,12 @@ class GCTracer {
};
class PromotionEvent {
class SurvivalEvent {
public:
// Default constructor leaves the event uninitialized.
PromotionEvent() {}
SurvivalEvent() {}
explicit PromotionEvent(double promotion_ratio);
explicit SurvivalEvent(double survival_ratio);
double promotion_ratio_;
};
......@@ -284,7 +284,7 @@ class GCTracer {
typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize>
ContextDisposalEventBuffer;
typedef RingBuffer<PromotionEvent, kRingBufferMaxSize> PromotionEventBuffer;
typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer;
explicit GCTracer(Heap* heap);
......@@ -300,7 +300,7 @@ class GCTracer {
void AddContextDisposalTime(double time);
void AddPromotionRatio(double promotion_ratio);
void AddSurvivalRatio(double survival_ratio);
// Log an incremental marking step.
void AddIncrementalMarkingStep(double duration, intptr_t bytes);
......@@ -388,10 +388,10 @@ class GCTracer {
// Returns 0 if no events have been recorded.
double ContextDisposalRateInMilliseconds() const;
// Computes the average promotion ratio based on the last recorded promotion
// Computes the average survival ratio based on the last recorded survival
// events.
// Returns 0 if no events have been recorded.
double AveragePromotionRatio() const;
double AverageSurvivalRatio() const;
// Returns true if at least one survival event was recorded.
bool SurvivalEventsRecorded() const;
......@@ -452,8 +452,8 @@ class GCTracer {
// RingBuffer for context disposal events.
ContextDisposalEventBuffer context_disposal_events_;
// RingBuffer for promotion events.
PromotionEventBuffer promotion_events_;
// RingBuffer for survival events.
SurvivalEventBuffer survival_events_;
// Cumulative number of incremental marking steps since creation of tracer.
int cumulative_incremental_marking_steps_;
......
......@@ -1092,8 +1092,6 @@ void Heap::UpdateSurvivalStatistics(int start_new_space_size) {
promotion_ratio_ = (static_cast<double>(promoted_objects_size_) /
static_cast<double>(start_new_space_size) * 100);
if (gc_count_ > 1) tracer()->AddPromotionRatio(promotion_ratio_);
if (previous_semi_space_copied_object_size_ > 0) {
promotion_rate_ =
(static_cast<double>(promoted_objects_size_) /
......@@ -1107,6 +1105,7 @@ void Heap::UpdateSurvivalStatistics(int start_new_space_size) {
static_cast<double>(start_new_space_size) * 100);
double survival_rate = promotion_ratio_ + semi_space_copied_rate_;
tracer()->AddSurvivalRatio(survival_rate);
if (survival_rate > kYoungSurvivalRateHighThreshold) {
high_survival_rate_period_length_++;
} else {
......@@ -2418,8 +2417,8 @@ void Heap::ConfigureInitialOldGenerationSize() {
old_generation_allocation_limit_ =
Max(kMinimumOldGenerationAllocationLimit,
static_cast<intptr_t>(
static_cast<double>(initial_old_generation_size_) *
(tracer()->AveragePromotionRatio() / 100)));
static_cast<double>(old_generation_allocation_limit_) *
(tracer()->AverageSurvivalRatio() / 100)));
}
}
......
......@@ -1084,7 +1084,7 @@ class Heap {
static const intptr_t kMinimumOldGenerationAllocationLimit =
8 * (Page::kPageSize > MB ? Page::kPageSize : MB);
static const int kInitalOldGenerationLimitFactor = 7;
static const int kInitalOldGenerationLimitFactor = 2;
static const int kPointerMultiplier = i::kPointerSize / 4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment