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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 DCHECK(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); | 434 DCHECK(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); |
435 | 435 |
436 if (FLAG_gc_verbose) Print(); | 436 if (FLAG_gc_verbose) Print(); |
437 | 437 |
438 ReportStatisticsBeforeGC(); | 438 ReportStatisticsBeforeGC(); |
439 #endif // DEBUG | 439 #endif // DEBUG |
440 | 440 |
441 store_buffer()->GCPrologue(); | 441 store_buffer()->GCPrologue(); |
442 | 442 |
443 if (isolate()->concurrent_osr_enabled()) { | 443 if (isolate()->concurrent_osr_enabled()) { |
444 isolate()->optimizing_compile_dispatcher()->AgeBufferedOsrJobs(); | 444 isolate()->optimizing_compiler_thread()->AgeBufferedOsrJobs(); |
445 } | 445 } |
446 | 446 |
447 if (new_space_.IsAtMaximumCapacity()) { | 447 if (new_space_.IsAtMaximumCapacity()) { |
448 maximum_size_scavenges_++; | 448 maximum_size_scavenges_++; |
449 } else { | 449 } else { |
450 maximum_size_scavenges_ = 0; | 450 maximum_size_scavenges_ = 0; |
451 } | 451 } |
452 CheckNewSpaceExpansionCriteria(); | 452 CheckNewSpaceExpansionCriteria(); |
453 } | 453 } |
454 | 454 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 // handles, but won't collect weakly reachable objects until next | 777 // handles, but won't collect weakly reachable objects until next |
778 // major GC. Therefore if we collect aggressively and weak handle callback | 778 // major GC. Therefore if we collect aggressively and weak handle callback |
779 // has been invoked, we rerun major GC to release objects which become | 779 // has been invoked, we rerun major GC to release objects which become |
780 // garbage. | 780 // garbage. |
781 // Note: as weak callbacks can execute arbitrary code, we cannot | 781 // Note: as weak callbacks can execute arbitrary code, we cannot |
782 // hope that eventually there will be no weak callbacks invocations. | 782 // hope that eventually there will be no weak callbacks invocations. |
783 // Therefore stop recollecting after several attempts. | 783 // Therefore stop recollecting after several attempts. |
784 if (isolate()->concurrent_recompilation_enabled()) { | 784 if (isolate()->concurrent_recompilation_enabled()) { |
785 // The optimizing compiler may be unnecessarily holding on to memory. | 785 // The optimizing compiler may be unnecessarily holding on to memory. |
786 DisallowHeapAllocation no_recursive_gc; | 786 DisallowHeapAllocation no_recursive_gc; |
787 isolate()->optimizing_compile_dispatcher()->Flush(); | 787 isolate()->optimizing_compiler_thread()->Flush(); |
788 } | 788 } |
789 isolate()->ClearSerializerData(); | 789 isolate()->ClearSerializerData(); |
790 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | | 790 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | |
791 kReduceMemoryFootprintMask); | 791 kReduceMemoryFootprintMask); |
792 isolate_->compilation_cache()->Clear(); | 792 isolate_->compilation_cache()->Clear(); |
793 const int kMaxNumberOfAttempts = 7; | 793 const int kMaxNumberOfAttempts = 7; |
794 const int kMinNumberOfAttempts = 2; | 794 const int kMinNumberOfAttempts = 2; |
795 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { | 795 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { |
796 if (!CollectGarbage(MARK_COMPACTOR, gc_reason, NULL) && | 796 if (!CollectGarbage(MARK_COMPACTOR, gc_reason, NULL) && |
797 attempt + 1 >= kMinNumberOfAttempts) { | 797 attempt + 1 >= kMinNumberOfAttempts) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 } | 895 } |
896 | 896 |
897 | 897 |
898 int Heap::NotifyContextDisposed(bool dependant_context) { | 898 int Heap::NotifyContextDisposed(bool dependant_context) { |
899 if (!dependant_context) { | 899 if (!dependant_context) { |
900 tracer()->ResetSurvivalEvents(); | 900 tracer()->ResetSurvivalEvents(); |
901 old_generation_size_configured_ = false; | 901 old_generation_size_configured_ = false; |
902 } | 902 } |
903 if (isolate()->concurrent_recompilation_enabled()) { | 903 if (isolate()->concurrent_recompilation_enabled()) { |
904 // Flush the queued recompilation tasks. | 904 // Flush the queued recompilation tasks. |
905 isolate()->optimizing_compile_dispatcher()->Flush(); | 905 isolate()->optimizing_compiler_thread()->Flush(); |
906 } | 906 } |
907 AgeInlineCaches(); | 907 AgeInlineCaches(); |
908 set_retained_maps(ArrayList::cast(empty_fixed_array())); | 908 set_retained_maps(ArrayList::cast(empty_fixed_array())); |
909 tracer()->AddContextDisposalTime(base::OS::TimeCurrentMillis()); | 909 tracer()->AddContextDisposalTime(base::OS::TimeCurrentMillis()); |
910 return ++contexts_disposed_; | 910 return ++contexts_disposed_; |
911 } | 911 } |
912 | 912 |
913 | 913 |
914 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index, | 914 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index, |
915 int len) { | 915 int len) { |
(...skipping 5449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6365 static_cast<int>(object_sizes_last_time_[index])); | 6365 static_cast<int>(object_sizes_last_time_[index])); |
6366 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6366 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6367 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6367 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6368 | 6368 |
6369 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6369 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6370 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6370 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6371 ClearObjectStats(); | 6371 ClearObjectStats(); |
6372 } | 6372 } |
6373 } | 6373 } |
6374 } // namespace v8::internal | 6374 } // namespace v8::internal |
OLD | NEW |