just in time compilation, mix of both interpretation and compilation
start with interpretation and compile on the go
optimisations
- Inlining
- Copy Elision
- Inline caching
Just in time compilation
V8
Interpreter - Ignition Compiler - TurboFan
Ignition
- How
- reducing memory usage,
- reducing startup time, and
- reducing complexity.
TurboFan
Further reading
- https://www.infoq.com/news/2021/06/v8-sparkplug-compiler/#:~:text=The%20old%20V8%20architecture%20included,generate%20machine%20code%20from%20that.
- https://www.digitalocean.com/community/tutorials/js-v8-engine
- https://blog.logrocket.com/how-javascript-works-optimizing-the-v8-compiler-for-efficiency/
Source Code -> Byte Code -> Machine Code
Questions
- Can we say that REPL is interpreter? or vice versa?