Lines Matching refs:os

70   explicit JSONEscaped(const std::ostringstream& os) : str_(os.str()) {}
72 friend std::ostream& operator<<(std::ostream& os, const JSONEscaped& e) {
73 for (char c : e.str_) PipeCharacter(os, c);
74 return os;
78 static std::ostream& PipeCharacter(std::ostream& os, char c) {
79 if (c == '"') return os << "\\\"";
80 if (c == '\\') return os << "\\\\";
81 if (c == '\b') return os << "\\b";
82 if (c == '\f') return os << "\\f";
83 if (c == '\n') return os << "\\n";
84 if (c == '\r') return os << "\\r";
85 if (c == '\t') return os << "\\t";
86 return os << c;
92 void JsonPrintFunctionSource(std::ostream& os, int source_id,
96 if (with_key) os << "\"" << source_id << "\" : ";
98 os << "{ ";
99 os << "\"sourceId\": " << source_id;
100 os << ", \"functionName\": \"" << function_name.get() << "\" ";
106 os << ", \"sourceName\": \"";
110 os << JSONEscaped(escaped_name);
112 os << "\"";
117 os << ", \"sourceText\": \"";
121 os << AsEscapedUC16ForJSON(c);
123 os << "\"";
126 os << ", \"sourceName\": \"\"";
127 os << ", \"sourceText\": \"\"";
129 os << ", \"startPosition\": " << start;
130 os << ", \"endPosition\": " << end;
131 os << "}";
150 std::ostream& os, int source_id, int inlining_id,
152 os << "\"" << inlining_id << "\" : ";
153 os << "{ \"inliningId\" : " << inlining_id;
154 os << ", \"sourceId\" : " << source_id;
157 os << ", \"inliningPosition\" : " << AsJSON(position);
159 os << "}";
164 void JsonPrintAllSourceWithPositions(std::ostream& os,
167 os << "\"sources\" : {";
173 JsonPrintFunctionSource(os, -1,
181 os << ", ";
184 JsonPrintFunctionSource(os, source_id, shared->DebugNameCStr(),
188 os << "}, ";
189 os << "\"inlinings\" : {";
192 if (need_comma) os << ", ";
194 JsonPrintInlinedFunctionInfo(os, source_id, id, inlined[id]);
197 os << "}";
271 JSONGraphWriter::JSONGraphWriter(std::ostream& os, const Graph* graph,
274 : os_(os),
401 std::ostream& operator<<(std::ostream& os, const GraphAsJSON& ad) {
402 JSONGraphWriter writer(os, &ad.graph, ad.positions, ad.origins);
404 return os;
410 GraphC1Visualizer(std::ostream& os, Zone* zone);
473 GraphC1Visualizer::GraphC1Visualizer(std::ostream& os, Zone* zone)
474 : os_(os), indent_(0), zone_(zone) {}
794 std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac) {
797 GraphC1Visualizer(os, &tmp_zone).PrintCompilation(ac.info_);
798 return os;
802 std::ostream& operator<<(std::ostream& os, const AsC1V& ac) {
805 GraphC1Visualizer(os, &tmp_zone)
807 return os;
811 std::ostream& operator<<(std::ostream& os,
817 GraphC1Visualizer(os, &tmp_zone)
821 return os;
828 std::ostream& operator<<(std::ostream& os, const AsRPO& ar) {
864 os << "#" << n->id() << ":" << *n->op() << "(";
868 if (j++ > 0) os << ", ";
869 os << "#" << SafeId(i) << ":" << SafeMnemonic(i);
871 os << ")";
874 os << " [Type: " << NodeProperties::GetType(n) << "]";
876 os << std::endl;
879 return os;
884 void PrintIndent(std::ostream& os, int indent) {
885 os << " ";
887 os << ". ";
891 void PrintScheduledNode(std::ostream& os, int indent, Node* n) {
892 PrintIndent(os, indent);
893 os << "#" << n->id() << ":" << *n->op() << "(";
897 if (j++ > 0) os << ", ";
898 os << "#" << SafeId(i) << ":" << SafeMnemonic(i);
900 os << ")";
903 os << " [Type: " << NodeProperties::GetType(n) << "]";
907 void PrintScheduledGraph(std::ostream& os, const Schedule* schedule) {
913 os << " + Block B" << current->rpo_number() << " (pred:";
915 os << " B" << predecessor->rpo_number();
918 os << ", loop until B" << current->loop_end()->rpo_number();
920 os << ", in loop B" << current->loop_header()->rpo_number();
922 os << ")" << std::endl;
927 PrintScheduledNode(os, indent, node);
928 os << std::endl;
933 PrintScheduledNode(os, indent, current->control_input());
935 PrintIndent(os, indent);
936 os << "Goto";
938 os << " ->";
945 os << ",";
947 os << " B" << successor->rpo_number();
949 os << std::endl;
958 std::ostream& operator<<(std::ostream& os,
961 os << "{\"id\":" << range.relative_id() << ",\"type\":";
964 os << "\"assigned\",\"op\":"
969 os << "\"assigned\",\"op\":"
974 os << "\"spilled\",\"op\":";
976 os << "\"fp_stack:" << index << "\"";
978 os << "\"stack:" << index << "\"";
982 os << "\"none\"";
985 os << ",\"intervals\":[";
992 os << ",";
994 os << "[" << interval->start().value() << "," << interval->end().value()
998 os << "],\"uses\":[";
1005 os << ",";
1007 os << current_pos->pos().value();
1010 os << "]}";
1011 return os;
1015 std::ostream& os,
1019 os << "\"" << (vreg > 0 ? vreg : -vreg) << "\":{ \"child_ranges\":[";
1026 os << ",";
1028 os << LiveRangeAsJSON{*child, top_level_live_range_json.code_};
1031 os << "]";
1033 os << ", \"is_deferred\": "
1037 os << "}";
1038 return os;
1041 void PrintTopLevelLiveRanges(std::ostream& os,
1045 os << "{";
1051 os << ",";
1053 os << TopLevelLiveRangeAsJSON{*range, code};
1056 os << "}";
1059 std::ostream& operator<<(std::ostream& os,
1064 os << "\"fixed_double_live_ranges\": ";
1065 PrintTopLevelLiveRanges(os, ac_data.fixed_double_live_ranges(), ac.code_);
1066 os << ",\"fixed_live_ranges\": ";
1067 PrintTopLevelLiveRanges(os, ac_data.fixed_live_ranges(), ac.code_);
1068 os << ",\"live_ranges\": ";
1069 PrintTopLevelLiveRanges(os, ac_data.live_ranges(), ac.code_);
1073 os << "\"fixed_double_live_ranges\": {}";
1074 os << ",\"fixed_live_ranges\": {}";
1075 os << ",\"live_ranges\": {}";
1077 return os;
1080 std::ostream& operator<<(std::ostream& os, const AsScheduledGraph& scheduled) {
1081 PrintScheduledGraph(os, scheduled.schedule);
1082 return os;
1085 std::ostream& operator<<(std::ostream& os, const InstructionOperandAsJSON& o) {
1088 os << "{";
1092 os << "\"type\": \"unallocated\", ";
1093 os << "\"text\": \"v" << unalloc->virtual_register() << "\"";
1095 os << ",\"tooltip\": \"FIXED_SLOT: " << unalloc->fixed_slot_index()
1103 os << ",\"tooltip\": \"FIXED_REGISTER: "
1108 os << ",\"tooltip\": \"FIXED_FP_REGISTER: "
1114 os << ",\"tooltip\": \"MUST_HAVE_REGISTER\"";
1118 os << ",\"tooltip\": \"MUST_HAVE_SLOT\"";
1122 os << ",\"tooltip\": \"SAME_AS_INPUT: " << unalloc->input_index()
1127 os << ",\"tooltip\": \"REGISTER_OR_SLOT\"";
1131 os << ",\"tooltip\": \"REGISTER_OR_SLOT_OR_CONSTANT\"";
1139 os << "\"type\": \"constant\", ";
1140 os << "\"text\": \"v" << vreg << "\",";
1141 os << "\"tooltip\": \"";
1145 os << AsEscapedUC16ForJSON(c);
1147 os << "\"";
1151 os << "\"type\": \"immediate\", ";
1155 os << "\"text\": \"#" << imm->inline_int32_value() << "\"";
1159 os << "\"text\": \"#" << imm->inline_int64_value() << "\"";
1165 os << "\"text\": \"imm:" << index << "\",";
1166 os << "\"tooltip\": \"";
1170 os << AsEscapedUC16ForJSON(c);
1172 os << "\"";
1180 os << "\"type\": \"allocated\", ";
1181 os << "\"text\": \"";
1183 os << "stack:" << allocated->index();
1185 os << "fp_stack:" << allocated->index();
1188 os << Register::from_code(allocated->register_code());
1190 os << Register::GetSpecialRegisterName(allocated->register_code());
1193 os << DoubleRegister::from_code(allocated->register_code());
1195 os << FloatRegister::from_code(allocated->register_code());
1198 os << Simd128Register::from_code(allocated->register_code());
1200 os << "\",";
1201 os << "\"tooltip\": \""
1209 os << "}";
1210 return os;
1213 std::ostream& operator<<(std::ostream& os, const InstructionAsJSON& i_json) {
1216 os << "{";
1217 os << "\"id\": " << i_json.index_ << ",";
1218 os << "\"opcode\": \"" << ArchOpcodeField::decode(instr->opcode()) << "\",";
1219 os << "\"flags\": \"";
1223 os << " : " << AddressingModeField::decode(instr->opcode());
1226 os << " && " << fm << " if "
1229 os << "\",";
1231 os << "\"gaps\": [";
1234 if (i != Instruction::FIRST_GAP_POSITION) os << ",";
1235 os << "[";
1238 os << "]";
1247 os << ",";
1249 os << "[" << InstructionOperandAsJSON{&move->destination(), i_json.code_}
1253 os << "]";
1255 os << "],";
1257 os << "\"outputs\": [";
1260 if (need_comma) os << ",";
1262 os << InstructionOperandAsJSON{instr->OutputAt(i), i_json.code_};
1264 os << "],";
1266 os << "\"inputs\": [";
1269 if (need_comma) os << ",";
1271 os << InstructionOperandAsJSON{instr->InputAt(i), i_json.code_};
1273 os << "],";
1275 os << "\"temps\": [";
1278 if (need_comma) os << ",";
1280 os << InstructionOperandAsJSON{instr->TempAt(i), i_json.code_};
1282 os << "]";
1283 os << "}";
1285 return os;
1288 std::ostream& operator<<(std::ostream& os, const InstructionBlockAsJSON& b) {
1291 os << "{";
1292 os << "\"id\": " << block->rpo_number() << ",";
1293 os << "\"deferred\": " << (block->IsDeferred() ? "true" : "false");
1294 os << ",";
1295 os << "\"loop_header\": " << block->IsLoopHeader() << ",";
1297 os << "\"loop_end\": " << block->loop_end() << ",";
1299 os << "\"predecessors\": [";
1302 if (need_comma) os << ",";
1304 os << pred.ToInt();
1306 os << "],";
1307 os << "\"successors\": [";
1310 if (need_comma) os << ",";
1312 os << succ.ToInt();
1314 os << "],";
1315 os << "\"phis\": [";
1319 if (needs_comma) os << ",";
1322 os << "{\"output\" : " << json_op << ",";
1323 os << "\"operands\": [";
1326 if (op_needs_comma) os << ",";
1328 os << "\"v" << input << "\"";
1330 os << "]}";
1332 os << "],";
1334 os << "\"instructions\": [";
1339 if (need_comma) os << ",";
1343 os << json_instr;
1345 os << "]";
1346 os << "}";
1348 return os;
1351 std::ostream& operator<<(std::ostream& os, const InstructionSequenceAsJSON& s) {
1354 os << "[";
1358 if (need_comma) os << ",";
1360 os << InstructionBlockAsJSON{
1363 os << "]";
1365 return os;