[turbolizer] Show operator properties and arity in tooltip.

BUG=

Review-Url: https://codereview.chromium.org/2225683009
Cr-Commit-Position: refs/heads/master@{#38500}
This commit is contained in:
bgeron 2016-08-09 08:45:30 -07:00 committed by Commit bot
parent ab674bab6d
commit a57b243c0f
4 changed files with 40 additions and 3 deletions

View File

@ -126,12 +126,14 @@ class JSONGraphNodeWriter {
} else {
os_ << ",\n";
}
std::ostringstream label, title;
std::ostringstream label, title, properties;
node->op()->PrintTo(label, Operator::PrintVerbosity::kSilent);
node->op()->PrintTo(title, Operator::PrintVerbosity::kVerbose);
node->op()->PrintPropsTo(properties);
os_ << "{\"id\":" << SafeId(node) << ",\"label\":\"" << Escaped(label, "\"")
<< "\""
<< ",\"title\":\"" << Escaped(title, "\"") << "\"";
<< ",\"title\":\"" << Escaped(title, "\"") << "\""
<< ",\"properties\":\"" << Escaped(properties, "\"") << "\"";
IrOpcode::Value opcode = node->opcode();
if (IrOpcode::IsPhiOpcode(opcode)) {
os_ << ",\"rankInputs\":[0," << NodeProperties::FirstControlIndex(node)
@ -153,6 +155,12 @@ class JSONGraphNodeWriter {
os_ << ",\"opcode\":\"" << IrOpcode::Mnemonic(node->opcode()) << "\"";
os_ << ",\"control\":" << (NodeProperties::IsControl(node) ? "true"
: "false");
os_ << ",\"opinfo\":\"" << node->op()->ValueInputCount() << " v "
<< node->op()->EffectInputCount() << " eff "
<< node->op()->ControlInputCount() << " ctrl in, "
<< node->op()->ValueOutputCount() << " v "
<< node->op()->EffectOutputCount() << " eff "
<< node->op()->ControlOutputCount() << " ctrl out\"";
if (NodeProperties::IsTyped(node)) {
Type* type = NodeProperties::GetType(node);
std::ostringstream type_out;

View File

@ -48,6 +48,19 @@ void Operator::PrintToImpl(std::ostream& os, PrintVerbosity verbose) const {
os << mnemonic();
}
void Operator::PrintPropsTo(std::ostream& os) const {
std::string separator = "";
#define PRINT_PROP_IF_SET(name) \
if (HasProperty(Operator::k##name)) { \
os << separator; \
os << #name; \
separator = ", "; \
}
OPERATOR_PROPERTY_LIST(PRINT_PROP_IF_SET)
#undef PRINT_PROP_IF_SET
}
} // namespace compiler
} // namespace internal
} // namespace v8

View File

@ -49,6 +49,12 @@ class Operator : public ZoneObject {
kEliminatable = kNoDeopt | kNoWrite | kNoThrow,
kPure = kNoDeopt | kNoRead | kNoWrite | kNoThrow | kIdempotent
};
// List of all bits, for the visualizer.
#define OPERATOR_PROPERTY_LIST(V) \
V(Commutative) \
V(Associative) V(Idempotent) V(NoRead) V(NoWrite) V(NoThrow) V(NoDeopt)
typedef base::Flags<Property, uint8_t> Properties;
enum class PrintVerbosity { kVerbose, kSilent };
@ -122,6 +128,8 @@ class Operator : public ZoneObject {
return PrintToImpl(os, verbose);
}
void PrintPropsTo(std::ostream& os) const;
protected:
virtual void PrintToImpl(std::ostream& os, PrintVerbosity verbose) const;

View File

@ -48,7 +48,15 @@ var Node = {
return Math.max(inputWidth, this.width);
},
getTitle: function() {
return this.title;
var propsString;
if (this.properties === undefined) {
propsString = "";
} else if (this.properties === "") {
propsString = "no properties";
} else {
propsString = "[" + this.properties + "]";
}
return this.title + "\n" + propsString + "\n" + this.opinfo;
},
getDisplayLabel: function() {
var result = this.id + ":" + this.label;