Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: src/heap/heap.cc

Issue 1368983002: [heap] No leakage of gc-idle-time-handler.h outside of heap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Drop obsolete forward declaration. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 31b93e71991e219b5c6050bd0f17bd890f6018ec..1ba02c2461ed5fb7d8a15090284e4be9ffc5b006 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -125,6 +125,7 @@ Heap::Heap()
mark_compact_collector_(this),
store_buffer_(this),
incremental_marking_(this),
+ gc_idle_time_handler_(nullptr),
memory_reducer_(nullptr),
object_stats_(nullptr),
full_codegen_bytes_generated_(0),
@@ -1012,7 +1013,7 @@ void Heap::StartIncrementalMarking(int gc_flags,
void Heap::StartIdleIncrementalMarking() {
- gc_idle_time_handler_.ResetNoProgressCounter();
+ gc_idle_time_handler_->ResetNoProgressCounter();
StartIncrementalMarking(kReduceMemoryFootprintMask, kNoGCCallbackFlags,
"idle");
}
@@ -4074,14 +4075,14 @@ bool Heap::TryFinalizeIdleIncrementalMarking(double idle_time_in_ms) {
(incremental_marking()->IsReadyToOverApproximateWeakClosure() ||
(!incremental_marking()->weak_closure_was_overapproximated() &&
mark_compact_collector_.marking_deque()->IsEmpty() &&
- gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure(
+ gc_idle_time_handler_->ShouldDoOverApproximateWeakClosure(
static_cast<size_t>(idle_time_in_ms))))) {
OverApproximateWeakClosure(
"Idle notification: overapproximate weak closure");
return true;
} else if (incremental_marking()->IsComplete() ||
(mark_compact_collector_.marking_deque()->IsEmpty() &&
- gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact(
+ gc_idle_time_handler_->ShouldDoFinalIncrementalMarkCompact(
static_cast<size_t>(idle_time_in_ms), size_of_objects,
final_incremental_mark_compact_speed_in_bytes_per_ms))) {
CollectAllGarbage(current_gc_flags_,
@@ -4092,8 +4093,8 @@ bool Heap::TryFinalizeIdleIncrementalMarking(double idle_time_in_ms) {
}
-GCIdleTimeHandler::HeapState Heap::ComputeHeapState() {
- GCIdleTimeHandler::HeapState heap_state;
+GCIdleTimeHeapState Heap::ComputeHeapState() {
+ GCIdleTimeHeapState heap_state;
heap_state.contexts_disposed = contexts_disposed_;
heap_state.contexts_disposal_rate =
tracer()->ContextDisposalRateInMilliseconds();
@@ -4137,7 +4138,7 @@ double Heap::AdvanceIncrementalMarking(
bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
- GCIdleTimeHandler::HeapState heap_state,
+ GCIdleTimeHeapState heap_state,
double deadline_in_ms) {
bool result = false;
switch (action.type) {
@@ -4174,7 +4175,7 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
void Heap::IdleNotificationEpilogue(GCIdleTimeAction action,
- GCIdleTimeHandler::HeapState heap_state,
+ GCIdleTimeHeapState heap_state,
double start_ms, double deadline_in_ms) {
double idle_time_in_ms = deadline_in_ms - start_ms;
double current_time = MonotonicallyIncreasingTimeInMs();
@@ -4271,10 +4272,10 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
tracer()->SampleAllocation(start_ms, NewSpaceAllocationCounter(),
OldGenerationAllocationCounter());
- GCIdleTimeHandler::HeapState heap_state = ComputeHeapState();
+ GCIdleTimeHeapState heap_state = ComputeHeapState();
GCIdleTimeAction action =
- gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state);
+ gc_idle_time_handler_->Compute(idle_time_in_ms, heap_state);
bool result = PerformIdleTimeAction(action, heap_state, deadline_in_ms);
@@ -5076,6 +5077,8 @@ bool Heap::SetUp() {
scavenge_collector_ = new Scavenger(this);
+ gc_idle_time_handler_ = new GCIdleTimeHandler();
+
memory_reducer_ = new MemoryReducer(this);
object_stats_ = new ObjectStats(this);
@@ -5190,6 +5193,9 @@ void Heap::TearDown() {
delete scavenge_collector_;
scavenge_collector_ = nullptr;
+ delete gc_idle_time_handler_;
+ gc_idle_time_handler_ = nullptr;
+
if (memory_reducer_ != nullptr) {
memory_reducer_->TearDown();
delete memory_reducer_;
« no previous file with comments | « src/heap/heap.h ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698