| Index: src/heap/memory-reducer.cc
|
| diff --git a/src/heap/memory-reducer.cc b/src/heap/memory-reducer.cc
|
| index 22d0b482666b69951ba53f472909f9b5114bc40e..2aed4c714a38064d7091a908229c062e2e5a4b3f 100644
|
| --- a/src/heap/memory-reducer.cc
|
| +++ b/src/heap/memory-reducer.cc
|
| @@ -24,19 +24,16 @@ MemoryReducer::TimerTask::TimerTask(MemoryReducer* memory_reducer)
|
|
|
|
|
| void MemoryReducer::TimerTask::RunInternal() {
|
| - const double kJsCallsPerMsThreshold = 0.5;
|
| Heap* heap = memory_reducer_->heap();
|
| Event event;
|
| double time_ms = heap->MonotonicallyIncreasingTimeInMs();
|
| heap->tracer()->SampleAllocation(time_ms, heap->NewSpaceAllocationCounter(),
|
| heap->OldGenerationAllocationCounter());
|
| - double js_call_rate = memory_reducer_->SampleAndGetJsCallsPerMs(time_ms);
|
| bool low_allocation_rate = heap->HasLowAllocationRate();
|
| - bool is_idle = js_call_rate < kJsCallsPerMsThreshold && low_allocation_rate;
|
| bool optimize_for_memory = heap->ShouldOptimizeForMemoryUsage();
|
| if (FLAG_trace_gc_verbose) {
|
| heap->isolate()->PrintWithTimestamp(
|
| - "Memory reducer: call rate %.3lf, %s, %s\n", js_call_rate,
|
| + "Memory reducer: %s, %s\n",
|
| low_allocation_rate ? "low alloc" : "high alloc",
|
| optimize_for_memory ? "background" : "foreground");
|
| }
|
| @@ -45,7 +42,8 @@ void MemoryReducer::TimerTask::RunInternal() {
|
| // The memory reducer will start incremental markig if
|
| // 1) mutator is likely idle: js call rate is low and allocation rate is low.
|
| // 2) mutator is in background: optimize for memory flag is set.
|
| - event.should_start_incremental_gc = is_idle || optimize_for_memory;
|
| + event.should_start_incremental_gc =
|
| + low_allocation_rate || optimize_for_memory;
|
| event.can_start_incremental_gc =
|
| heap->incremental_marking()->IsStopped() &&
|
| (heap->incremental_marking()->CanBeActivated() || optimize_for_memory);
|
| @@ -53,16 +51,6 @@ void MemoryReducer::TimerTask::RunInternal() {
|
| }
|
|
|
|
|
| -double MemoryReducer::SampleAndGetJsCallsPerMs(double time_ms) {
|
| - unsigned int counter = heap()->isolate()->js_calls_from_api_counter();
|
| - unsigned int call_delta = counter - js_calls_counter_;
|
| - double time_delta_ms = time_ms - js_calls_sample_time_ms_;
|
| - js_calls_counter_ = counter;
|
| - js_calls_sample_time_ms_ = time_ms;
|
| - return time_delta_ms > 0 ? call_delta / time_delta_ms : 0;
|
| -}
|
| -
|
| -
|
| void MemoryReducer::NotifyTimer(const Event& event) {
|
| DCHECK_EQ(kTimer, event.type);
|
| DCHECK_EQ(kWait, state_.action);
|
| @@ -196,8 +184,6 @@ MemoryReducer::State MemoryReducer::Step(const State& state,
|
|
|
| void MemoryReducer::ScheduleTimer(double time_ms, double delay_ms) {
|
| DCHECK(delay_ms > 0);
|
| - // Record the time and the js call counter.
|
| - SampleAndGetJsCallsPerMs(time_ms);
|
| // Leave some room for precision error in task scheduler.
|
| const double kSlackMs = 100;
|
| v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap()->isolate());
|
|
|