| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/heap/memory-reducer.h" | 5 #include "src/heap/memory-reducer.h" |
| 6 | 6 |
| 7 #include "src/flags.h" | 7 #include "src/flags.h" |
| 8 #include "src/heap/gc-tracer.h" | 8 #include "src/heap/gc-tracer.h" |
| 9 #include "src/heap/heap-inl.h" | 9 #include "src/heap/heap-inl.h" |
| 10 #include "src/utils.h" | 10 #include "src/utils.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 } else if (state_.action == kWait) { | 61 } else if (state_.action == kWait) { |
| 62 if (!heap()->incremental_marking()->IsStopped() && | 62 if (!heap()->incremental_marking()->IsStopped() && |
| 63 heap()->ShouldOptimizeForMemoryUsage()) { | 63 heap()->ShouldOptimizeForMemoryUsage()) { |
| 64 // Make progress with pending incremental marking if memory usage has | 64 // Make progress with pending incremental marking if memory usage has |
| 65 // higher priority than latency. This is important for background tabs | 65 // higher priority than latency. This is important for background tabs |
| 66 // that do not send idle notifications. | 66 // that do not send idle notifications. |
| 67 const int kIncrementalMarkingDelayMs = 500; | 67 const int kIncrementalMarkingDelayMs = 500; |
| 68 double deadline = heap()->MonotonicallyIncreasingTimeInMs() + | 68 double deadline = heap()->MonotonicallyIncreasingTimeInMs() + |
| 69 kIncrementalMarkingDelayMs; | 69 kIncrementalMarkingDelayMs; |
| 70 heap()->AdvanceIncrementalMarking( | 70 heap()->incremental_marking()->AdvanceIncrementalMarking( |
| 71 0, deadline, i::IncrementalMarking::StepActions( | 71 0, deadline, i::IncrementalMarking::StepActions( |
| 72 i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 72 i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 73 i::IncrementalMarking::FORCE_MARKING, | 73 i::IncrementalMarking::FORCE_MARKING, |
| 74 i::IncrementalMarking::FORCE_COMPLETION)); | 74 i::IncrementalMarking::FORCE_COMPLETION)); |
| 75 heap()->FinalizeIncrementalMarkingIfComplete( | 75 heap()->FinalizeIncrementalMarkingIfComplete( |
| 76 "Memory reducer: finalize incremental marking"); | 76 "Memory reducer: finalize incremental marking"); |
| 77 } | 77 } |
| 78 // Re-schedule the timer. | 78 // Re-schedule the timer. |
| 79 ScheduleTimer(state_.next_gc_start_ms - event.time_ms); | 79 ScheduleTimer(state_.next_gc_start_ms - event.time_ms); |
| 80 if (FLAG_trace_gc_verbose) { | 80 if (FLAG_trace_gc_verbose) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 auto timer_task = new MemoryReducer::TimerTask(this); | 220 auto timer_task = new MemoryReducer::TimerTask(this); |
| 221 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread( | 221 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread( |
| 222 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0); | 222 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0); |
| 223 } | 223 } |
| 224 | 224 |
| 225 | 225 |
| 226 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); } | 226 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); } |
| 227 | 227 |
| 228 } // internal | 228 } // internal |
| 229 } // v8 | 229 } // v8 |
| OLD | NEW |