OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 4958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4969 bool Heap::IdleNotification(double deadline_in_seconds) { | 4969 bool Heap::IdleNotification(double deadline_in_seconds) { |
4970 CHECK(HasBeenSetUp()); | 4970 CHECK(HasBeenSetUp()); |
4971 double deadline_in_ms = | 4971 double deadline_in_ms = |
4972 deadline_in_seconds * | 4972 deadline_in_seconds * |
4973 static_cast<double>(base::Time::kMillisecondsPerSecond); | 4973 static_cast<double>(base::Time::kMillisecondsPerSecond); |
4974 HistogramTimerScope idle_notification_scope( | 4974 HistogramTimerScope idle_notification_scope( |
4975 isolate_->counters()->gc_idle_notification()); | 4975 isolate_->counters()->gc_idle_notification()); |
4976 double start_ms = MonotonicallyIncreasingTimeInMs(); | 4976 double start_ms = MonotonicallyIncreasingTimeInMs(); |
4977 double idle_time_in_ms = deadline_in_ms - start_ms; | 4977 double idle_time_in_ms = deadline_in_ms - start_ms; |
4978 | 4978 |
4979 if (idle_time_in_ms >= GCIdleTimeHandler::kMinBackgroundIdleTime) { | |
4980 MemoryReducer::Event event; | |
4981 event.type = MemoryReducer::kBackgroundIdleNotification; | |
4982 event.time_ms = start_ms; | |
4983 event.can_start_incremental_gc = incremental_marking()->IsStopped() && | |
4984 incremental_marking()->CanBeActivated(); | |
4985 memory_reducer_.NotifyBackgroundIdleNotification(event); | |
4986 } | |
Hannes Payer (out of office)
2015/07/07 07:49:34
Let's make this block a method to keep IdleNotific
ulan
2015/07/07 11:58:26
Done.
| |
4987 | |
4979 tracer()->SampleAllocation(start_ms, NewSpaceAllocationCounter(), | 4988 tracer()->SampleAllocation(start_ms, NewSpaceAllocationCounter(), |
4980 OldGenerationAllocationCounter()); | 4989 OldGenerationAllocationCounter()); |
4981 | 4990 |
4982 GCIdleTimeHandler::HeapState heap_state = ComputeHeapState(); | 4991 GCIdleTimeHandler::HeapState heap_state = ComputeHeapState(); |
4983 | 4992 |
4984 GCIdleTimeAction action = | 4993 GCIdleTimeAction action = |
4985 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); | 4994 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); |
4986 | 4995 |
4987 bool result = PerformIdleTimeAction(action, heap_state, deadline_in_ms); | 4996 bool result = PerformIdleTimeAction(action, heap_state, deadline_in_ms); |
4988 | 4997 |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6878 *object_type = "CODE_TYPE"; \ | 6887 *object_type = "CODE_TYPE"; \ |
6879 *object_sub_type = "CODE_AGE/" #name; \ | 6888 *object_sub_type = "CODE_AGE/" #name; \ |
6880 return true; | 6889 return true; |
6881 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6890 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6882 #undef COMPARE_AND_RETURN_NAME | 6891 #undef COMPARE_AND_RETURN_NAME |
6883 } | 6892 } |
6884 return false; | 6893 return false; |
6885 } | 6894 } |
6886 } // namespace internal | 6895 } // namespace internal |
6887 } // namespace v8 | 6896 } // namespace v8 |
OLD | NEW |