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

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

Issue 1213593004: Remove redundant check in GCTracer::SampleAllocation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/heap/gc-tracer.h" 7 #include "src/heap/gc-tracer.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; 270 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes;
271 return; 271 return;
272 } 272 }
273 // This assumes that counters are unsigned integers so that the subtraction 273 // This assumes that counters are unsigned integers so that the subtraction
274 // below works even if the new counter is less then the old counter. 274 // below works even if the new counter is less then the old counter.
275 size_t new_space_allocated_bytes = 275 size_t new_space_allocated_bytes =
276 new_space_counter_bytes - new_space_allocation_counter_bytes_; 276 new_space_counter_bytes - new_space_allocation_counter_bytes_;
277 size_t old_generation_allocated_bytes = 277 size_t old_generation_allocated_bytes =
278 old_generation_counter_bytes - old_generation_allocation_counter_bytes_; 278 old_generation_counter_bytes - old_generation_allocation_counter_bytes_;
279 double duration = current_ms - allocation_time_ms_; 279 double duration = current_ms - allocation_time_ms_;
280 const double kMinDurationMs = 100;
281 if (duration < kMinDurationMs) {
282 // Do not sample small durations to avoid precision errors.
283 return;
284 }
285 allocation_time_ms_ = current_ms; 280 allocation_time_ms_ = current_ms;
286 new_space_allocation_counter_bytes_ = new_space_counter_bytes; 281 new_space_allocation_counter_bytes_ = new_space_counter_bytes;
287 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes; 282 old_generation_allocation_counter_bytes_ = old_generation_counter_bytes;
288 allocation_duration_since_gc_ += duration; 283 allocation_duration_since_gc_ += duration;
289 new_space_allocation_in_bytes_since_gc_ += new_space_allocated_bytes; 284 new_space_allocation_in_bytes_since_gc_ += new_space_allocated_bytes;
290 old_generation_allocation_in_bytes_since_gc_ += 285 old_generation_allocation_in_bytes_since_gc_ +=
291 old_generation_allocated_bytes; 286 old_generation_allocated_bytes;
292 } 287 }
293 288
294 289
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 721
727 722
728 bool GCTracer::SurvivalEventsRecorded() const { 723 bool GCTracer::SurvivalEventsRecorded() const {
729 return survival_events_.size() > 0; 724 return survival_events_.size() > 0;
730 } 725 }
731 726
732 727
733 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); } 728 void GCTracer::ResetSurvivalEvents() { survival_events_.reset(); }
734 } // namespace internal 729 } // namespace internal
735 } // namespace v8 730 } // 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