diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/src/compiler/graph-visualizer.cc | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/src/compiler/graph-visualizer.cc')
-rw-r--r-- | chromium/v8/src/compiler/graph-visualizer.cc | 121 |
1 files changed, 118 insertions, 3 deletions
diff --git a/chromium/v8/src/compiler/graph-visualizer.cc b/chromium/v8/src/compiler/graph-visualizer.cc index 86e3da9d27a..4b327ca285e 100644 --- a/chromium/v8/src/compiler/graph-visualizer.cc +++ b/chromium/v8/src/compiler/graph-visualizer.cc @@ -964,6 +964,118 @@ void PrintScheduledGraph(std::ostream& os, const Schedule* schedule) { } // namespace +std::ostream& operator<<(std::ostream& os, + const LiveRangeAsJSON& live_range_json) { + const LiveRange& range = live_range_json.range_; + os << "{\"id\":" << range.relative_id() << ",\"type\":"; + if (range.HasRegisterAssigned()) { + const InstructionOperand op = range.GetAssignedOperand(); + os << "\"assigned\",\"op\":" + << InstructionOperandAsJSON{&op, &(live_range_json.code_)}; + } else if (range.spilled() && !range.TopLevel()->HasNoSpillType()) { + const TopLevelLiveRange* top = range.TopLevel(); + if (top->HasSpillOperand()) { + os << "\"assigned\",\"op\":" + << InstructionOperandAsJSON{top->GetSpillOperand(), + &(live_range_json.code_)}; + } else { + int index = top->GetSpillRange()->assigned_slot(); + os << "\"spilled\",\"op\":"; + if (IsFloatingPoint(top->representation())) { + os << "\"fp_stack:" << index << "\""; + } else { + os << "\"stack:" << index << "\""; + } + } + } else { + os << "\"none\""; + } + + os << ",\"intervals\":["; + bool first = true; + for (const UseInterval* interval = range.first_interval(); + interval != nullptr; interval = interval->next()) { + if (first) { + first = false; + } else { + os << ","; + } + os << "[" << interval->start().value() << "," << interval->end().value() + << "]"; + } + + os << "],\"uses\":["; + first = true; + for (UsePosition* current_pos = range.first_pos(); current_pos != nullptr; + current_pos = current_pos->next()) { + if (first) { + first = false; + } else { + os << ","; + } + os << current_pos->pos().value(); + } + + os << "]}"; + return os; +} + +std::ostream& operator<<( + std::ostream& os, + const TopLevelLiveRangeAsJSON& top_level_live_range_json) { + int vreg = top_level_live_range_json.range_.vreg(); + bool first = true; + os << "\"" << (vreg > 0 ? vreg : -vreg) << "\":{ \"child_ranges\":["; + for (const LiveRange* child = &(top_level_live_range_json.range_); + child != nullptr; child = child->next()) { + if (!top_level_live_range_json.range_.IsEmpty()) { + if (first) { + first = false; + } else { + os << ","; + } + os << LiveRangeAsJSON{*child, top_level_live_range_json.code_}; + } + } + os << "]"; + if (top_level_live_range_json.range_.IsFixed()) { + os << ", \"is_deferred\": " + << (top_level_live_range_json.range_.IsDeferredFixed() ? "true" + : "false"); + } + os << "}"; + return os; +} + +void PrintTopLevelLiveRanges(std::ostream& os, + const ZoneVector<TopLevelLiveRange*> ranges, + const InstructionSequence& code) { + bool first = true; + os << "{"; + for (const TopLevelLiveRange* range : ranges) { + if (range != nullptr && !range->IsEmpty()) { + if (first) { + first = false; + } else { + os << ","; + } + os << TopLevelLiveRangeAsJSON{*range, code}; + } + } + os << "}"; +} + +std::ostream& operator<<(std::ostream& os, + const RegisterAllocationDataAsJSON& ac) { + os << "\"fixed_double_live_ranges\": "; + PrintTopLevelLiveRanges(os, ac.data_.fixed_double_live_ranges(), ac.code_); + os << ",\"fixed_live_ranges\": "; + PrintTopLevelLiveRanges(os, ac.data_.fixed_live_ranges(), ac.code_); + os << ",\"live_ranges\": "; + PrintTopLevelLiveRanges(os, ac.data_.live_ranges(), ac.code_); + return os; +} + std::ostream& operator<<(std::ostream& os, const AsScheduledGraph& scheduled) { PrintScheduledGraph(os, scheduled.schedule); return os; @@ -1121,8 +1233,11 @@ std::ostream& operator<<(std::ostream& os, const InstructionAsJSON& i_json) { bool first = true; for (MoveOperands* move : *pm) { if (move->IsEliminated()) continue; - if (!first) os << ","; - first = false; + if (first) { + first = false; + } else { + os << ","; + } os << "[" << InstructionOperandAsJSON{&move->destination(), i_json.code_} << "," << InstructionOperandAsJSON{&move->source(), i_json.code_} << "]"; @@ -1228,7 +1343,7 @@ std::ostream& operator<<(std::ostream& os, const InstructionBlockAsJSON& b) { std::ostream& operator<<(std::ostream& os, const InstructionSequenceAsJSON& s) { const InstructionSequence* code = s.sequence_; - os << "\"blocks\": ["; + os << "["; bool need_comma = false; for (int i = 0; i < code->InstructionBlockCount(); i++) { |