Commit e01e35fc authored by hpayer's avatar hpayer Committed by Commit bot

Reduce context disposal gc overhead.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#25494}
parent 7cf17a9e
......@@ -142,6 +142,13 @@ bool GCIdleTimeHandler::ShouldDoMarkCompact(
}
bool GCIdleTimeHandler::ShouldDoContextDisposalMarkCompact(
bool context_disposed, double contexts_disposal_rate) {
return context_disposed && contexts_disposal_rate > 0 &&
contexts_disposal_rate < kHighContextDisposalRate;
}
// The following logic is implemented by the controller:
// (1) If we don't have any idle time, do nothing, unless a context was
// disposed, incremental marking is stopped, and the heap is small. Then do
......@@ -163,8 +170,9 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms,
HeapState heap_state) {
if (idle_time_in_ms == 0) {
if (heap_state.incremental_marking_stopped) {
if (heap_state.contexts_disposed > 0 &&
heap_state.contexts_disposal_rate < kHighContextDisposalRate) {
if (ShouldDoContextDisposalMarkCompact(
heap_state.contexts_disposed,
heap_state.contexts_disposal_rate)) {
return GCIdleTimeAction::FullGC();
}
}
......
......@@ -162,6 +162,9 @@ class GCIdleTimeHandler {
size_t size_of_objects,
size_t mark_compact_speed_in_bytes_per_ms);
static bool ShouldDoContextDisposalMarkCompact(bool context_disposed,
double contexts_disposal_rate);
static bool ShouldDoScavenge(
size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size,
size_t scavenger_speed_in_bytes_per_ms,
......
......@@ -490,7 +490,7 @@ intptr_t GCTracer::NewSpaceAllocationThroughputInBytesPerMillisecond() const {
double GCTracer::ContextDisposalRateInMilliseconds() const {
if (context_disposal_events_.size() == 0) return 0.0;
if (context_disposal_events_.size() < kRingBufferMaxSize) return 0.0;
double begin = base::OS::TimeCurrentMillis();
double end = 0.0;
......
......@@ -248,7 +248,7 @@ class GCTracer {
double scopes[Scope::NUMBER_OF_SCOPES];
};
static const int kRingBufferMaxSize = 10;
static const size_t kRingBufferMaxSize = 10;
typedef RingBuffer<Event, kRingBufferMaxSize> EventBuffer;
......
......@@ -4451,8 +4451,7 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
case DO_FULL_GC: {
HistogramTimerScope scope(isolate_->counters()->gc_context());
if (contexts_disposed_) {
CollectAllGarbage(kReduceMemoryFootprintMask,
"idle notification: contexts disposed");
CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed");
gc_idle_time_handler_.NotifyIdleMarkCompact();
gc_count_at_last_idle_gc_ = gc_count_;
} else {
......
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