From c68220b4e191d6ff59d8c75cea07d329ef3e3739 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Thu, 26 Nov 2020 18:02:36 +0100 Subject: [PATCH] [tools] Fix system-analyzer source line numbers Properly indent wrapper source lines so the source line numbers are easily visible. Change-Id: I25095ca3e15a8e953c6e826eb8594289a10aa41b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2551105 Commit-Queue: Camillo Bruni Reviewed-by: Shu-yu Guo Cr-Commit-Position: refs/heads/master@{#71439} --- tools/profile.mjs | 4 ++++ tools/system-analyzer/view/helper.mjs | 12 +++++++++- .../view/source-panel-template.html | 22 ++++++++++--------- tools/system-analyzer/view/source-panel.mjs | 7 +++--- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/tools/profile.mjs b/tools/profile.mjs index b2e953f247..33ff22a5b0 100644 --- a/tools/profile.mjs +++ b/tools/profile.mjs @@ -51,6 +51,10 @@ export class Script { this.lineToColumn = new Map(); } + get length() { + return this.source.length; + } + addSourcePosition(line, column, entry) { let sourcePosition = this.lineToColumn.get(line)?.get(column); if (sourcePosition === undefined) { diff --git a/tools/system-analyzer/view/helper.mjs b/tools/system-analyzer/view/helper.mjs index 652c78b896..726366a5b4 100644 --- a/tools/system-analyzer/view/helper.mjs +++ b/tools/system-analyzer/view/helper.mjs @@ -100,7 +100,17 @@ class DOM { } return node; } - + static span(classes) { + const node = document.createElement('span'); + if (classes !== undefined) { + if (typeof classes === 'string') { + node.className = classes; + } else { + classes.forEach(cls => node.classList.add(cls)); + } + } + return node; + } static table(className) { const node = document.createElement('table'); if (className) node.className = className; diff --git a/tools/system-analyzer/view/source-panel-template.html b/tools/system-analyzer/view/source-panel-template.html index 01b777042f..e87f53599f 100644 --- a/tools/system-analyzer/view/source-panel-template.html +++ b/tools/system-analyzer/view/source-panel-template.html @@ -6,24 +6,26 @@ found in the LICENSE file. -->