Commit e296644f authored by ulan's avatar ulan Committed by Commit bot

Partially revert https://crrev.com/7e53749df0a10f475404e86ef0ca8df02bb79e7a

This fixes memory regression caused by not reducing new-space size.

BUG=chromium:517468
LOG=NO

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

Cr-Commit-Position: refs/heads/master@{#30049}
parent 4b3ded55
......@@ -702,11 +702,15 @@ size_t GCTracer::AllocationThroughputInBytesPerMillisecond(
}
size_t GCTracer::CurrentAllocationThroughputInBytesPerMillisecond() const {
return AllocationThroughputInBytesPerMillisecond(kThroughputTimeFrameMs);
}
size_t GCTracer::CurrentOldGenerationAllocationThroughputInBytesPerMillisecond()
const {
static const double kThroughputTimeFrame = 5000;
return OldGenerationAllocationThroughputInBytesPerMillisecond(
kThroughputTimeFrame);
kThroughputTimeFrameMs);
}
......
......@@ -299,6 +299,8 @@ class GCTracer {
typedef RingBuffer<SurvivalEvent, kRingBufferMaxSize> SurvivalEventBuffer;
static const int kThroughputTimeFrameMs = 5000;
explicit GCTracer(Heap* heap);
// Start collecting data.
......@@ -416,6 +418,11 @@ class GCTracer {
// Returns 0 if no allocation events have been recorded.
size_t AllocationThroughputInBytesPerMillisecond(double time_ms) const;
// Allocation throughput in heap in bytes/milliseconds in
// the last five seconds.
// Returns 0 if no allocation events have been recorded.
size_t CurrentAllocationThroughputInBytesPerMillisecond() const;
// Allocation throughput in old generation in bytes/milliseconds in
// the last five seconds.
// Returns 0 if no allocation events have been recorded.
......
......@@ -4763,7 +4763,13 @@ bool Heap::HasHighFragmentation(intptr_t used, intptr_t committed) {
void Heap::ReduceNewSpaceSize() {
if (!FLAG_predictable && HasLowAllocationRate()) {
// TODO(ulan): Unify this constant with the similar constant in
// GCIdleTimeHandler once the change is merged to 4.5.
static const size_t kLowAllocationThroughput = 1000;
size_t allocation_throughput =
tracer()->CurrentAllocationThroughputInBytesPerMillisecond();
if (FLAG_predictable || allocation_throughput == 0) return;
if (allocation_throughput < kLowAllocationThroughput) {
new_space_.Shrink();
UncommitFromSpace();
}
......
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