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/compilation-info.h" | 7 #include "src/compilation-info.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/zonestats.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 namespace compiler { | 14 namespace compiler { |
15 | 15 |
16 void PipelineStatistics::CommonStats::Begin( | 16 void PipelineStatistics::CommonStats::Begin( |
17 PipelineStatistics* pipeline_stats) { | 17 PipelineStatistics* pipeline_stats) { |
18 DCHECK(!scope_); | 18 DCHECK(!scope_); |
19 scope_.reset(new ZonePool::StatsScope(pipeline_stats->zone_pool_)); | 19 scope_.reset(new ZoneStats::StatsScope(pipeline_stats->zone_stats_)); |
20 timer_.Start(); | 20 timer_.Start(); |
21 outer_zone_initial_size_ = pipeline_stats->OuterZoneSize(); | 21 outer_zone_initial_size_ = pipeline_stats->OuterZoneSize(); |
22 allocated_bytes_at_start_ = | 22 allocated_bytes_at_start_ = |
23 outer_zone_initial_size_ - | 23 outer_zone_initial_size_ - |
24 pipeline_stats->total_stats_.outer_zone_initial_size_ + | 24 pipeline_stats->total_stats_.outer_zone_initial_size_ + |
25 pipeline_stats->zone_pool_->GetCurrentAllocatedBytes(); | 25 pipeline_stats->zone_stats_->GetCurrentAllocatedBytes(); |
26 } | 26 } |
27 | 27 |
28 | 28 |
29 void PipelineStatistics::CommonStats::End( | 29 void PipelineStatistics::CommonStats::End( |
30 PipelineStatistics* pipeline_stats, | 30 PipelineStatistics* pipeline_stats, |
31 CompilationStatistics::BasicStats* diff) { | 31 CompilationStatistics::BasicStats* diff) { |
32 DCHECK(scope_); | 32 DCHECK(scope_); |
33 diff->function_name_ = pipeline_stats->function_name_; | 33 diff->function_name_ = pipeline_stats->function_name_; |
34 diff->delta_ = timer_.Elapsed(); | 34 diff->delta_ = timer_.Elapsed(); |
35 size_t outer_zone_diff = | 35 size_t outer_zone_diff = |
36 pipeline_stats->OuterZoneSize() - outer_zone_initial_size_; | 36 pipeline_stats->OuterZoneSize() - outer_zone_initial_size_; |
37 diff->max_allocated_bytes_ = outer_zone_diff + scope_->GetMaxAllocatedBytes(); | 37 diff->max_allocated_bytes_ = outer_zone_diff + scope_->GetMaxAllocatedBytes(); |
38 diff->absolute_max_allocated_bytes_ = | 38 diff->absolute_max_allocated_bytes_ = |
39 diff->max_allocated_bytes_ + allocated_bytes_at_start_; | 39 diff->max_allocated_bytes_ + allocated_bytes_at_start_; |
40 diff->total_allocated_bytes_ = | 40 diff->total_allocated_bytes_ = |
41 outer_zone_diff + scope_->GetTotalAllocatedBytes(); | 41 outer_zone_diff + scope_->GetTotalAllocatedBytes(); |
42 scope_.reset(); | 42 scope_.reset(); |
43 timer_.Stop(); | 43 timer_.Stop(); |
44 } | 44 } |
45 | 45 |
46 | |
47 PipelineStatistics::PipelineStatistics(CompilationInfo* info, | 46 PipelineStatistics::PipelineStatistics(CompilationInfo* info, |
48 ZonePool* zone_pool) | 47 ZoneStats* zone_stats) |
49 : isolate_(info->isolate()), | 48 : isolate_(info->isolate()), |
50 outer_zone_(info->zone()), | 49 outer_zone_(info->zone()), |
51 zone_pool_(zone_pool), | 50 zone_stats_(zone_stats), |
52 compilation_stats_(isolate_->GetTurboStatistics()), | 51 compilation_stats_(isolate_->GetTurboStatistics()), |
53 source_size_(0), | 52 source_size_(0), |
54 phase_kind_name_(nullptr), | 53 phase_kind_name_(nullptr), |
55 phase_name_(nullptr) { | 54 phase_name_(nullptr) { |
56 if (info->has_shared_info()) { | 55 if (info->has_shared_info()) { |
57 source_size_ = static_cast<size_t>(info->shared_info()->SourceSize()); | 56 source_size_ = static_cast<size_t>(info->shared_info()->SourceSize()); |
58 std::unique_ptr<char[]> name = | 57 std::unique_ptr<char[]> name = |
59 info->shared_info()->DebugName()->ToCString(); | 58 info->shared_info()->DebugName()->ToCString(); |
60 function_name_ = name.get(); | 59 function_name_ = name.get(); |
61 } | 60 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void PipelineStatistics::EndPhase() { | 96 void PipelineStatistics::EndPhase() { |
98 DCHECK(InPhaseKind()); | 97 DCHECK(InPhaseKind()); |
99 CompilationStatistics::BasicStats diff; | 98 CompilationStatistics::BasicStats diff; |
100 phase_stats_.End(this, &diff); | 99 phase_stats_.End(this, &diff); |
101 compilation_stats_->RecordPhaseStats(phase_kind_name_, phase_name_, diff); | 100 compilation_stats_->RecordPhaseStats(phase_kind_name_, phase_name_, diff); |
102 } | 101 } |
103 | 102 |
104 } // namespace compiler | 103 } // namespace compiler |
105 } // namespace internal | 104 } // namespace internal |
106 } // namespace v8 | 105 } // namespace v8 |
OLD | NEW |