Then Crankshaft can walk the AST generating optimised code for these particular functions.
Let's supose this function is hot, filePath is a string, so Crankshaft will optimize it to work with a string.
When the HIR is being generated, Hydrogen applies several optimisations to the code such as constant folding, method inlining and other stuff we'll see at the end of this guide - there's a whole section to it.
The result Hydrogen outputs is an optimised CFG which the next compiler, Lithium, takes as input to generate actual optimised code.
As we said, the Lithium compiler takes the HIR and translates into a machine-specific low-level intermediate representation (LIR).
In the end, this LIR is read and Crankshaft generates a sequence of native instructions for every Lithium instruction, the OSR is applied and then the code is executed.