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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 set_should_hurry(true); | 853 set_should_hurry(true); |
854 if (FLAG_trace_incremental_marking) { | 854 if (FLAG_trace_incremental_marking) { |
855 PrintF("[IncrementalMarking] Complete (normal).\n"); | 855 PrintF("[IncrementalMarking] Complete (normal).\n"); |
856 } | 856 } |
857 if (action == GC_VIA_STACK_GUARD) { | 857 if (action == GC_VIA_STACK_GUARD) { |
858 heap_->isolate()->stack_guard()->RequestGC(); | 858 heap_->isolate()->stack_guard()->RequestGC(); |
859 } | 859 } |
860 } | 860 } |
861 | 861 |
862 | 862 |
863 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { | |
864 if (IsStopped() && WorthActivating() && heap_->NextGCIsLikelyToBeFull()) { | |
865 Start(); | |
866 } else { | |
867 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); | |
868 } | |
869 } | |
870 | |
871 | |
872 void IncrementalMarking::Step(intptr_t allocated_bytes, | 863 void IncrementalMarking::Step(intptr_t allocated_bytes, |
873 CompletionAction action) { | 864 CompletionAction action) { |
874 if (heap_->gc_state() != Heap::NOT_IN_GC || | 865 if (heap_->gc_state() != Heap::NOT_IN_GC || |
875 !FLAG_incremental_marking || | 866 !FLAG_incremental_marking || |
876 !FLAG_incremental_marking_steps || | 867 !FLAG_incremental_marking_steps || |
877 (state_ != SWEEPING && state_ != MARKING)) { | 868 (state_ != SWEEPING && state_ != MARKING)) { |
878 return; | 869 return; |
879 } | 870 } |
880 | 871 |
881 allocated_ += allocated_bytes; | 872 allocated_ += allocated_bytes; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 } | 958 } |
968 speed_up = true; | 959 speed_up = true; |
969 } | 960 } |
970 | 961 |
971 if (speed_up) { | 962 if (speed_up) { |
972 if (state_ != MARKING) { | 963 if (state_ != MARKING) { |
973 if (FLAG_trace_gc) { | 964 if (FLAG_trace_gc) { |
974 PrintPID("Postponing speeding up marking until marking starts\n"); | 965 PrintPID("Postponing speeding up marking until marking starts\n"); |
975 } | 966 } |
976 } else { | 967 } else { |
977 marking_speed_ += kMarkingSpeedAccelleration; | 968 marking_speed_ += kMarkingSpeedAccellerationInterval; |
978 marking_speed_ = static_cast<int>( | 969 marking_speed_ = static_cast<int>( |
979 Min(kMaxMarkingSpeed, | 970 Min(kMaxMarkingSpeed, |
980 static_cast<intptr_t>(marking_speed_ * 1.3))); | 971 static_cast<intptr_t>(marking_speed_ * 1.3))); |
981 if (FLAG_trace_gc) { | 972 if (FLAG_trace_gc) { |
982 PrintPID("Marking speed increased to %d\n", marking_speed_); | 973 PrintPID("Marking speed increased to %d\n", marking_speed_); |
983 } | 974 } |
984 } | 975 } |
985 } | 976 } |
986 | 977 |
987 if (FLAG_trace_incremental_marking || FLAG_trace_gc || | 978 if (FLAG_trace_incremental_marking || FLAG_trace_gc || |
(...skipping 23 matching lines...) Expand all Loading... |
1011 bytes_scanned_ = 0; | 1002 bytes_scanned_ = 0; |
1012 write_barriers_invoked_since_last_step_ = 0; | 1003 write_barriers_invoked_since_last_step_ = 0; |
1013 } | 1004 } |
1014 | 1005 |
1015 | 1006 |
1016 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 1007 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
1017 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); | 1008 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
1018 } | 1009 } |
1019 | 1010 |
1020 } } // namespace v8::internal | 1011 } } // namespace v8::internal |
OLD | NEW |