Hi Rafael,
%GetOptimizationStatus(fn) returns the optimization status of `fn` as a non-inlined function; a function can conceptually be in multiple optimization states (e.g. you might still have an interpreted version on the stack, an optimized version elsewhere, multiple inlined version into other functions, etc), so this returns the optimization status of the function `fn` if you were to call it now directly (e.g. from unoptimized code or an event handler). There's no builtin for "optimization status of inlined function"; even if there were,any implementation I can think of would say "was inlined" but contain no data on "was eliminated" since, again, there's no real grouping between the nodes created in function inlining that can then be dead code eliminated.
I'll give you a concrete example on why this is an underspecified problem. Consider the code
function foo(a) {
return a.x;
}
function bar(a, b) {
let y;
if(b) {
y = a.x
} else {
y = foo();
}
return y;
}
When bar is optimized, foo is inlined into it. Then the compiler sees `y = a.x` on both sides of the branch, so it decides to hoist the `a.x` load to before the branch. Has foo now been dead code eliminated? Kind of yes, since we were already doing the same operation in bar, but also kind of not because we can still execute as-if foo were not inlined and executed. The inlined `a.x` load from foo fully becomes _part of bar_, and doesn't have anything to do with foo anymore.
Hope that helps,
Leszek