Commit 19b70568 authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[tools] Fix system-analyzer Script selection

Selecting a single script from related events was not implemented.

Change-Id: Id6dbe7f8eb235c5917e48a9ade7347404c114618
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2859943Reviewed-by: 's avatarSathya Gunasekaran  <gsathya@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74281}
parent 4ff37d3a
......@@ -110,7 +110,7 @@ class App {
entries = entry.entries.concat(entry.sourcePositions);
break;
default:
throw new Error('Unknown selection type!');
throw new Error(`Unknown selection type: ${entry.constructor?.name}`);
}
if (entry.sourcePosition) {
entries.push(entry.sourcePosition);
......@@ -134,7 +134,11 @@ class App {
}
selectEntriesOfSingleType(entries, type) {
switch (entries[0]?.constructor ?? type) {
const entryType = entries[0]?.constructor ?? type;
switch (entryType) {
case Script:
entries = entries.flatMap(script => script.sourcePositions);
return this.showSourcePositions(entries);
case SourcePosition:
return this.showSourcePositions(entries);
case MapLogEntry:
......@@ -148,7 +152,7 @@ class App {
case DeoptLogEntry:
return this.showDeoptEntries(entries);
default:
throw new Error('Unknown selection type!');
throw new Error(`Unknown selection type: ${entryType?.name}`);
}
}
......@@ -205,6 +209,8 @@ class App {
focusLogEntry(entry) {
switch (entry.constructor) {
case Script:
return this.focusSourcePosition(entry.sourcePositions[0]);
case SourcePosition:
return this.focusSourcePosition(entry);
case MapLogEntry:
......@@ -218,7 +224,7 @@ class App {
case DeoptLogEntry:
return this.focusDeoptLogEntry(entry);
default:
throw new Error('Unknown selection type!');
throw new Error(`Unknown selection type: ${entry.constructor?.name}`);
}
}
......
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