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