Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: src/heap/incremental-marking.cc

Issue 1865333002: [heap] Make sure that we transition to MARKING when we are finalize SWEEPING. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/incremental-marking.h ('k') | src/heap/incremental-marking-job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 marking_speed_ = static_cast<int>( 1100 marking_speed_ = static_cast<int>(
1101 Min(kMaxMarkingSpeed, static_cast<intptr_t>(marking_speed_ * 1.3))); 1101 Min(kMaxMarkingSpeed, static_cast<intptr_t>(marking_speed_ * 1.3)));
1102 if (FLAG_trace_incremental_marking) { 1102 if (FLAG_trace_incremental_marking) {
1103 PrintIsolate(heap()->isolate(), "Marking speed increased to %d\n", 1103 PrintIsolate(heap()->isolate(), "Marking speed increased to %d\n",
1104 marking_speed_); 1104 marking_speed_);
1105 } 1105 }
1106 } 1106 }
1107 } 1107 }
1108 } 1108 }
1109 1109
1110 void IncrementalMarking::FinalizeSweeping() {
1111 DCHECK(state_ == SWEEPING);
1112 if (heap_->mark_compact_collector()->sweeping_in_progress() &&
1113 (heap_->mark_compact_collector()->IsSweepingCompleted() ||
1114 !FLAG_concurrent_sweeping)) {
1115 heap_->mark_compact_collector()->EnsureSweepingCompleted();
1116 }
1117 if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
1118 bytes_scanned_ = 0;
1119 StartMarking();
1120 }
1121 }
1110 1122
1111 intptr_t IncrementalMarking::Step(intptr_t allocated_bytes, 1123 intptr_t IncrementalMarking::Step(intptr_t allocated_bytes,
1112 CompletionAction action, 1124 CompletionAction action,
1113 ForceMarkingAction marking, 1125 ForceMarkingAction marking,
1114 ForceCompletionAction completion) { 1126 ForceCompletionAction completion) {
1115 DCHECK(allocated_bytes >= 0); 1127 DCHECK(allocated_bytes >= 0);
1116 1128
1117 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || 1129 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking ||
1118 (state_ != SWEEPING && state_ != MARKING)) { 1130 (state_ != SWEEPING && state_ != MARKING)) {
1119 return 0; 1131 return 0;
(...skipping 29 matching lines...) Expand all
1149 // allocation), so to reduce the lumpiness we don't use the write barriers 1161 // allocation), so to reduce the lumpiness we don't use the write barriers
1150 // invoked since last step directly to determine the amount of work to do. 1162 // invoked since last step directly to determine the amount of work to do.
1151 intptr_t bytes_to_process = 1163 intptr_t bytes_to_process =
1152 marking_speed_ * 1164 marking_speed_ *
1153 Max(allocated_, write_barriers_invoked_since_last_step_); 1165 Max(allocated_, write_barriers_invoked_since_last_step_);
1154 allocated_ = 0; 1166 allocated_ = 0;
1155 write_barriers_invoked_since_last_step_ = 0; 1167 write_barriers_invoked_since_last_step_ = 0;
1156 1168
1157 bytes_scanned_ += bytes_to_process; 1169 bytes_scanned_ += bytes_to_process;
1158 1170
1171 // TODO(hpayer): Do not account for sweeping finalization while marking.
1159 if (state_ == SWEEPING) { 1172 if (state_ == SWEEPING) {
1160 if (heap_->mark_compact_collector()->sweeping_in_progress() && 1173 FinalizeSweeping();
1161 (heap_->mark_compact_collector()->IsSweepingCompleted() ||
1162 !FLAG_concurrent_sweeping)) {
1163 heap_->mark_compact_collector()->EnsureSweepingCompleted();
1164 }
1165 if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
1166 bytes_scanned_ = 0;
1167 StartMarking();
1168 }
1169 } 1174 }
1175
1170 if (state_ == MARKING) { 1176 if (state_ == MARKING) {
1171 bytes_processed = ProcessMarkingDeque(bytes_to_process); 1177 bytes_processed = ProcessMarkingDeque(bytes_to_process);
1172 if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) { 1178 if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) {
1173 if (completion == FORCE_COMPLETION || 1179 if (completion == FORCE_COMPLETION ||
1174 IsIdleMarkingDelayCounterLimitReached()) { 1180 IsIdleMarkingDelayCounterLimitReached()) {
1175 if (!finalize_marking_completed_) { 1181 if (!finalize_marking_completed_) {
1176 FinalizeMarking(action); 1182 FinalizeMarking(action);
1177 } else { 1183 } else {
1178 MarkingComplete(action); 1184 MarkingComplete(action);
1179 } 1185 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { 1232 void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
1227 idle_marking_delay_counter_++; 1233 idle_marking_delay_counter_++;
1228 } 1234 }
1229 1235
1230 1236
1231 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1237 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1232 idle_marking_delay_counter_ = 0; 1238 idle_marking_delay_counter_ = 0;
1233 } 1239 }
1234 } // namespace internal 1240 } // namespace internal
1235 } // namespace v8 1241 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.h ('k') | src/heap/incremental-marking-job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698