Commit 7c0c5286 authored by George Wort's avatar George Wort Committed by Commit Bot

[turbolizer] Display live range uses

Display UsePositions in the intervals
in live ranges in turbolizer.

Uses are shown as vertical red lines.

Bug: v8:7327
Change-Id: Iab8d08989b9113d1b7d393252de5988e8b25b8de
Notry: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2224215
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68102}
parent c342ba82
......@@ -995,12 +995,27 @@ std::ostream& operator<<(std::ostream& os,
bool first = true;
for (const UseInterval* interval = range.first_interval();
interval != nullptr; interval = interval->next()) {
if (!first) os << ",";
first = false;
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;
}
......@@ -1014,8 +1029,11 @@ std::ostream& operator<<(
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) os << ",";
first = false;
if (first) {
first = false;
} else {
os << ",";
}
os << LiveRangeAsJSON{*child, top_level_live_range_json.code_};
}
}
......@@ -1036,8 +1054,11 @@ void PrintTopLevelLiveRanges(std::ostream& os,
os << "{";
for (const TopLevelLiveRange* range : ranges) {
if (range != nullptr && !range->IsEmpty()) {
if (!first) os << ",";
first = false;
if (first) {
first = false;
} else {
os << ",";
}
os << TopLevelLiveRangeAsJSON{*range, code};
}
}
......@@ -1212,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_}
<< "]";
......
......@@ -315,6 +315,7 @@ class RowConstructor {
}
}
grid.setRow(row, positionArray);
ranges.forEachRange((range: Range) => this.setUses(grid, row, range));
}
// This is the main function used to build new intervals.
......@@ -417,6 +418,16 @@ class RowConstructor {
spanEl.style.paddingLeft = paddingLeft;
spanEl.innerHTML = str;
}
private setUses(grid: Grid, row: number, range: Range) {
for (const liveRange of range.child_ranges) {
if (liveRange.uses) {
for (const use of liveRange.uses) {
grid.getCell(row, use).classList.toggle("range-use", true);
}
}
}
}
}
class RangeViewConstructor {
......
......@@ -115,6 +115,7 @@ export interface ChildRange {
type: string;
op: any;
intervals: Array<[number, number]>;
uses: Array<number>;
}
export interface Range {
......
......@@ -187,6 +187,10 @@ input.range-toggle-show {
pointer-events: none
}
.range-position.range-use {
border-left: var(--range-instr-border) solid red;
}
.range-block-border,
.range-block-border.range-position.range-interval-position:last-child {
border-right: var(--range-block-border) solid rgb(109, 107, 107);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment