Commit 35b88a35 authored by hpayer's avatar hpayer Committed by Commit bot

Use more conservative average promotion ratio for initial heap size.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#26238}
parent 0aef24e2
......@@ -31,8 +31,8 @@ GCTracer::ContextDisposalEvent::ContextDisposalEvent(double time) {
}
GCTracer::SurvivalEvent::SurvivalEvent(double survival_rate) {
survival_rate_ = survival_rate;
GCTracer::PromotionEvent::PromotionEvent(double promotion_ratio) {
promotion_ratio_ = promotion_ratio;
}
......@@ -257,8 +257,8 @@ void GCTracer::AddContextDisposalTime(double time) {
}
void GCTracer::AddSurvivalRate(double survival_rate) {
survival_events_.push_front(SurvivalEvent(survival_rate));
void GCTracer::AddPromotionRatio(double promotion_ratio) {
promotion_events_.push_front(PromotionEvent(promotion_ratio));
}
......@@ -372,9 +372,9 @@ 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("promotion_rate=%.1f%% ", heap_->promotion_rate_);
PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_);
PrintF("average_survival_rate%.1f%% ", AverageSurvivalRate());
PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ",
NewSpaceAllocationThroughputInBytesPerMillisecond());
PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds());
......@@ -570,25 +570,25 @@ double GCTracer::ContextDisposalRateInMilliseconds() const {
}
double GCTracer::AverageSurvivalRate() const {
if (survival_events_.size() == 0) return 0.0;
double GCTracer::AveragePromotionRatio() const {
if (promotion_events_.size() == 0) return 0.0;
double sum_of_rates = 0.0;
SurvivalEventBuffer::const_iterator iter = survival_events_.begin();
while (iter != survival_events_.end()) {
sum_of_rates += iter->survival_rate_;
PromotionEventBuffer::const_iterator iter = promotion_events_.begin();
while (iter != promotion_events_.end()) {
sum_of_rates += iter->promotion_ratio_;
++iter;
}
return sum_of_rates / static_cast<double>(survival_events_.size());
return sum_of_rates / static_cast<double>(promotion_events_.size());
}
bool GCTracer::SurvivalEventsRecorded() const {
return survival_events_.size() > 0;
return promotion_events_.size() > 0;
}
void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); }
void GCTracer::ResetSurvivalEvents() { promotion_events_.reset(); }
}
} // namespace v8::internal
......@@ -164,14 +164,14 @@ class GCTracer {
};
class SurvivalEvent {
class PromotionEvent {
public:
// Default constructor leaves the event uninitialized.
SurvivalEvent() {}
PromotionEvent() {}
explicit SurvivalEvent(double survival_rate);
explicit PromotionEvent(double promotion_ratio);
double survival_rate_;
double promotion_ratio_;
};
......@@ -283,7 +283,7 @@ class GCTracer {
typedef RingBuffer<ContextDisposalEvent, kRingBufferMaxSize>
ContextDisposalEventBuffer;
typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer;
typedef RingBuffer<PromotionEvent, kRingBufferMaxSize> PromotionEventBuffer;
explicit GCTracer(Heap* heap);
......@@ -299,7 +299,7 @@ class GCTracer {
void AddContextDisposalTime(double time);
void AddSurvivalRate(double survival_rate);
void AddPromotionRatio(double promotion_ratio);
// Log an incremental marking step.
void AddIncrementalMarkingStep(double duration, intptr_t bytes);
......@@ -387,10 +387,10 @@ class GCTracer {
// Returns 0 if no events have been recorded.
double ContextDisposalRateInMilliseconds() const;
// Computes the average survival rate based on the last recorded survival
// Computes the average promotion ratio based on the last recorded promotion
// events.
// Returns 0 if no events have been recorded.
double AverageSurvivalRate() const;
double AveragePromotionRatio() const;
// Returns true if at least one survival event was recorded.
bool SurvivalEventsRecorded() const;
......@@ -451,8 +451,8 @@ class GCTracer {
// RingBuffer for context disposal events.
ContextDisposalEventBuffer context_disposal_events_;
// RingBuffer for survival events.
SurvivalEventBuffer survival_events_;
// RingBuffer for promotion events.
PromotionEventBuffer promotion_events_;
// Cumulative number of incremental marking steps since creation of tracer.
int cumulative_incremental_marking_steps_;
......
......@@ -67,7 +67,7 @@ Heap::Heap()
initial_semispace_size_(Page::kPageSize),
target_semispace_size_(Page::kPageSize),
max_old_generation_size_(700ul * (kPointerSize / 4) * MB),
initial_old_generation_size_(max_old_generation_size_ / 2),
initial_old_generation_size_(max_old_generation_size_),
old_generation_size_configured_(false),
max_executable_size_(256ul * (kPointerSize / 4) * MB),
// Variables set based on semispace_size_ and old_generation_size_ in
......@@ -1048,6 +1048,8 @@ 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_) /
......@@ -1061,8 +1063,6 @@ 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()->AddSurvivalRate(survival_rate);
if (survival_rate > kYoungSurvivalRateHighThreshold) {
high_survival_rate_period_length_++;
} else {
......@@ -2372,7 +2372,7 @@ void Heap::ConfigureInitialOldGenerationSize() {
Max(kMinimumOldGenerationAllocationLimit,
static_cast<intptr_t>(
static_cast<double>(initial_old_generation_size_) *
(tracer()->AverageSurvivalRate() / 100)));
(tracer()->AveragePromotionRatio() / 100)));
}
}
......
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