v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
tracing.h
Go to the documentation of this file.
1// Copyright 2023 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_TURBOSHAFT_TRACING_H_
6#define V8_COMPILER_TURBOSHAFT_TRACING_H_
7
13
15
16class Tracing : public base::ContextualClass<Tracing> {
17 public:
18 explicit Tracing(OptimizedCompilationInfo* info) : info_(info) {
20 }
21
23 std::function<bool(std::ostream&, const Graph&, OpIndex)>;
25 std::function<bool(std::ostream&, const Graph&, BlockIndex)>;
26
27 inline bool is_enabled() const { return info_->trace_turbo_json(); }
28
29 void PrintPerOperationData(const char* data_name, const Graph& graph,
30 OperationDataPrinter printer) {
31 DCHECK(printer);
32 if (!is_enabled()) return;
33 TurboJsonFile json_of(info_, std::ios_base::app);
34 PrintTurboshaftCustomDataPerOperation(json_of, data_name, graph, printer);
35 }
36 void PrintPerBlockData(const char* data_name, const Graph& graph,
37 BlockDataPrinter printer) {
38 DCHECK(printer);
39 if (!is_enabled()) return;
40 TurboJsonFile json_of(info_, std::ios_base::app);
41 PrintTurboshaftCustomDataPerBlock(json_of, data_name, graph, printer);
42 }
43
44 private:
46};
47
48} // namespace v8::internal::compiler::turboshaft
49
50#endif // V8_COMPILER_TURBOSHAFT_TRACING_H_
void PrintPerBlockData(const char *data_name, const Graph &graph, BlockDataPrinter printer)
Definition tracing.h:36
std::function< bool(std::ostream &, const Graph &, OpIndex)> OperationDataPrinter
Definition tracing.h:22
OptimizedCompilationInfo * info_
Definition tracing.h:45
Tracing(OptimizedCompilationInfo *info)
Definition tracing.h:18
std::function< bool(std::ostream &, const Graph &, BlockIndex)> BlockDataPrinter
Definition tracing.h:24
void PrintPerOperationData(const char *data_name, const Graph &graph, OperationDataPrinter printer)
Definition tracing.h:29
void PrintTurboshaftCustomDataPerBlock(std::ofstream &stream, const char *data_name, const Graph &graph, std::function< bool(std::ostream &, const Graph &, BlockIndex)> printer)
void PrintTurboshaftCustomDataPerOperation(std::ofstream &stream, const char *data_name, const Graph &graph, std::function< bool(std::ostream &, const Graph &, OpIndex)> printer)
template const Signature< wasm::ValueType > bool
#define DCHECK_NOT_NULL(val)
Definition logging.h:492
#define DCHECK(condition)
Definition logging.h:482