diff --git a/src/heap/gc-tracer.cc b/src/heap/gc-tracer.cc index 0bd12cdb5b..a35872dc47 100644 --- a/src/heap/gc-tracer.cc +++ b/src/heap/gc-tracer.cc @@ -587,5 +587,8 @@ double GCTracer::AverageSurvivalRate() const { bool GCTracer::SurvivalEventsRecorded() const { return survival_events_.size() > 0; } + + +void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } } } // namespace v8::internal diff --git a/src/heap/gc-tracer.h b/src/heap/gc-tracer.h index a2e4bc293e..528eb52c64 100644 --- a/src/heap/gc-tracer.h +++ b/src/heap/gc-tracer.h @@ -71,6 +71,11 @@ class RingBuffer { elements_[begin_] = element; } + void reset() { + begin_ = 0; + end_ = 0; + } + private: T elements_[MAX_SIZE + 1]; size_t begin_; @@ -390,6 +395,9 @@ class GCTracer { // Returns true if at least one survival event was recorded. bool SurvivalEventsRecorded() const; + // Discard all recorded survival events. + void ResetSurvivalEvents(); + private: // Print one detailed trace line in name=value format. // TODO(ernstm): Move to Heap. diff --git a/src/heap/heap.cc b/src/heap/heap.cc index 86d48a243b..cf67dab2b4 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -864,7 +864,10 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason, int Heap::NotifyContextDisposed(bool dependant_context) { - // TODO(hpayer): Reset heap shrinking if dependant_context is false. + if (!dependant_context) { + tracer()->ResetSurvivalEvents(); + old_generation_size_configured_ = false; + } if (isolate()->concurrent_recompilation_enabled()) { // Flush the queued recompilation tasks. isolate()->optimizing_compiler_thread()->Flush();