5 #include "src/compiler/node-origin-table.h" 6 #include "src/compiler/graph.h" 7 #include "src/compiler/node-aux-data.h" 13 void NodeOrigin::PrintJson(std::ostream& out)
const {
15 switch (origin_kind_) {
17 out <<
"\"nodeId\" : ";
20 out <<
"\"bytecodePosition\" : ";
23 out << created_from();
24 out <<
", \"reducer\" : \"" << reducer_name() <<
"\"";
25 out <<
", \"phase\" : \"" << phase_name() <<
"\"";
33 void Decorate(
Node* node)
final {
34 origins_->SetNodeOrigin(node, origins_->current_origin_);
41 NodeOriginTable::NodeOriginTable(
Graph* graph)
45 current_phase_name_(
"unknown"),
46 table_(graph->zone()) {}
48 void NodeOriginTable::AddDecorator() {
49 DCHECK_NULL(decorator_);
50 decorator_ =
new (graph_->zone()) Decorator(
this);
51 graph_->AddDecorator(decorator_);
54 void NodeOriginTable::RemoveDecorator() {
55 DCHECK_NOT_NULL(decorator_);
56 graph_->RemoveDecorator(decorator_);
60 NodeOrigin NodeOriginTable::GetNodeOrigin(Node* node)
const {
61 return table_.Get(node);
64 void NodeOriginTable::SetNodeOrigin(Node* node,
const NodeOrigin& no) {
68 void NodeOriginTable::PrintJson(std::ostream& os)
const {
70 bool needs_comma =
false;
71 for (
auto i : table_) {
72 NodeOrigin no =
i.second;
77 os <<
"\"" <<
i.first <<
"\""