To be frank this is JS engine internals, and javascript specification doesn't dictate if functions are also compiled when loading file.
But answering generically, JS engines does not compile the function internals until the function is called, as it is important for JS engines that initial compile / load time is minimal.
In the first pass / compile, all engine is interesting is to find variables, and functions, since, functions create a closure, it is not interested in the things inside function until the function is called.
So to answer your question, engine will normally only compile functions in the current scope, which can be global scope or another function scope, and it does not compile nested functions