v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
pipeline-statistics.cc
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
6
7#include <memory>
8
13
14namespace v8 {
15namespace internal {
16namespace compiler {
17
19 PipelineStatisticsBase* pipeline_stats) {
20 DCHECK(!scope_);
21 scope_.reset(new ZoneStats::StatsScope(pipeline_stats->zone_stats_));
22 outer_zone_initial_size_ = pipeline_stats->OuterZoneSize();
26 pipeline_stats->zone_stats_->GetCurrentAllocatedBytes();
27 // TODO(pthier): Move turboshaft specifics out of common class.
28 // TODO(nicohartmann): This is a bit more difficult to do cleanly here without
29 // the use of contextual variables. Add proper Turboshaft statistics in a
30 // follow up CL.
31 //
32 // if (turboshaft::PipelineData::HasScope()) {
33 // graph_size_at_start_ =
34 // turboshaft::PipelineData::Get().graph().number_of_operations();
35 // }
36 timer_.Start();
37}
38
40 PipelineStatisticsBase* pipeline_stats,
43 diff->function_name_ = pipeline_stats->function_name_;
44 diff->delta_ = timer_.Elapsed();
45 size_t outer_zone_diff =
46 pipeline_stats->OuterZoneSize() - outer_zone_initial_size_;
47 diff->max_allocated_bytes_ = outer_zone_diff + scope_->GetMaxAllocatedBytes();
49 diff->max_allocated_bytes_ + allocated_bytes_at_start_;
51 outer_zone_diff + scope_->GetTotalAllocatedBytes();
52 diff->input_graph_size_ = graph_size_at_start_;
53 // TODO(nicohartmann): This is a bit more difficult to do cleanly here without
54 // the use of contextual variables. Add proper Turboshaft statistics in a
55 // follow up CL.
56 //
57 // if (turboshaft::PipelineData::HasScope()) {
58 // diff->output_graph_size_ =
59 // turboshaft::PipelineData::Get().graph().number_of_operations();
60 // }
61 scope_.reset();
62 timer_.Stop();
63}
64
66 Zone* outer_zone, ZoneStats* zone_stats,
67 std::shared_ptr<CompilationStatistics> compilation_stats,
69 : outer_zone_(outer_zone),
70 zone_stats_(zone_stats),
71 compilation_stats_(compilation_stats),
73 total_stats_.Begin(this);
74}
75
81
87
94
95void PipelineStatisticsBase::BeginPhase(const char* phase_name) {
98 phase_stats_.Begin(this);
99}
100
106
108
111 std::shared_ptr<CompilationStatistics> compilation_stats,
112 ZoneStats* zone_stats)
113 : Base(info->zone(), zone_stats, compilation_stats, info->code_kind()) {
114 if (info->has_shared_info()) {
115 set_function_name(info->shared_info()->DebugNameCStr().get());
116 }
117}
118
122
129
137
143
151
152} // namespace compiler
153} // namespace internal
154} // namespace v8
void Begin(PipelineStatisticsBase *pipeline_stats)
void End(PipelineStatisticsBase *pipeline_stats, CompilationStatistics::BasicStats *diff)
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_
void EndPhase(CompilationStatistics::BasicStats *diff)
void BeginPhaseKind(const char *phase_kind_name)
TurbofanPipelineStatistics(OptimizedCompilationInfo *info, std::shared_ptr< CompilationStatistics > turbo_stats, ZoneStats *zone_stats)
size_t GetCurrentAllocatedBytes() const
Definition zone-stats.cc:77
DeclarationScope * scope_
base::ElapsedTimer timer_
const char * CodeKindToString(CodeKind kind)
Definition code-kind.cc:10
#define DCHECK(condition)
Definition logging.h:482
#define TRACE_EVENT_END2(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)
#define TRACE_EVENT_BEGIN1(category_group, name, arg1_name, arg1_val)
#define TRACE_STR_COPY(str)
Definition trace-event.h:50