diff options
Diffstat (limited to 'src/cmd/compile/internal/ssa/html.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/html.go | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/src/cmd/compile/internal/ssa/html.go b/src/cmd/compile/internal/ssa/html.go index ba37a80412..c781ca92cc 100644 --- a/src/cmd/compile/internal/ssa/html.go +++ b/src/cmd/compile/internal/ssa/html.go @@ -119,7 +119,8 @@ td.collapsed { } td.collapsed div { - /* TODO: Flip the direction of the phase's title 90 degrees on a collapsed column. */ + text-align: right; + transform: rotate(180deg); writing-mode: vertical-lr; white-space: pre; } @@ -357,6 +358,21 @@ body.darkmode ellipse.outline-black { outline: gray solid 2px; } </style> <script type="text/javascript"> + +// Contains phase names which are expanded by default. Other columns are collapsed. +let expandedDefault = [ + "start", + "deadcode", + "opt", + "lower", + "late-deadcode", + "regalloc", + "genssa", +]; +if (history.state === null) { + history.pushState({expandedDefault}, "", location.href); +} + // ordered list of all available highlight colors var highlights = [ "highlight-aquamarine", @@ -401,6 +417,9 @@ for (var i = 0; i < outlines.length; i++) { } window.onload = function() { + if (history.state !== null) { + expandedDefault = history.state.expandedDefault; + } if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) { toggleDarkMode(); document.getElementById("dark-mode-button").checked = true; @@ -409,9 +428,6 @@ window.onload = function() { var ssaElemClicked = function(elem, event, selections, selected) { event.stopPropagation(); - // TODO: pushState with updated state and read it on page load, - // so that state can survive across reloads - // find all values with the same name var c = elem.classList.item(0); var x = document.getElementsByClassName(c); @@ -489,21 +505,18 @@ window.onload = function() { lines[i].addEventListener('click', ssaValueClicked); } - // Contains phase names which are expanded by default. Other columns are collapsed. - var expandedDefault = [ - "start", - "deadcode", - "opt", - "lower", - "late-deadcode", - "regalloc", - "genssa", - ]; function toggler(phase) { return function() { toggle_cell(phase+'-col'); toggle_cell(phase+'-exp'); + const i = expandedDefault.indexOf(phase); + if (i !== -1) { + expandedDefault.splice(i, 1); + } else { + expandedDefault.push(phase); + } + history.pushState({expandedDefault}, "", location.href); }; } @@ -531,9 +544,13 @@ window.onload = function() { const len = combined.length; if (len > 1) { for (let i = 0; i < len; i++) { - if (expandedDefault.indexOf(combined[i]) !== -1) { - show = true; - break; + const num = expandedDefault.indexOf(combined[i]); + if (num !== -1) { + expandedDefault.splice(num, 1); + if (expandedDefault.indexOf(phase) === -1) { + expandedDefault.push(phase); + show = true; + } } } } |