v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
pipeline-statistics.h
Go to the documentation of this file.
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
3// found in the LICENSE file.
4
5#ifndef V8_COMPILER_PIPELINE_STATISTICS_H_
6#define V8_COMPILER_PIPELINE_STATISTICS_H_
7
8#include <memory>
9#include <string>
10
17
18namespace v8 {
19namespace internal {
20namespace compiler {
21
22class PhaseScope;
23
25 protected:
27
29 Zone* outer_zone, ZoneStats* zone_stats,
30 std::shared_ptr<CompilationStatistics> compilation_stats,
33
34 // No copying.
37
38 void BeginPhaseKind(const char* phase_kind_name);
40
41 size_t OuterZoneSize() {
42 return static_cast<size_t>(outer_zone_->allocation_size());
43 }
44
46 public:
48 CommonStats(const CommonStats&) = delete;
50
51 void Begin(PipelineStatisticsBase* pipeline_stats);
52 void End(PipelineStatisticsBase* pipeline_stats,
54
55 std::unique_ptr<ZoneStats::StatsScope> scope_;
60 };
61
63
64 friend class PhaseScope;
65 bool InPhase() { return !!phase_stats_.scope_; }
66 void BeginPhase(const char* name);
68
69 CodeKind code_kind() const { return code_kind_; }
70 const char* phase_kind_name() const { return phase_kind_name_; }
71 const char* phase_name() const { return phase_name_; }
72
73 void set_function_name(std::string function_name) {
74 function_name_.assign(function_name);
75 }
76
77 private:
80 const std::shared_ptr<CompilationStatistics> compilation_stats_;
82 std::string function_name_;
83
84 // Stats for the entire compilation.
86
87 // Stats for phase kind.
88 const char* phase_kind_name_ = nullptr;
90
91 // Stats for phase.
92 const char* phase_name_ = nullptr;
94};
95
97 public Malloced {
98 public:
100 std::shared_ptr<CompilationStatistics> turbo_stats,
101 ZoneStats* zone_stats);
105 delete;
106
107 // We log detailed phase information about the pipeline
108 // in both the v8.turbofan and the v8.wasm.turbofan categories.
109 static constexpr char kTraceCategory[] =
110 TRACE_DISABLED_BY_DEFAULT("v8.turbofan") "," // --
111 TRACE_DISABLED_BY_DEFAULT("v8.wasm.turbofan");
112
113 void BeginPhaseKind(const char* name);
114 void EndPhaseKind();
115 void BeginPhase(const char* name);
116 void EndPhase();
117};
118
120 public:
121 PhaseScope(TurbofanPipelineStatistics* pipeline_stats, const char* name)
122 : pipeline_stats_(pipeline_stats) {
123 if (pipeline_stats_ != nullptr) pipeline_stats_->BeginPhase(name);
124 }
126 if (pipeline_stats_ != nullptr) pipeline_stats_->EndPhase();
127 }
128 PhaseScope(const PhaseScope&) = delete;
129 PhaseScope& operator=(const PhaseScope&) = delete;
130
131 private:
133};
134
135} // namespace compiler
136} // namespace internal
137} // namespace v8
138
139#endif // V8_COMPILER_PIPELINE_STATISTICS_H_
size_t allocation_size() const
Definition zone.h:189
PhaseScope(TurbofanPipelineStatistics *pipeline_stats, const char *name)
PhaseScope & operator=(const PhaseScope &)=delete
PhaseScope(const PhaseScope &)=delete
TurbofanPipelineStatistics *const pipeline_stats_
void Begin(PipelineStatisticsBase *pipeline_stats)
void End(PipelineStatisticsBase *pipeline_stats, CompilationStatistics::BasicStats *diff)
CommonStats & operator=(const CommonStats &)=delete
PipelineStatisticsBase(Zone *outer_zone, ZoneStats *zone_stats, std::shared_ptr< CompilationStatistics > compilation_stats, CodeKind code_kind)
void EndPhaseKind(CompilationStatistics::BasicStats *diff)
const std::shared_ptr< CompilationStatistics > compilation_stats_
PipelineStatisticsBase & operator=(const PipelineStatisticsBase &)=delete
PipelineStatisticsBase(const PipelineStatisticsBase &)=delete
void EndPhase(CompilationStatistics::BasicStats *diff)
void BeginPhaseKind(const char *phase_kind_name)
void set_function_name(std::string function_name)
TurbofanPipelineStatistics & operator=(const TurbofanPipelineStatistics &)=delete
TurbofanPipelineStatistics(const TurbofanPipelineStatistics &)=delete
TurbofanPipelineStatistics(OptimizedCompilationInfo *info, std::shared_ptr< CompilationStatistics > turbo_stats, ZoneStats *zone_stats)
#define TRACE_DISABLED_BY_DEFAULT(name)
#define V8_NODISCARD
Definition v8config.h:693