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