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

Side by Side Diff: src/heap/gc-tracer.cc

Issue 2288693002: [heap] GCTracer: Fix UB when iterating incremental scopes (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/gc-tracer.h" 5 #include "src/heap/gc-tracer.h"
6 6
7 #include "src/counters.h" 7 #include "src/counters.h"
8 #include "src/heap/heap-inl.h" 8 #include "src/heap/heap-inl.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 10
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 recorded_scavenges_survived_.Push(MakeBytesAndDuration( 269 recorded_scavenges_survived_.Push(MakeBytesAndDuration(
270 current_.survived_new_space_object_size, duration)); 270 current_.survived_new_space_object_size, duration));
271 } else if (current_.type == Event::INCREMENTAL_MARK_COMPACTOR) { 271 } else if (current_.type == Event::INCREMENTAL_MARK_COMPACTOR) {
272 MergeBaseline(previous_incremental_mark_compactor_event_); 272 MergeBaseline(previous_incremental_mark_compactor_event_);
273 recorded_incremental_marking_steps_.Push( 273 recorded_incremental_marking_steps_.Push(
274 MakeBytesAndDuration(current_.incremental_marking_bytes, 274 MakeBytesAndDuration(current_.incremental_marking_bytes,
275 current_.pure_incremental_marking_duration)); 275 current_.pure_incremental_marking_duration));
276 recorded_incremental_mark_compacts_.Push( 276 recorded_incremental_mark_compacts_.Push(
277 MakeBytesAndDuration(current_.start_object_size, duration)); 277 MakeBytesAndDuration(current_.start_object_size, duration));
278 combined_mark_compact_speed_cache_ = 0.0; 278 combined_mark_compact_speed_cache_ = 0.0;
279 for (int i = 0; i <= Scope::NUMBER_OF_INCREMENTAL_SCOPES; i++) { 279 for (int i = 0; i < Scope::NUMBER_OF_INCREMENTAL_SCOPES; i++) {
280 incremental_marking_scopes_[i].ResetCurrentCycle(); 280 incremental_marking_scopes_[i].ResetCurrentCycle();
281 } 281 }
282 } else { 282 } else {
283 DCHECK(current_.incremental_marking_bytes == 0); 283 DCHECK(current_.incremental_marking_bytes == 0);
284 DCHECK(current_.pure_incremental_marking_duration == 0); 284 DCHECK(current_.pure_incremental_marking_duration == 0);
285 recorded_mark_compacts_.Push( 285 recorded_mark_compacts_.Push(
286 MakeBytesAndDuration(current_.start_object_size, duration)); 286 MakeBytesAndDuration(current_.start_object_size, duration));
287 combined_mark_compact_speed_cache_ = 0.0; 287 combined_mark_compact_speed_cache_ = 0.0;
288 for (int i = 0; i <= Scope::NUMBER_OF_INCREMENTAL_SCOPES; i++) { 288 for (int i = 0; i < Scope::NUMBER_OF_INCREMENTAL_SCOPES; i++) {
289 incremental_marking_scopes_[i].ResetCurrentCycle(); 289 incremental_marking_scopes_[i].ResetCurrentCycle();
290 } 290 }
291 } 291 }
292 292
293 double spent_in_mutator = Max(current_.start_time - previous_.end_time, 0.0); 293 double spent_in_mutator = Max(current_.start_time - previous_.end_time, 0.0);
294 heap_->UpdateCumulativeGCStatistics(duration, spent_in_mutator, 294 heap_->UpdateCumulativeGCStatistics(duration, spent_in_mutator,
295 current_.scopes[Scope::MC_MARK]); 295 current_.scopes[Scope::MC_MARK]);
296 296
297 if (current_.type == Event::SCAVENGER && FLAG_trace_gc_ignore_scavenger) 297 if (current_.type == Event::SCAVENGER && FLAG_trace_gc_ignore_scavenger)
298 return; 298 return;
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 return sum / recorded_survival_ratios_.Count(); 816 return sum / recorded_survival_ratios_.Count();
817 } 817 }
818 818
819 bool GCTracer::SurvivalEventsRecorded() const { 819 bool GCTracer::SurvivalEventsRecorded() const {
820 return recorded_survival_ratios_.Count() > 0; 820 return recorded_survival_ratios_.Count() > 0;
821 } 821 }
822 822
823 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); } 823 void GCTracer::ResetSurvivalEvents() { recorded_survival_ratios_.Reset(); }
824 } // namespace internal 824 } // namespace internal
825 } // namespace v8 825 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698