OLD | NEW |
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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/pipeline-statistics.h" | 8 #include "src/compiler/pipeline-statistics.h" |
9 #include "src/compiler/zone-pool.h" | 9 #include "src/compiler/zone-pool.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 void PipelineStatistics::CommonStats::Begin( | 15 void PipelineStatistics::CommonStats::Begin( |
16 PipelineStatistics* pipeline_stats) { | 16 PipelineStatistics* pipeline_stats) { |
17 DCHECK(scope_.is_empty()); | 17 DCHECK(!scope_); |
18 scope_.Reset(new ZonePool::StatsScope(pipeline_stats->zone_pool_)); | 18 scope_.reset(new ZonePool::StatsScope(pipeline_stats->zone_pool_)); |
19 timer_.Start(); | 19 timer_.Start(); |
20 outer_zone_initial_size_ = pipeline_stats->OuterZoneSize(); | 20 outer_zone_initial_size_ = pipeline_stats->OuterZoneSize(); |
21 allocated_bytes_at_start_ = | 21 allocated_bytes_at_start_ = |
22 outer_zone_initial_size_ - | 22 outer_zone_initial_size_ - |
23 pipeline_stats->total_stats_.outer_zone_initial_size_ + | 23 pipeline_stats->total_stats_.outer_zone_initial_size_ + |
24 pipeline_stats->zone_pool_->GetCurrentAllocatedBytes(); | 24 pipeline_stats->zone_pool_->GetCurrentAllocatedBytes(); |
25 } | 25 } |
26 | 26 |
27 | 27 |
28 void PipelineStatistics::CommonStats::End( | 28 void PipelineStatistics::CommonStats::End( |
29 PipelineStatistics* pipeline_stats, | 29 PipelineStatistics* pipeline_stats, |
30 CompilationStatistics::BasicStats* diff) { | 30 CompilationStatistics::BasicStats* diff) { |
31 DCHECK(!scope_.is_empty()); | 31 DCHECK(scope_); |
32 diff->function_name_ = pipeline_stats->function_name_; | 32 diff->function_name_ = pipeline_stats->function_name_; |
33 diff->delta_ = timer_.Elapsed(); | 33 diff->delta_ = timer_.Elapsed(); |
34 size_t outer_zone_diff = | 34 size_t outer_zone_diff = |
35 pipeline_stats->OuterZoneSize() - outer_zone_initial_size_; | 35 pipeline_stats->OuterZoneSize() - outer_zone_initial_size_; |
36 diff->max_allocated_bytes_ = outer_zone_diff + scope_->GetMaxAllocatedBytes(); | 36 diff->max_allocated_bytes_ = outer_zone_diff + scope_->GetMaxAllocatedBytes(); |
37 diff->absolute_max_allocated_bytes_ = | 37 diff->absolute_max_allocated_bytes_ = |
38 diff->max_allocated_bytes_ + allocated_bytes_at_start_; | 38 diff->max_allocated_bytes_ + allocated_bytes_at_start_; |
39 diff->total_allocated_bytes_ = | 39 diff->total_allocated_bytes_ = |
40 outer_zone_diff + scope_->GetTotalAllocatedBytes(); | 40 outer_zone_diff + scope_->GetTotalAllocatedBytes(); |
41 scope_.Reset(nullptr); | 41 scope_.reset(); |
42 timer_.Stop(); | 42 timer_.Stop(); |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 PipelineStatistics::PipelineStatistics(CompilationInfo* info, | 46 PipelineStatistics::PipelineStatistics(CompilationInfo* info, |
47 ZonePool* zone_pool) | 47 ZonePool* zone_pool) |
48 : isolate_(info->isolate()), | 48 : isolate_(info->isolate()), |
49 outer_zone_(info->zone()), | 49 outer_zone_(info->zone()), |
50 zone_pool_(zone_pool), | 50 zone_pool_(zone_pool), |
51 compilation_stats_(isolate_->GetTurboStatistics()), | 51 compilation_stats_(isolate_->GetTurboStatistics()), |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void PipelineStatistics::EndPhase() { | 96 void PipelineStatistics::EndPhase() { |
97 DCHECK(InPhaseKind()); | 97 DCHECK(InPhaseKind()); |
98 CompilationStatistics::BasicStats diff; | 98 CompilationStatistics::BasicStats diff; |
99 phase_stats_.End(this, &diff); | 99 phase_stats_.End(this, &diff); |
100 compilation_stats_->RecordPhaseStats(phase_kind_name_, phase_name_, diff); | 100 compilation_stats_->RecordPhaseStats(phase_kind_name_, phase_name_, diff); |
101 } | 101 } |
102 | 102 |
103 } // namespace compiler | 103 } // namespace compiler |
104 } // namespace internal | 104 } // namespace internal |
105 } // namespace v8 | 105 } // namespace v8 |
OLD | NEW |