![]() | |
Developer(s) | Google[1] |
---|---|
Initial release | 2 September 2008; 16 years ago (2008-09-02) |
Stable release | |
Repository | |
Written in | C++[1] |
Platform | IA-32,x86-64,32-bit ARM,AArch64,32-bit MIPS,MIPS64,PowerPC,IBM ESA/390,z/Architecture |
Type | JavaScript andWebAssembly engine |
License | BSD[3] |
Website | v8![]() |
V8 is aJavaScript andWebAssembly engine developed byGoogle for itsChromebrowser.[1][4] V8 isfree and open-source software that is part of theChromium project and also used separately in non-browser contexts, notably theNode.jsruntime system.[1]
Google created V8 for itsChrome browser, and both were first released in 2008.[4] The lead developer of V8 wasLars Bak, and it was named after the powerfulcar engine.[5] For several years, Chrome was faster than other browsers at executingJavaScript.[6][7][8]
The V8assembler is based on theStrongtalk assembler.[9] On 7 December 2010, a new compiling infrastructure named Crankshaft was released, with speed improvements.[10] In version 41 of Chrome in 2015, project TurboFan was added to provide more performance improvements with previously challenging workloads such asasm.js.[11] Much of V8's development is strongly inspired by theJava HotSpot Virtual Machine developed bySun Microsystems, with the newer execution pipelines being very similar to those of HotSpot's.
Support for the newWebAssembly language began in 2015.[12]
In 2016, the Ignition interpreter was added to V8 with the design goal of reducing thememory usage on small memoryAndroid phones in comparison with TurboFan and Crankshaft.[13] Ignition is aregister based machine and shares a similar (albeit not the exact same) design to the templating interpreter utilized by HotSpot.
In 2017, V8 shipped a brand-newcompiler pipeline, consisting of Ignition (theinterpreter) and TurboFan (theoptimizing compiler). Starting with V8 version 5.9, Full-codegen (the early baseline compiler) and Crankshaft are no longer used in V8 for JavaScript execution, since the team believed they were no longer able to keep pace with new JavaScript language features and the optimizations those features required.[14]
In 2021, a new tiered compilation pipeline was introduced with the release of the SparkPlug compiler, which supplements the existing TurboFan compiler within V8, in a direct parallel to the profiling C1 Compiler used by HotSpot.
In 2023, the MaglevSSA-based compiler was added, which is 10 times slower than Sparkplug but 10 times faster than TurboFan, bridging the gap between Sparkplug and TurboFan for less frequently run loops that do not get "hot" enough to be optimised by TurboFan, as is the case for most web applications that spend more time interacting with the browser than in JavaScript execution.[15]
V8 first generates anabstract syntax tree with its own parser.[16] Then, Ignition generatesbytecode from this syntax tree using the internal V8bytecode format.[17] TurboFan compiles this bytecode into machine code. In other words, V8 compilesECMAScript directly to nativemachine code usingjust-in-time compilation before executing it.[18] The compiled code is additionally optimized (and re-optimized) dynamically at runtime, based on heuristics of the code's execution profile. Optimization techniques used includeinlining,elision of expensive runtime properties, andinline caching. Thegarbage collector is agenerationalincremental collector.[19]
V8 can compile tox86,ARM orMIPSinstruction set architectures in both their32-bit and64-bit editions; it has additionally been ported toPowerPC,[20][21] and toIBM ESA/390 andz/Architecture,[22][20] for use in servers.[23]
V8 can be used in a browser or integrated into independent projects. V8 is used in the following software: