v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
node-origin-table.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
9
10namespace v8 {
11namespace internal {
12namespace compiler {
13
14void NodeOrigin::PrintJson(std::ostream& out) const {
15 out << "{ ";
16 switch (origin_kind_) {
17 case kGraphNode:
18 out << "\"nodeId\" : ";
19 break;
20 case kWasmBytecode:
21 case kJSBytecode:
22 out << "\"bytecodePosition\" : ";
23 break;
24 }
25 out << created_from();
26 out << ", \"reducer\" : \"" << reducer_name() << "\"";
27 out << ", \"phase\" : \"" << phase_name() << "\"";
28 out << "}";
29}
30
32 public:
34
35 void Decorate(Node* node) final {
37 }
38
39 private:
41};
42
44 : graph_(graph),
45 decorator_(nullptr),
46 current_origin_(NodeOrigin::Unknown()),
47 current_bytecode_position_(0),
48 current_phase_name_("unknown"),
49 table_(graph->zone()) {}
50
52 : graph_(nullptr),
53 decorator_(nullptr),
54 current_origin_(NodeOrigin::Unknown()),
55 current_bytecode_position_(0),
56 current_phase_name_("unknown"),
57 table_(zone) {}
58
65
72
74 return table_.Get(node);
75}
77 return table_.Get(id);
78}
79
81 table_.Set(node, no);
82}
84 table_.Set(id, NodeOrigin(current_phase_name_, "", origin));
85}
90
91void NodeOriginTable::PrintJson(std::ostream& os) const {
92 os << "{";
93 bool needs_comma = false;
94 for (auto i : table_) {
95 NodeOrigin no = i.second;
96 if (no.IsKnown()) {
97 if (needs_comma) {
98 os << ",";
99 }
100 os << "\"" << i.first << "\""
101 << ": ";
102 no.PrintJson(os);
103 needs_comma = true;
104 }
105 }
106 os << "}";
107}
108
109} // namespace compiler
110} // namespace internal
111} // namespace v8
Builtins::Kind kind
Definition builtins.cc:40
T * New(Args &&... args)
Definition zone.h:114
NodeOrigin GetNodeOrigin(Node *node) const
void SetNodeOrigin(Node *node, const NodeOrigin &no)
void PrintJson(std::ostream &os) const
NodeAuxData< NodeOrigin, UnknownNodeOrigin > table_
void PrintJson(std::ostream &out) const
void AddDecorator(GraphDecorator *decorator)
void RemoveDecorator(GraphDecorator *decorator)
NodeOriginTable * origins
SourcePositionTable *const table_
Definition pipeline.cc:227
#define DCHECK_NULL(val)
Definition logging.h:491
#define DCHECK_NOT_NULL(val)
Definition logging.h:492
TFGraph * graph_