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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 #undef UPDATE_FRAGMENTATION_FOR_SPACE | 718 #undef UPDATE_FRAGMENTATION_FOR_SPACE |
719 #undef UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE | 719 #undef UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE |
720 | 720 |
721 #ifdef DEBUG | 721 #ifdef DEBUG |
722 ReportStatisticsAfterGC(); | 722 ReportStatisticsAfterGC(); |
723 #endif // DEBUG | 723 #endif // DEBUG |
724 | 724 |
725 // Remember the last top pointer so that we can later find out | 725 // Remember the last top pointer so that we can later find out |
726 // whether we allocated in new space since the last GC. | 726 // whether we allocated in new space since the last GC. |
727 new_space_top_after_last_gc_ = new_space()->top(); | 727 new_space_top_after_last_gc_ = new_space()->top(); |
| 728 last_gc_time_ = MonotonicallyIncreasingTimeInMs(); |
728 } | 729 } |
729 | 730 |
730 | 731 |
731 void Heap::PreprocessStackTraces() { | 732 void Heap::PreprocessStackTraces() { |
732 if (!weak_stack_trace_list()->IsWeakFixedArray()) return; | 733 if (!weak_stack_trace_list()->IsWeakFixedArray()) return; |
733 WeakFixedArray* array = WeakFixedArray::cast(weak_stack_trace_list()); | 734 WeakFixedArray* array = WeakFixedArray::cast(weak_stack_trace_list()); |
734 int length = array->Length(); | 735 int length = array->Length(); |
735 for (int i = 0; i < length; i++) { | 736 for (int i = 0; i < length; i++) { |
736 if (array->IsEmptySlot(i)) continue; | 737 if (array->IsEmptySlot(i)) continue; |
737 FixedArray* elements = FixedArray::cast(array->Get(i)); | 738 FixedArray* elements = FixedArray::cast(array->Get(i)); |
(...skipping 3867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4605 deadline_in_seconds * | 4606 deadline_in_seconds * |
4606 static_cast<double>(base::Time::kMillisecondsPerSecond); | 4607 static_cast<double>(base::Time::kMillisecondsPerSecond); |
4607 HistogramTimerScope idle_notification_scope( | 4608 HistogramTimerScope idle_notification_scope( |
4608 isolate_->counters()->gc_idle_notification()); | 4609 isolate_->counters()->gc_idle_notification()); |
4609 double start_ms = MonotonicallyIncreasingTimeInMs(); | 4610 double start_ms = MonotonicallyIncreasingTimeInMs(); |
4610 double idle_time_in_ms = deadline_in_ms - start_ms; | 4611 double idle_time_in_ms = deadline_in_ms - start_ms; |
4611 bool is_long_idle_notification = | 4612 bool is_long_idle_notification = |
4612 static_cast<size_t>(idle_time_in_ms) > | 4613 static_cast<size_t>(idle_time_in_ms) > |
4613 GCIdleTimeHandler::kMaxFrameRenderingIdleTime; | 4614 GCIdleTimeHandler::kMaxFrameRenderingIdleTime; |
4614 | 4615 |
| 4616 static const double kLastGCTimeTreshold = 1000; |
| 4617 |
4615 GCIdleTimeHandler::HeapState heap_state; | 4618 GCIdleTimeHandler::HeapState heap_state; |
4616 heap_state.contexts_disposed = contexts_disposed_; | 4619 heap_state.contexts_disposed = contexts_disposed_; |
4617 heap_state.contexts_disposal_rate = | 4620 heap_state.contexts_disposal_rate = |
4618 tracer()->ContextDisposalRateInMilliseconds(); | 4621 tracer()->ContextDisposalRateInMilliseconds(); |
4619 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); | 4622 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); |
4620 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); | 4623 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); |
4621 // TODO(ulan): Start incremental marking only for large heaps. | 4624 // TODO(ulan): Start incremental marking only for large heaps. |
4622 intptr_t limit = old_generation_allocation_limit_; | 4625 intptr_t limit = old_generation_allocation_limit_; |
4623 if (is_long_idle_notification) { | 4626 if (is_long_idle_notification && |
| 4627 (start_ms - last_gc_time_ > kLastGCTimeTreshold)) { |
4624 limit = idle_old_generation_allocation_limit_; | 4628 limit = idle_old_generation_allocation_limit_; |
4625 } | 4629 } |
4626 | 4630 |
4627 heap_state.can_start_incremental_marking = | 4631 heap_state.can_start_incremental_marking = |
4628 incremental_marking()->CanBeActivated() && | 4632 incremental_marking()->CanBeActivated() && |
4629 HeapIsFullEnoughToStartIncrementalMarking(limit) && | 4633 HeapIsFullEnoughToStartIncrementalMarking(limit) && |
4630 !mark_compact_collector()->sweeping_in_progress(); | 4634 !mark_compact_collector()->sweeping_in_progress(); |
4631 heap_state.sweeping_in_progress = | 4635 heap_state.sweeping_in_progress = |
4632 mark_compact_collector()->sweeping_in_progress(); | 4636 mark_compact_collector()->sweeping_in_progress(); |
4633 heap_state.sweeping_completed = | 4637 heap_state.sweeping_completed = |
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6503 } | 6507 } |
6504 delete list; | 6508 delete list; |
6505 } else { | 6509 } else { |
6506 prev = list; | 6510 prev = list; |
6507 } | 6511 } |
6508 list = next; | 6512 list = next; |
6509 } | 6513 } |
6510 } | 6514 } |
6511 } | 6515 } |
6512 } // namespace v8::internal | 6516 } // namespace v8::internal |
OLD | NEW |