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(); |
895 return bytes_processed; | 900 return bytes_processed; |
896 } | 901 } |
897 | 902 |
898 | 903 |
899 void IncrementalMarking::Hurry() { | 904 void IncrementalMarking::Hurry() { |
900 // A scavenge may have pushed new objects on the marking deque (due to black | 905 // A scavenge may have pushed new objects on the marking deque (due to black |
901 // allocation) even in COMPLETE state. This may happen if scavenges are | 906 // allocation) even in COMPLETE state. This may happen if scavenges are |
902 // forced e.g. in tests. It should not happen when COMPLETE was set when | 907 // forced e.g. in tests. It should not happen when COMPLETE was set when |
903 // incremental marking finished and a regular GC was triggered after that | 908 // incremental marking finished and a regular GC was triggered after that |
904 // because should_hurry_ will force a full GC. | 909 // because should_hurry_ will force a full GC. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 } | 1031 } |
1027 | 1032 |
1028 double IncrementalMarking::AdvanceIncrementalMarking( | 1033 double IncrementalMarking::AdvanceIncrementalMarking( |
1029 double deadline_in_ms, CompletionAction completion_action, | 1034 double deadline_in_ms, CompletionAction completion_action, |
1030 ForceCompletionAction force_completion, StepOrigin step_origin) { | 1035 ForceCompletionAction force_completion, StepOrigin step_origin) { |
1031 HistogramTimerScope incremental_marking_scope( | 1036 HistogramTimerScope incremental_marking_scope( |
1032 heap_->isolate()->counters()->gc_incremental_marking()); | 1037 heap_->isolate()->counters()->gc_incremental_marking()); |
1033 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); | 1038 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); |
1034 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL); | 1039 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL); |
1035 DCHECK(!IsStopped()); | 1040 DCHECK(!IsStopped()); |
| 1041 DCHECK_EQ( |
| 1042 0, heap_->local_embedder_heap_tracer()->NumberOfCachedWrappersToTrace()); |
1036 | 1043 |
1037 double remaining_time_in_ms = 0.0; | 1044 double remaining_time_in_ms = 0.0; |
1038 intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( | 1045 intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( |
1039 kStepSizeInMs, | 1046 kStepSizeInMs, |
1040 heap()->tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); | 1047 heap()->tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); |
1041 | 1048 |
1042 const bool incremental_wrapper_tracing = | 1049 const bool incremental_wrapper_tracing = |
1043 state_ == MARKING && FLAG_incremental_marking_wrappers && | 1050 state_ == MARKING && FLAG_incremental_marking_wrappers && |
1044 heap_->local_embedder_heap_tracer()->InUse(); | 1051 heap_->local_embedder_heap_tracer()->InUse(); |
1045 do { | 1052 do { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 idle_marking_delay_counter_++; | 1214 idle_marking_delay_counter_++; |
1208 } | 1215 } |
1209 | 1216 |
1210 | 1217 |
1211 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1218 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1212 idle_marking_delay_counter_ = 0; | 1219 idle_marking_delay_counter_ = 0; |
1213 } | 1220 } |
1214 | 1221 |
1215 } // namespace internal | 1222 } // namespace internal |
1216 } // namespace v8 | 1223 } // namespace v8 |
OLD | NEW |