V8 Engine & Threads
The First Execution
After the first execution the profiler thread comes into play again. When the code has received some run time, the profiler thread gathers all the data and also monitors and optimizes the code.
Moving on, the Crankshaft optimization takes over in a separate thread. The JS abstract syntax tree is translated into a static single-assignment (SSA) called Hydrogen. Furthermore, optimization for Hydrogen graphs is carried out.
In a Nutshell