OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 if (map == filler_map) continue; | 747 if (map == filler_map) continue; |
748 | 748 |
749 VisitObject(map, obj, obj->SizeFromMap(map)); | 749 VisitObject(map, obj, obj->SizeFromMap(map)); |
750 } | 750 } |
751 } | 751 } |
752 | 752 |
753 | 753 |
754 void IncrementalMarking::Hurry() { | 754 void IncrementalMarking::Hurry() { |
755 if (state() == MARKING) { | 755 if (state() == MARKING) { |
756 double start = 0.0; | 756 double start = 0.0; |
757 if (FLAG_trace_incremental_marking) { | 757 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) { |
758 PrintF("[IncrementalMarking] Hurry\n"); | |
759 start = OS::TimeCurrentMillis(); | 758 start = OS::TimeCurrentMillis(); |
| 759 if (FLAG_trace_incremental_marking) { |
| 760 PrintF("[IncrementalMarking] Hurry\n"); |
| 761 } |
760 } | 762 } |
761 // TODO(gc) hurry can mark objects it encounters black as mutator | 763 // TODO(gc) hurry can mark objects it encounters black as mutator |
762 // was stopped. | 764 // was stopped. |
763 ProcessMarkingDeque(); | 765 ProcessMarkingDeque(); |
764 state_ = COMPLETE; | 766 state_ = COMPLETE; |
765 if (FLAG_trace_incremental_marking) { | 767 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) { |
766 double end = OS::TimeCurrentMillis(); | 768 double end = OS::TimeCurrentMillis(); |
767 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", | 769 double delta = end - start; |
768 static_cast<int>(end - start)); | 770 heap_->AddMarkingTime(delta); |
| 771 if (FLAG_trace_incremental_marking) { |
| 772 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", |
| 773 static_cast<int>(delta)); |
| 774 } |
769 } | 775 } |
770 } | 776 } |
771 | 777 |
772 if (FLAG_cleanup_code_caches_at_gc) { | 778 if (FLAG_cleanup_code_caches_at_gc) { |
773 PolymorphicCodeCache* poly_cache = heap_->polymorphic_code_cache(); | 779 PolymorphicCodeCache* poly_cache = heap_->polymorphic_code_cache(); |
774 Marking::GreyToBlack(Marking::MarkBitFrom(poly_cache)); | 780 Marking::GreyToBlack(Marking::MarkBitFrom(poly_cache)); |
775 MemoryChunk::IncrementLiveBytesFromGC(poly_cache->address(), | 781 MemoryChunk::IncrementLiveBytesFromGC(poly_cache->address(), |
776 PolymorphicCodeCache::kSize); | 782 PolymorphicCodeCache::kSize); |
777 } | 783 } |
778 | 784 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 // invoked since last step directly to determine the amount of work to do. | 888 // invoked since last step directly to determine the amount of work to do. |
883 intptr_t bytes_to_process = | 889 intptr_t bytes_to_process = |
884 marking_speed_ * Max(allocated_, write_barriers_invoked_since_last_step_); | 890 marking_speed_ * Max(allocated_, write_barriers_invoked_since_last_step_); |
885 allocated_ = 0; | 891 allocated_ = 0; |
886 write_barriers_invoked_since_last_step_ = 0; | 892 write_barriers_invoked_since_last_step_ = 0; |
887 | 893 |
888 bytes_scanned_ += bytes_to_process; | 894 bytes_scanned_ += bytes_to_process; |
889 | 895 |
890 double start = 0; | 896 double start = 0; |
891 | 897 |
892 if (FLAG_trace_incremental_marking || FLAG_trace_gc) { | 898 if (FLAG_trace_incremental_marking || FLAG_trace_gc || |
| 899 FLAG_print_cumulative_gc_stat) { |
893 start = OS::TimeCurrentMillis(); | 900 start = OS::TimeCurrentMillis(); |
894 } | 901 } |
895 | 902 |
896 if (state_ == SWEEPING) { | 903 if (state_ == SWEEPING) { |
897 if (heap_->AdvanceSweepers(static_cast<int>(bytes_to_process))) { | 904 if (heap_->AdvanceSweepers(static_cast<int>(bytes_to_process))) { |
898 bytes_scanned_ = 0; | 905 bytes_scanned_ = 0; |
899 StartMarking(PREVENT_COMPACTION); | 906 StartMarking(PREVENT_COMPACTION); |
900 } | 907 } |
901 } else if (state_ == MARKING) { | 908 } else if (state_ == MARKING) { |
902 ProcessMarkingDeque(bytes_to_process); | 909 ProcessMarkingDeque(bytes_to_process); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 marking_speed_ += kMarkingSpeedAccellerationInterval; | 969 marking_speed_ += kMarkingSpeedAccellerationInterval; |
963 marking_speed_ = static_cast<int>( | 970 marking_speed_ = static_cast<int>( |
964 Min(kMaxMarkingSpeed, | 971 Min(kMaxMarkingSpeed, |
965 static_cast<intptr_t>(marking_speed_ * 1.3))); | 972 static_cast<intptr_t>(marking_speed_ * 1.3))); |
966 if (FLAG_trace_gc) { | 973 if (FLAG_trace_gc) { |
967 PrintPID("Marking speed increased to %d\n", marking_speed_); | 974 PrintPID("Marking speed increased to %d\n", marking_speed_); |
968 } | 975 } |
969 } | 976 } |
970 } | 977 } |
971 | 978 |
972 if (FLAG_trace_incremental_marking || FLAG_trace_gc) { | 979 if (FLAG_trace_incremental_marking || FLAG_trace_gc || |
| 980 FLAG_print_cumulative_gc_stat) { |
973 double end = OS::TimeCurrentMillis(); | 981 double end = OS::TimeCurrentMillis(); |
974 double delta = (end - start); | 982 double delta = (end - start); |
975 longest_step_ = Max(longest_step_, delta); | 983 longest_step_ = Max(longest_step_, delta); |
976 steps_took_ += delta; | 984 steps_took_ += delta; |
977 steps_took_since_last_gc_ += delta; | 985 steps_took_since_last_gc_ += delta; |
| 986 heap_->AddMarkingTime(delta); |
978 } | 987 } |
979 } | 988 } |
980 | 989 |
981 | 990 |
982 void IncrementalMarking::ResetStepCounters() { | 991 void IncrementalMarking::ResetStepCounters() { |
983 steps_count_ = 0; | 992 steps_count_ = 0; |
984 steps_took_ = 0; | 993 steps_took_ = 0; |
985 longest_step_ = 0.0; | 994 longest_step_ = 0.0; |
986 old_generation_space_available_at_start_of_incremental_ = | 995 old_generation_space_available_at_start_of_incremental_ = |
987 SpaceLeftInOldSpace(); | 996 SpaceLeftInOldSpace(); |
988 old_generation_space_used_at_start_of_incremental_ = | 997 old_generation_space_used_at_start_of_incremental_ = |
989 heap_->PromotedTotalSize(); | 998 heap_->PromotedTotalSize(); |
990 steps_count_since_last_gc_ = 0; | 999 steps_count_since_last_gc_ = 0; |
991 steps_took_since_last_gc_ = 0; | 1000 steps_took_since_last_gc_ = 0; |
992 bytes_rescanned_ = 0; | 1001 bytes_rescanned_ = 0; |
993 marking_speed_ = kInitialMarkingSpeed; | 1002 marking_speed_ = kInitialMarkingSpeed; |
994 bytes_scanned_ = 0; | 1003 bytes_scanned_ = 0; |
995 write_barriers_invoked_since_last_step_ = 0; | 1004 write_barriers_invoked_since_last_step_ = 0; |
996 } | 1005 } |
997 | 1006 |
998 | 1007 |
999 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 1008 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
1000 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); | 1009 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
1001 } | 1010 } |
1002 | 1011 |
1003 } } // namespace v8::internal | 1012 } } // namespace v8::internal |
OLD | NEW |