flaska/benchmark/compiler/utils.mjs

39 lines
2.5 KiB
JavaScript
Raw Normal View History

2024-11-02 12:44:54 +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)
}
}
export function printIfNotEightyOne(fn) {
let opt = %GetOptimizationStatus(fn)
if (opt === 81) return
printCurrentStatus()
}
export function printCurrentStatus(fn) {
let opt = %GetOptimizationStatus(fn)
console.log(`${opt.toString(2).padStart(17, '0').split('').join(' ')} (${opt})`)
}
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`)
}