Commit d3e44984 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by V8 LUCI CQ

[turbolizer] Link the source text and disassembly code

If you now click a line number on the source panel (left panel) you will
get the nodes (middle panel) highlighted and the disassembly code (right
panel). As a bonus, you can click on the middle or right panels and get
the same result (i.e. you can click on a disassembly instruction and see
the highlighted source text and nodes).

Note that not all source text has a node or disassembly instruction
associated with it.

Bug: v8:7327, v8:11192
Notry: true
Change-Id: Ia20aff02407e0d9d118c26a0b5895ee521288565
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3000965Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75574}
parent 5db480e3
......@@ -56,23 +56,50 @@ export class SelectionBroker {
}
return true;
});
// Select the lines from the source panel (left panel)
for (const b of this.sourcePositionHandlers) {
if (b != from) b.brokeredSourcePositionSelect(sourcePositions, selected);
}
// Select the nodes (middle panel)
const nodes = this.sourceResolver.sourcePositionsToNodeIds(sourcePositions);
for (const b of this.nodeHandlers) {
if (b != from) b.brokeredNodeSelect(nodes, selected);
}
// Select the lines from the disassembly (right panel)
for (const node of nodes) {
const instructionOffsets = this.sourceResolver.nodeIdToInstructionRange[node];
// Skip nodes which do not have an associated instruction range.
if (instructionOffsets == undefined) continue;
for (const b of this.instructionHandlers) {
if (b != from) b.brokeredInstructionSelect(instructionOffsets, selected);
}
}
}
broadcastNodeSelect(from, nodes, selected) {
// Select the nodes (middle panel)
for (const b of this.nodeHandlers) {
if (b != from) b.brokeredNodeSelect(nodes, selected);
}
// Select the lines from the source panel (left panel)
const sourcePositions = this.sourceResolver.nodeIdsToSourcePositions(nodes);
for (const b of this.sourcePositionHandlers) {
if (b != from) b.brokeredSourcePositionSelect(sourcePositions, selected);
}
// Select the lines from the disassembly (right panel)
for (const node of nodes) {
const instructionOffsets = this.sourceResolver.nodeIdToInstructionRange[node];
// Skip nodes which do not have an associated instruction range.
if (instructionOffsets == undefined) continue;
for (const b of this.instructionHandlers) {
if (b != from) b.brokeredInstructionSelect(instructionOffsets, selected);
}
}
}
broadcastBlockSelect(from, blocks, selected) {
......
......@@ -276,7 +276,7 @@ export class SourceResolver {
}
sourcePositionsToNodeIds(sourcePositions) {
const nodeIds = new Set();
const nodeIds = new Set<string>();
for (const sp of sourcePositions) {
const key = sourcePositionToStringKey(sp);
const nodeIdsForPosition = this.positionToNodes.get(key);
......@@ -526,7 +526,8 @@ export class SourceResolver {
instructionsToKeyPcOffsets(instructionIds: Iterable<number>): Array<number> {
const keyPcOffsets = [];
for (const instructionId of instructionIds) {
keyPcOffsets.push(this.instructionToPCOffset[instructionId].gap);
const pcOffset = this.instructionToPCOffset[instructionId];
if (pcOffset !== undefined) keyPcOffsets.push(pcOffset.gap);
}
return keyPcOffsets;
}
......
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