Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: src/compiler/graph-visualizer.cc

Issue 2255263002: [turbolizer] Also escape backslashes in JSON strings. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/graph-visualizer.cc
diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc
index ca5b8e8e4e47d4a72d9e0d55b590cf17d15abb96..a626508c7781dbea297e9c7dc725ebb711a83ca9 100644
--- a/src/compiler/graph-visualizer.cc
+++ b/src/compiler/graph-visualizer.cc
@@ -85,7 +85,7 @@ static const char* SafeMnemonic(Node* node) {
class Escaped {
public:
explicit Escaped(const std::ostringstream& os,
- const char* escaped_chars = "<>|{}")
+ const char* escaped_chars = "<>|{}\\")
: str_(os.str()), escaped_chars_(escaped_chars) {}
friend std::ostream& operator<<(std::ostream& os, const Escaped& e) {
@@ -134,11 +134,11 @@ class JSONGraphNodeWriter {
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, "\"") << "\""
+ os_ << "{\"id\":" << SafeId(node) << ",\"label\":\""
+ << Escaped(label, "\"\\") << "\""
+ << ",\"title\":\"" << Escaped(title, "\"\\") << "\""
<< ",\"live\": " << (live_.IsLive(node) ? "true" : "false")
- << ",\"properties\":\"" << Escaped(properties, "\"") << "\"";
+ << ",\"properties\":\"" << Escaped(properties, "\"\\") << "\"";
IrOpcode::Value opcode = node->opcode();
if (IrOpcode::IsPhiOpcode(opcode)) {
os_ << ",\"rankInputs\":[0," << NodeProperties::FirstControlIndex(node)
@@ -170,7 +170,7 @@ class JSONGraphNodeWriter {
Type* type = NodeProperties::GetType(node);
std::ostringstream type_out;
type->PrintTo(type_out);
- os_ << ",\"type\":\"" << Escaped(type_out, "\"") << "\"";
+ os_ << ",\"type\":\"" << Escaped(type_out, "\"\\") << "\"";
}
os_ << "}";
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698