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/heap/heap.h" | 5 #include "src/heap/heap.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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 | 769 |
770 void Heap::HandleGCRequest() { | 770 void Heap::HandleGCRequest() { |
771 if (incremental_marking()->request_type() == | 771 if (incremental_marking()->request_type() == |
772 IncrementalMarking::COMPLETE_MARKING) { | 772 IncrementalMarking::COMPLETE_MARKING) { |
773 CollectAllGarbage(current_gc_flags_, "GC interrupt", | 773 CollectAllGarbage(current_gc_flags_, "GC interrupt", |
774 current_gc_callback_flags_); | 774 current_gc_callback_flags_); |
775 return; | 775 return; |
776 } | 776 } |
777 DCHECK(FLAG_finalize_marking_incrementally); | 777 DCHECK(FLAG_finalize_marking_incrementally); |
778 if (!incremental_marking()->finalize_marking_completed()) { | 778 if (!incremental_marking()->finalize_marking_completed()) { |
779 FinalizeIncrementalMarking("GC interrupt"); | 779 FinalizeIncrementalMarking("GC interrupt: finalize incremental marking"); |
780 } | 780 } |
781 } | 781 } |
782 | 782 |
783 | 783 |
784 void Heap::ScheduleIdleScavengeIfNeeded(int bytes_allocated) { | 784 void Heap::ScheduleIdleScavengeIfNeeded(int bytes_allocated) { |
785 scavenge_job_->ScheduleIdleTaskIfNeeded(this, bytes_allocated); | 785 scavenge_job_->ScheduleIdleTaskIfNeeded(this, bytes_allocated); |
786 } | 786 } |
787 | 787 |
788 | 788 |
789 void Heap::FinalizeIncrementalMarking(const char* gc_reason) { | 789 void Heap::FinalizeIncrementalMarking(const char* gc_reason) { |
790 if (FLAG_trace_incremental_marking) { | 790 if (FLAG_trace_incremental_marking) { |
791 PrintF("[IncrementalMarking] Overapproximate weak closure (%s).\n", | 791 PrintF("[IncrementalMarking] (%s).\n", gc_reason); |
792 gc_reason); | |
793 } | 792 } |
794 | 793 |
795 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::MC_INCREMENTAL_FINALIZE); | 794 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::MC_INCREMENTAL_FINALIZE); |
796 | 795 |
797 { | 796 { |
798 GCCallbacksScope scope(this); | 797 GCCallbacksScope scope(this); |
799 if (scope.CheckReenter()) { | 798 if (scope.CheckReenter()) { |
800 AllowHeapAllocation allow_allocation; | 799 AllowHeapAllocation allow_allocation; |
801 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); | 800 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); |
802 VMState<EXTERNAL> state(isolate_); | 801 VMState<EXTERNAL> state(isolate_); |
(...skipping 3285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4088 size_t final_incremental_mark_compact_speed_in_bytes_per_ms = | 4087 size_t final_incremental_mark_compact_speed_in_bytes_per_ms = |
4089 static_cast<size_t>( | 4088 static_cast<size_t>( |
4090 tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); | 4089 tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); |
4091 if (FLAG_finalize_marking_incrementally && | 4090 if (FLAG_finalize_marking_incrementally && |
4092 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || | 4091 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
4093 (!incremental_marking()->finalize_marking_completed() && | 4092 (!incremental_marking()->finalize_marking_completed() && |
4094 mark_compact_collector()->marking_deque()->IsEmpty() && | 4093 mark_compact_collector()->marking_deque()->IsEmpty() && |
4095 gc_idle_time_handler_->ShouldDoOverApproximateWeakClosure( | 4094 gc_idle_time_handler_->ShouldDoOverApproximateWeakClosure( |
4096 static_cast<size_t>(idle_time_in_ms))))) { | 4095 static_cast<size_t>(idle_time_in_ms))))) { |
4097 FinalizeIncrementalMarking( | 4096 FinalizeIncrementalMarking( |
4098 "Idle notification: overapproximate weak closure"); | 4097 "Idle notification: finalize incremental marking"); |
4099 return true; | 4098 return true; |
4100 } else if (incremental_marking()->IsComplete() || | 4099 } else if (incremental_marking()->IsComplete() || |
4101 (mark_compact_collector()->marking_deque()->IsEmpty() && | 4100 (mark_compact_collector()->marking_deque()->IsEmpty() && |
4102 gc_idle_time_handler_->ShouldDoFinalIncrementalMarkCompact( | 4101 gc_idle_time_handler_->ShouldDoFinalIncrementalMarkCompact( |
4103 static_cast<size_t>(idle_time_in_ms), size_of_objects, | 4102 static_cast<size_t>(idle_time_in_ms), size_of_objects, |
4104 final_incremental_mark_compact_speed_in_bytes_per_ms))) { | 4103 final_incremental_mark_compact_speed_in_bytes_per_ms))) { |
4105 CollectAllGarbage(current_gc_flags_, | 4104 CollectAllGarbage(current_gc_flags_, |
4106 "idle notification: finalize incremental"); | 4105 "idle notification: finalize incremental marking"); |
4107 return true; | 4106 return true; |
4108 } | 4107 } |
4109 return false; | 4108 return false; |
4110 } | 4109 } |
4111 | 4110 |
4112 | 4111 |
4113 GCIdleTimeHeapState Heap::ComputeHeapState() { | 4112 GCIdleTimeHeapState Heap::ComputeHeapState() { |
4114 GCIdleTimeHeapState heap_state; | 4113 GCIdleTimeHeapState heap_state; |
4115 heap_state.contexts_disposed = contexts_disposed_; | 4114 heap_state.contexts_disposed = contexts_disposed_; |
4116 heap_state.contexts_disposal_rate = | 4115 heap_state.contexts_disposal_rate = |
(...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6184 } | 6183 } |
6185 | 6184 |
6186 | 6185 |
6187 // static | 6186 // static |
6188 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6187 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6189 return StaticVisitorBase::GetVisitorId(map); | 6188 return StaticVisitorBase::GetVisitorId(map); |
6190 } | 6189 } |
6191 | 6190 |
6192 } // namespace internal | 6191 } // namespace internal |
6193 } // namespace v8 | 6192 } // namespace v8 |
OLD | NEW |