flaska/benchmark/compiler/utils.mjs

39 lines
2.5 KiB
JavaScript
Raw Normal View History

2024-10-22 10:44:53 +00:00
export function printTree(children, indent = 0) {
if (!children.length) return
for (let child of children) {
console.log(child.char.padStart(1 + indent * 2))
printTree(child.children, indent + 1)
}
}
2024-10-23 01:07:35 +00:00
2024-10-27 05:12:19 +00:00
export function printIfNotEightyOne(fn) {
let opt = %GetOptimizationStatus(fn)
if (opt === 81) return
printCurrentStatus()
}
2024-10-23 01:07:35 +00:00
export function printCurrentStatus(fn) {
let opt = %GetOptimizationStatus(fn)
2024-10-27 05:12:19 +00:00
console.log(`${opt.toString(2).padStart(17, '0').split('').join(' ')} (${opt})`)
2024-10-23 01:07:35 +00:00
}
export function printStatusHelperText() {
console.log(`┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬
is function
is never optimized
is always optimized
is maybe deoptimized
is optimized
is optimized by TurboFan
is interpreted
is marked for optimization
is marked for concurrent optimization
is optimizing concurrently
is executing
topmost frame is turbo fanned
lite mode
marked for deoptimization
baseline
topmost frame is interpreted
topmost frame is baseline`)
}