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/heap/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/heap/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 Marking::IsWhite(ObjectMarking::MarkBitFrom(obj))); | 885 Marking::IsWhite(ObjectMarking::MarkBitFrom(obj))); |
886 continue; | 886 continue; |
887 } | 887 } |
888 | 888 |
889 Map* map = obj->map(); | 889 Map* map = obj->map(); |
890 int size = obj->SizeFromMap(map); | 890 int size = obj->SizeFromMap(map); |
891 unscanned_bytes_of_large_object_ = 0; | 891 unscanned_bytes_of_large_object_ = 0; |
892 VisitObject(map, obj, size); | 892 VisitObject(map, obj, size); |
893 bytes_processed += size - unscanned_bytes_of_large_object_; | 893 bytes_processed += size - unscanned_bytes_of_large_object_; |
894 } | 894 } |
895 // Report all found wrappers to the embedder. This is necessary as the | |
896 // embedder could potentially invalidate wrappers as soon as V8 is done | |
897 // with its incremental marking processing. Any cached wrappers could | |
898 // result in broken pointers at this point. | |
899 heap_->local_embedder_heap_tracer()->RegisterWrappersWithRemoteTracer(); | |
900 return bytes_processed; | 895 return bytes_processed; |
901 } | 896 } |
902 | 897 |
903 | 898 |
904 void IncrementalMarking::Hurry() { | 899 void IncrementalMarking::Hurry() { |
905 // A scavenge may have pushed new objects on the marking deque (due to black | 900 // A scavenge may have pushed new objects on the marking deque (due to black |
906 // allocation) even in COMPLETE state. This may happen if scavenges are | 901 // allocation) even in COMPLETE state. This may happen if scavenges are |
907 // forced e.g. in tests. It should not happen when COMPLETE was set when | 902 // forced e.g. in tests. It should not happen when COMPLETE was set when |
908 // incremental marking finished and a regular GC was triggered after that | 903 // incremental marking finished and a regular GC was triggered after that |
909 // because should_hurry_ will force a full GC. | 904 // because should_hurry_ will force a full GC. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 } | 1026 } |
1032 | 1027 |
1033 double IncrementalMarking::AdvanceIncrementalMarking( | 1028 double IncrementalMarking::AdvanceIncrementalMarking( |
1034 double deadline_in_ms, CompletionAction completion_action, | 1029 double deadline_in_ms, CompletionAction completion_action, |
1035 ForceCompletionAction force_completion, StepOrigin step_origin) { | 1030 ForceCompletionAction force_completion, StepOrigin step_origin) { |
1036 HistogramTimerScope incremental_marking_scope( | 1031 HistogramTimerScope incremental_marking_scope( |
1037 heap_->isolate()->counters()->gc_incremental_marking()); | 1032 heap_->isolate()->counters()->gc_incremental_marking()); |
1038 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); | 1033 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); |
1039 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL); | 1034 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL); |
1040 DCHECK(!IsStopped()); | 1035 DCHECK(!IsStopped()); |
1041 DCHECK_EQ( | |
1042 0, heap_->local_embedder_heap_tracer()->NumberOfCachedWrappersToTrace()); | |
1043 | 1036 |
1044 double remaining_time_in_ms = 0.0; | 1037 double remaining_time_in_ms = 0.0; |
1045 intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( | 1038 intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( |
1046 kStepSizeInMs, | 1039 kStepSizeInMs, |
1047 heap()->tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); | 1040 heap()->tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); |
1048 | 1041 |
1049 const bool incremental_wrapper_tracing = | 1042 const bool incremental_wrapper_tracing = |
1050 state_ == MARKING && FLAG_incremental_marking_wrappers && | 1043 state_ == MARKING && FLAG_incremental_marking_wrappers && |
1051 heap_->local_embedder_heap_tracer()->InUse(); | 1044 heap_->local_embedder_heap_tracer()->InUse(); |
1052 do { | 1045 do { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 idle_marking_delay_counter_++; | 1207 idle_marking_delay_counter_++; |
1215 } | 1208 } |
1216 | 1209 |
1217 | 1210 |
1218 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1211 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1219 idle_marking_delay_counter_ = 0; | 1212 idle_marking_delay_counter_ = 0; |
1220 } | 1213 } |
1221 | 1214 |
1222 } // namespace internal | 1215 } // namespace internal |
1223 } // namespace v8 | 1216 } // namespace v8 |
OLD | NEW |