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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 DCHECK(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); | 422 DCHECK(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); |
423 | 423 |
424 if (FLAG_gc_verbose) Print(); | 424 if (FLAG_gc_verbose) Print(); |
425 | 425 |
426 ReportStatisticsBeforeGC(); | 426 ReportStatisticsBeforeGC(); |
427 #endif // DEBUG | 427 #endif // DEBUG |
428 | 428 |
429 store_buffer()->GCPrologue(); | 429 store_buffer()->GCPrologue(); |
430 | 430 |
431 if (isolate()->concurrent_osr_enabled()) { | 431 if (isolate()->concurrent_osr_enabled()) { |
432 isolate()->optimizing_compiler_thread()->AgeBufferedOsrJobs(); | 432 isolate()->optimizing_compile_dispatcher()->AgeBufferedOsrJobs(); |
433 } | 433 } |
434 | 434 |
435 if (new_space_.IsAtMaximumCapacity()) { | 435 if (new_space_.IsAtMaximumCapacity()) { |
436 maximum_size_scavenges_++; | 436 maximum_size_scavenges_++; |
437 } else { | 437 } else { |
438 maximum_size_scavenges_ = 0; | 438 maximum_size_scavenges_ = 0; |
439 } | 439 } |
440 CheckNewSpaceExpansionCriteria(); | 440 CheckNewSpaceExpansionCriteria(); |
441 } | 441 } |
442 | 442 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 // handles, but won't collect weakly reachable objects until next | 759 // handles, but won't collect weakly reachable objects until next |
760 // major GC. Therefore if we collect aggressively and weak handle callback | 760 // major GC. Therefore if we collect aggressively and weak handle callback |
761 // has been invoked, we rerun major GC to release objects which become | 761 // has been invoked, we rerun major GC to release objects which become |
762 // garbage. | 762 // garbage. |
763 // Note: as weak callbacks can execute arbitrary code, we cannot | 763 // Note: as weak callbacks can execute arbitrary code, we cannot |
764 // hope that eventually there will be no weak callbacks invocations. | 764 // hope that eventually there will be no weak callbacks invocations. |
765 // Therefore stop recollecting after several attempts. | 765 // Therefore stop recollecting after several attempts. |
766 if (isolate()->concurrent_recompilation_enabled()) { | 766 if (isolate()->concurrent_recompilation_enabled()) { |
767 // The optimizing compiler may be unnecessarily holding on to memory. | 767 // The optimizing compiler may be unnecessarily holding on to memory. |
768 DisallowHeapAllocation no_recursive_gc; | 768 DisallowHeapAllocation no_recursive_gc; |
769 isolate()->optimizing_compiler_thread()->Flush(); | 769 isolate()->optimizing_compile_dispatcher()->Flush(); |
770 } | 770 } |
771 isolate()->ClearSerializerData(); | 771 isolate()->ClearSerializerData(); |
772 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | | 772 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | |
773 kReduceMemoryFootprintMask); | 773 kReduceMemoryFootprintMask); |
774 isolate_->compilation_cache()->Clear(); | 774 isolate_->compilation_cache()->Clear(); |
775 const int kMaxNumberOfAttempts = 7; | 775 const int kMaxNumberOfAttempts = 7; |
776 const int kMinNumberOfAttempts = 2; | 776 const int kMinNumberOfAttempts = 2; |
777 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { | 777 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { |
778 if (!CollectGarbage(MARK_COMPACTOR, gc_reason, NULL) && | 778 if (!CollectGarbage(MARK_COMPACTOR, gc_reason, NULL) && |
779 attempt + 1 >= kMinNumberOfAttempts) { | 779 attempt + 1 >= kMinNumberOfAttempts) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 } | 877 } |
878 | 878 |
879 | 879 |
880 int Heap::NotifyContextDisposed(bool dependant_context) { | 880 int Heap::NotifyContextDisposed(bool dependant_context) { |
881 if (!dependant_context) { | 881 if (!dependant_context) { |
882 tracer()->ResetSurvivalEvents(); | 882 tracer()->ResetSurvivalEvents(); |
883 old_generation_size_configured_ = false; | 883 old_generation_size_configured_ = false; |
884 } | 884 } |
885 if (isolate()->concurrent_recompilation_enabled()) { | 885 if (isolate()->concurrent_recompilation_enabled()) { |
886 // Flush the queued recompilation tasks. | 886 // Flush the queued recompilation tasks. |
887 isolate()->optimizing_compiler_thread()->Flush(); | 887 isolate()->optimizing_compile_dispatcher()->Flush(); |
888 } | 888 } |
889 AgeInlineCaches(); | 889 AgeInlineCaches(); |
890 set_retained_maps(ArrayList::cast(empty_fixed_array())); | 890 set_retained_maps(ArrayList::cast(empty_fixed_array())); |
891 tracer()->AddContextDisposalTime(base::OS::TimeCurrentMillis()); | 891 tracer()->AddContextDisposalTime(base::OS::TimeCurrentMillis()); |
892 return ++contexts_disposed_; | 892 return ++contexts_disposed_; |
893 } | 893 } |
894 | 894 |
895 | 895 |
896 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index, | 896 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index, |
897 int len) { | 897 int len) { |
(...skipping 5408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6306 static_cast<int>(object_sizes_last_time_[index])); | 6306 static_cast<int>(object_sizes_last_time_[index])); |
6307 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6307 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6308 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6308 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6309 | 6309 |
6310 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6310 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6311 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6311 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6312 ClearObjectStats(); | 6312 ClearObjectStats(); |
6313 } | 6313 } |
6314 } | 6314 } |
6315 } // namespace v8::internal | 6315 } // namespace v8::internal |
OLD | NEW |