V8 Project
v8::internal::compiler::JSONGraphNodeWriter Class Reference
+ Inheritance diagram for v8::internal::compiler::JSONGraphNodeWriter:
+ Collaboration diagram for v8::internal::compiler::JSONGraphNodeWriter:

Public Member Functions

 JSONGraphNodeWriter (OStream &os, Zone *zone, const Graph *graph)
 
void Print ()
 
GenericGraphVisit::Control Pre (Node *node)
 
- Public Member Functions inherited from v8::internal::compiler::GenericGraphVisit::NullNodeVisitor< B, S >
Control Pre (GenericNode< B, S > *node)
 
Control Post (GenericNode< B, S > *node)
 
void PreEdge (GenericNode< B, S > *from, int index, GenericNode< B, S > *to)
 
void PostEdge (GenericNode< B, S > *from, int index, GenericNode< B, S > *to)
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (JSONGraphNodeWriter)
 

Private Attributes

OStreamos_
 
const Graph *const graph_
 
bool first_node_
 

Detailed Description

Definition at line 50 of file graph-visualizer.cc.

Constructor & Destructor Documentation

◆ JSONGraphNodeWriter()

v8::internal::compiler::JSONGraphNodeWriter::JSONGraphNodeWriter ( OStream os,
Zone zone,
const Graph graph 
)
inline

Member Function Documentation

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::compiler::JSONGraphNodeWriter::DISALLOW_COPY_AND_ASSIGN ( JSONGraphNodeWriter  )
private

◆ Pre()

GenericGraphVisit::Control v8::internal::compiler::JSONGraphNodeWriter::Pre ( Node *  node)

Definition at line 70 of file graph-visualizer.cc.

70  {
71  if (first_node_) {
72  first_node_ = false;
73  } else {
74  os_ << ",";
75  }
76  OStringStream label;
77  label << *node->op();
78  os_ << "{\"id\":" << node->id() << ",\"label\":\"" << Escaped(label, "\"")
79  << "\"";
80  IrOpcode::Value opcode = node->opcode();
81  if (opcode == IrOpcode::kPhi || opcode == IrOpcode::kEffectPhi) {
82  os_ << ",\"rankInputs\":[0," << NodeProperties::FirstControlIndex(node)
83  << "]";
84  os_ << ",\"rankWithInput\":[" << NodeProperties::FirstControlIndex(node)
85  << "]";
86  } else if (opcode == IrOpcode::kIfTrue || opcode == IrOpcode::kIfFalse ||
87  opcode == IrOpcode::kLoop) {
88  os_ << ",\"rankInputs\":[" << NodeProperties::FirstControlIndex(node)
89  << "]";
90  }
91  if (opcode == IrOpcode::kBranch) {
92  os_ << ",\"rankInputs\":[0]";
93  }
94  os_ << ",\"opcode\":\"" << IrOpcode::Mnemonic(node->opcode()) << "\"";
95  os_ << ",\"control\":" << (NodeProperties::IsControl(node) ? "true"
96  : "false");
97  os_ << "}";
99 }
static const char * Mnemonic(Value val)
Definition: opcodes.h:256

References v8::internal::compiler::GenericGraphVisit::CONTINUE, first_node_, v8::internal::compiler::NodeProperties::FirstControlIndex(), v8::internal::compiler::NodeProperties::IsControl(), v8::internal::compiler::IrOpcode::Mnemonic(), and os_.

+ Here is the call graph for this function:

◆ Print()

void v8::internal::compiler::JSONGraphNodeWriter::Print ( )
inline

Definition at line 57 of file graph-visualizer.cc.

57 { const_cast<Graph*>(graph_)->VisitNodeInputsFromEnd(this); }

References graph_.

Referenced by v8::internal::compiler::operator<<().

+ Here is the caller graph for this function:

Member Data Documentation

◆ first_node_

bool v8::internal::compiler::JSONGraphNodeWriter::first_node_
private

Definition at line 64 of file graph-visualizer.cc.

Referenced by Pre().

◆ graph_

const Graph* const v8::internal::compiler::JSONGraphNodeWriter::graph_
private

Definition at line 63 of file graph-visualizer.cc.

Referenced by Print().

◆ os_

OStream& v8::internal::compiler::JSONGraphNodeWriter::os_
private

Definition at line 62 of file graph-visualizer.cc.

Referenced by Pre().


The documentation for this class was generated from the following file: