Jump to content

V8 (JavaScript engine): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m script-assisted date audit and style fixes per MOS:NUM. Replace hyphens with dashes per MOS:DASH. Rm sentence-fragment periods per MOS:BULLET.
m Group blogs aren't reliable sources per WP:SPS.
Line 9: Line 9:
| caption =
| caption =
| developer = [[Google]]<ref name="v8 doc">{{cite web |title=Documentation · V8 |url=https://v8.dev/docs |publisher=Google |access-date=3 March 2024}}</ref>
| developer = [[Google]]<ref name="v8 doc">{{cite web |title=Documentation · V8 |url=https://v8.dev/docs |publisher=Google |access-date=3 March 2024}}</ref>
| released = {{start date and age|2008|9|2|df=y}}
| released = {{Start date and age|2008|9|2|df=y}}
| latest release version = {{wikidata|property|edit|reference|P548=Q2804309|P348}}
| latest release version = {{Wikidata|property|edit|reference|P548=Q2804309|P348}}
| latest release date = {{start date and age|{{wikidata|qualifier|single|P548=Q2804309|P348|P577}}}}
| latest release date = {{Start date and age|{{wikidata|qualifier|single|P548=Q2804309|P348|P577}}}}
| programming language = [[C++]]<ref name="v8 doc" />
| programming language = [[C++]]<ref name="v8 doc" />
| platform = [[IA-32]], [[x86-64]], [[ARM architecture|32-bit ARM]], [[AArch64]], [[MIPS architecture|32-bit MIPS]], [[MIPS64]], [[PowerPC]], [[IBM ESA/390]], [[z/Architecture]]
| platform = [[IA-32]], [[x86-64]], [[ARM architecture|32-bit ARM]], [[AArch64]], [[MIPS architecture|32-bit MIPS]], [[MIPS64]], [[PowerPC]], [[IBM ESA/390]], [[z/Architecture]]
Line 18: Line 18:
}}
}}


'''V8''' is a [[JavaScript engine|JavaScript]] and [[WebAssembly]] engine developed by [[Google]] for its [[Google Chrome|Chrome browser]].<ref name="v8 doc"/><ref name="comic">{{cite web |last=Lenssen |first=Philipp |date=1 September 2008 |title=Google on Google Chrome - comic book |url=http://blogoscoped.com/google-chrome/ |access-date=17 August 2010 |work=Google Blogoscoped |language=en-US}}</ref> V8 is [[free and open-source software]] (FOSS) and part of the [[Chromium (web browser)|Chromium]] project. It is also used in non-browser contexts, notably including the [[Node.js]] runtime system.<ref name="v8 doc" /> Other server-side JavaScript runtimes use alternative engines, such as [[Bun (software)|Bun]] (which uses [[JavaScriptCore]]) and Hermes (used by [[React Native]]).
'''V8''' is a [[JavaScript engine|JavaScript]] and [[WebAssembly]] engine developed by [[Google]] for its [[Google Chrome|Chrome browser]].<ref name="v8 doc" /> V8 is [[free and open-source software]] (FOSS) and part of the [[Chromium (web browser)|Chromium]] project. It is also used in non-browser contexts, notably including the [[Node.js]] runtime system.<ref name="v8 doc" /> Other server-side JavaScript runtimes use alternative engines, such as [[Bun (software)|Bun]] (which uses [[JavaScriptCore]]) and Hermes (used by [[React Native]]).


==History==
==History==
Google created V8 for its Chrome browser, so V8's first release coincided with Chrome's first release in 2008.<ref name="comic"/> It was named after the [[V8 engine]], and its lead developer was [[Lars Bak (computer programmer)|Lars Bak]].<ref>{{cite web |title=V8: an open source JavaScript engine |url=https://www.youtube.com/watch?v=hWhMKalEicY |website=YouTube | date=15 September 2008 |publisher=Google |access-date=15 March 2024}}</ref> For several years, Chrome was faster than other browsers at executing JavaScript.<ref>{{cite web|url=https://www.pcgameshardware.com/aid,687738/Big-browser-comparison-test-Internet-Explorer-vs-Firefox-Opera-Safari-and-Chrome-Update-Firefox-35-Final/Practice/|title=Big browser comparison test: Internet Explorer vs. Firefox, Opera, Safari and Chrome|work=PC Games Hardware|date=3 July 2009|publisher=Computec Media AG|access-date=28 June 2010|archive-date=2 May 2012|archive-url=https://web.archive.org/web/20120502043027/http://www.pcgameshardware.com/aid,687738/Big-browser-comparison-test-Internet-Explorer-vs-Firefox-Opera-Safari-and-Chrome-Update-Firefox-35-Final/Practice/|url-status=dead}}</ref><ref>{{cite web | url=https://lifehacker.com/lifehacker-speed-tests-safari-4-chrome-2-and-more-5286869 | title=Lifehacker Speed Tests: Safari 4, Chrome 2 | first=Kevin | last=Purdy | work=[[Lifehacker]] | date=11 June 2009 | access-date=8 May 2021 | archive-date=14 April 2021 | archive-url=https://web.archive.org/web/20210414095403/https://lifehacker.com/lifehacker-speed-tests-safari-4-chrome-2-and-more-5286869 | url-status=live }}</ref><ref>{{cite magazine |title=Mozilla asks, 'Are we fast yet?' |url=https://www.wired.com/2010/09/mozilla-asks-are-we-fast-yet/ |magazine=Wired |access-date=18 January 2019 |archive-date=22 June 2018 |archive-url=https://web.archive.org/web/20180622213244/https://www.wired.com/2010/09/mozilla-asks-are-we-fast-yet/ |url-status=live }}</ref>
Google created V8 for its Chrome browser, so V8's first release coincided with Chrome's first release in 2008.{{Citation needed|date=October 2026}} It was named after the [[V8 engine]], and its lead developer was [[Lars Bak (computer programmer)|Lars Bak]].<ref>{{cite web |title=V8: an open source JavaScript engine |url=https://www.youtube.com/watch?v=hWhMKalEicY |website=YouTube | date=15 September 2008 |publisher=Google |access-date=15 March 2024 }}</ref> For several years, Chrome was faster than other browsers at executing JavaScript.<ref>{{cite web|url=https://www.pcgameshardware.com/aid,687738/Big-browser-comparison-test-Internet-Explorer-vs-Firefox-Opera-Safari-and-Chrome-Update-Firefox-35-Final/Practice/|title=Big browser comparison test: Internet Explorer vs. Firefox, Opera, Safari and Chrome|work=PC Games Hardware|date=3 July 2009|publisher=Computec Media AG|access-date=28 June 2010|archive-date=2 May 2012|archive-url=https://web.archive.org/web/20120502043027/http://www.pcgameshardware.com/aid,687738/Big-browser-comparison-test-Internet-Explorer-vs-Firefox-Opera-Safari-and-Chrome-Update-Firefox-35-Final/Practice/|url-status=dead}}</ref><ref>{{cite web | url=https://lifehacker.com/lifehacker-speed-tests-safari-4-chrome-2-and-more-5286869 | title=Lifehacker Speed Tests: Safari 4, Chrome 2 | first=Kevin | last=Purdy | work=[[Lifehacker]] | date=11 June 2009 | access-date=8 May 2021 | archive-date=14 April 2021 | archive-url=https://web.archive.org/web/20210414095403/https://lifehacker.com/lifehacker-speed-tests-safari-4-chrome-2-and-more-5286869 | url-status=live }}</ref><ref>{{cite magazine |title=Mozilla asks, 'Are we fast yet?' |url=https://www.wired.com/2010/09/mozilla-asks-are-we-fast-yet/ |magazine=Wired |access-date=18 January 2019 |archive-date=22 June 2018 |archive-url=https://web.archive.org/web/20180622213244/https://www.wired.com/2010/09/mozilla-asks-are-we-fast-yet/ |url-status=live }}</ref>


The V8 [[assembly language#Assembler|assembler]] is based on the [[Strongtalk]] assembler.<ref>{{cite web|url=https://code.google.com/p/v8/source/browse/trunk/LICENSE |title=V8 JavaScript Engine: License |work=[[Google Code]] |access-date=17 August 2010 |url-status=dead |archive-url=https://web.archive.org/web/20100722105022/http://code.google.com/p/v8/source/browse/trunk/LICENSE |archive-date=22 July 2010 }}</ref> On 7 December 2010, a new compiling infrastructure named Crankshaft was released, with speed improvements.<ref>{{cite web |url=https://blog.chromium.org/2010/12/new-crankshaft-for-v8.html |title=A New Crankshaft for V8 |date=7 December 2010 |work=Chromium Blog |access-date=22 April 2011}}</ref> In version 41 of Chrome in 2015, project TurboFan was added to provide more performance improvements with previously challenging workloads such as [[asm.js]].<ref>{{cite web |url=https://blog.chromium.org/2015/07/revving-up-javascript-performance-with.html |title=Revving up JavaScript performance with TurboFan |date=7 July 2015 |access-date=5 March 2016}}</ref> Much of V8's development is strongly inspired by the [[HotSpot (virtual machine)|Java HotSpot Virtual Machine]] developed by [[Sun Microsystems]], with the newer execution pipelines being very similar to those of HotSpot's.
The V8 [[Assembly language#Assembler|assembler]] is based on the [[Strongtalk]] assembler.<ref>{{cite web|url=https://code.google.com/p/v8/source/browse/trunk/LICENSE |title=V8 JavaScript Engine: License |work=[[Google Code]] |access-date=17 August 2010 |url-status=dead |archive-url=https://web.archive.org/web/20100722105022/http://code.google.com/p/v8/source/browse/trunk/LICENSE |archive-date=22 July 2010 }}</ref> On 7 December 2010, a new compiling infrastructure named Crankshaft was released, with speed improvements.<ref>{{cite web |url=https://blog.chromium.org/2010/12/new-crankshaft-for-v8.html |title=A New Crankshaft for V8 |date=7 December 2010 |work=Chromium Blog |access-date=22 April 2011}}</ref> In version 41 of Chrome in 2015, project TurboFan was added to provide more performance improvements with previously challenging workloads such as [[asm.js]].<ref>{{cite web |url=https://blog.chromium.org/2015/07/revving-up-javascript-performance-with.html |title=Revving up JavaScript performance with TurboFan |date=7 July 2015 |access-date=5 March 2016}}</ref> Much of V8's development is strongly inspired by the [[HotSpot (virtual machine)|Java HotSpot Virtual Machine]] developed by [[Sun Microsystems]], with the newer execution pipelines being very similar to those of HotSpot's.


Support for the WebAssembly language began in 2015.<ref>{{cite web |title=Experimental support for WebAssembly in V8 |url=https://v8.dev/blog/webassembly-experimental |website=v8.dev |access-date=12 March 2024}}</ref>
Support for the WebAssembly language began in 2015.<ref>{{cite web |title=Experimental support for WebAssembly in V8 |url=https://v8.dev/blog/webassembly-experimental |website=v8.dev |access-date=12 March 2024 }}</ref>


In 2016, the Ignition interpreter was added to V8 with the design goal of reducing the [[Memory cell (computing)|memory]] usage on small memory [[Android (operating system)|Android]] phones in comparison with TurboFan and Crankshaft.<ref>{{cite web |url=https://www.youtube.com/watch?v=r5OWCtuKiAk |archive-url=https://ghostarchive.org/varchive/youtube/20211221/r5OWCtuKiAk |archive-date=21 December 2021 |url-status=live|title=BlinkOn 6 Day 1 Talk 2: Ignition - an interpreter for V8 |website=[[YouTube]] |date=26 June 2016 |access-date=2 September 2016}}{{cbignore}}</ref> Ignition is a [[Register machine|register based machine]] and shares a similar (albeit not the exact same) design to the templating interpreter utilized by HotSpot.
In 2016, the Ignition interpreter was added to V8 with the design goal of reducing the [[Memory cell (computing)|memory]] usage on small memory [[Android (operating system)|Android]] phones in comparison with TurboFan and Crankshaft.<ref>{{cite web |url=https://www.youtube.com/watch?v=r5OWCtuKiAk |archive-url=https://ghostarchive.org/varchive/youtube/20211221/r5OWCtuKiAk |archive-date=21 December 2021 |url-status=live|title=BlinkOn 6 Day 1 Talk 2: Ignition - an interpreter for V8 |website=[[YouTube]] |date=26 June 2016 |access-date=2 September 2016}}{{cbignore}}</ref> Ignition is a [[Register machine|register 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-new [[compiler]] pipeline, consisting of Ignition (the [[Abstract syntax tree interpreter|interpreter]]) and TurboFan (the [[Program optimization|optimizing 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.<ref>{{cite web |url=https://v8project.blogspot.com/2017/05/launching-ignition-and-turbofan.html |title=Launching Ignition and TurboFan |date=16 May 2017 |access-date=13 July 2017}}</ref>
In 2017, V8 shipped a brand-new [[compiler]] pipeline, consisting of Ignition (the [[Abstract syntax tree interpreter|interpreter]]) and TurboFan (the [[Program optimization|optimizing 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.<ref>{{cite web |url=https://v8project.blogspot.com/2017/05/launching-ignition-and-turbofan.html |title=Launching Ignition and TurboFan |date=16 May 2017 |access-date=13 July 2017 }}</ref>


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 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 Maglev [[Static single-assignment form|SSA]]-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.<ref>{{cite web |url=https://v8.dev/blog/maglev |title=Maglev - V8's Fastest Optimizing JIT |date=5 December 2023|access-date=26 January 2024}}</ref>
In 2023, the Maglev [[Static single-assignment form|SSA]]-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.<ref>{{cite web |url=https://v8.dev/blog/maglev |title=Maglev - V8's Fastest Optimizing JIT |date=5 December 2023 |access-date=26 January 2024 }}</ref>


==Design==
==Design==
V8 first generates an [[abstract syntax tree]] with its own parser.<ref>{{Cite web|last=Verwaest|first=Toon|date=25 March 2019|title=Blazingly fast parsing, part 1: optimizing the scanner · V8|url=https://v8.dev/blog/scanner|url-status=live|archive-url=https://web.archive.org/web/20210421221018/https://v8.dev/blog/scanner|archive-date=21 April 2021|access-date=1 June 2021|website=v8.dev}}</ref> Then, Ignition generates [[bytecode]] from this syntax tree using the internal V8 [[bytecode]] format.<ref>{{Cite web|url=https://medium.com/dailyjs/understanding-v8s-bytecode-317d46c94775|title=Understanding V8's Bytecode|last=Hinkelmann|first=Franziska|date=19 December 2017|website=Medium|language=en|access-date=17 October 2019}}</ref> TurboFan compiles this bytecode into machine code. In other words, V8 compiles [[ECMAScript]] to native [[machine code]] using [[just-in-time compilation]] before executing it.<ref>{{Cite web|title=Firing up the Ignition interpreter · V8|url=https://v8.dev/blog/ignition-interpreter|access-date=30 September 2020|website=v8.dev}}</ref> The compiled code is additionally optimized (and re-optimized) dynamically at runtime, based on heuristics of the code's execution profile. Optimization techniques used include [[inlining]], [[Copy elision|elision]] of expensive runtime properties, and [[inline caching]]. The [[garbage collection (computer science)|garbage collector]] is a [[tracing garbage collection#Generational GC (ephemeral GC)|generational]] [[tracing garbage collection#Stop-the-world vs. incremental vs. concurrent|incremental]] collector.<ref>{{cite web |url=https://blog.chromium.org/2011/11/game-changer-for-interactive.html |title=A game changer for interactive performance |website=blog.chromium.org |date=21 November 2011|access-date=6 February 2022}}</ref>
V8 first generates an [[abstract syntax tree]] with its own parser.<ref>{{Cite web|last=Verwaest|first=Toon|date=25 March 2019|title=Blazingly fast parsing, part 1: optimizing the scanner · V8|url=https://v8.dev/blog/scanner|url-status=live|archive-url=https://web.archive.org/web/20210421221018/https://v8.dev/blog/scanner|archive-date=21 April 2021|access-date=1 June 2021|website=v8.dev}}</ref> Then, Ignition generates [[bytecode]] from this syntax tree using the internal V8 [[bytecode]] format.<ref>{{Cite web |url=https://medium.com/dailyjs/understanding-v8s-bytecode-317d46c94775 |title=Understanding V8's Bytecode |last=Hinkelmann |first=Franziska |date=19 December 2017 |website=Medium |access-date=17 October 2019 }}</ref> TurboFan compiles this bytecode into machine code. In other words, V8 compiles [[ECMAScript]] to native [[machine code]] using [[just-in-time compilation]] before executing it.<ref>{{Cite web|title=Firing up the Ignition interpreter · V8|url=https://v8.dev/blog/ignition-interpreter|access-date=30 September 2020|website=v8.dev}}</ref> The compiled code is additionally optimized (and re-optimized) dynamically at runtime, based on heuristics of the code's execution profile. Optimization techniques used include [[inlining]], [[Copy elision|elision]] of expensive runtime properties, and [[inline caching]]. The [[garbage collection (computer science)|garbage collector]] is a [[tracing garbage collection#Generational GC (ephemeral GC)|generational]] [[tracing garbage collection#Stop-the-world vs. incremental vs. concurrent|incremental]] collector.<ref>{{cite web |url=https://blog.chromium.org/2011/11/game-changer-for-interactive.html |title=A game changer for interactive performance |website=blog.chromium.org |date=21 November 2011|access-date=6 February 2022 }}</ref>


==Usage==
==Usage==
Line 43: Line 43:
V8 can be used in a browser or integrated into independent projects. V8 is used in the following software:
V8 can be used in a browser or integrated into independent projects. V8 is used in the following software:
* [[Chromium (web browser)|Chromium]]-based [[web browser]]s – [[Google Chrome]], [[Brave (web browser)|Brave]], [[Opera (web browser)|Opera]], [[Vivaldi (web browser)|Vivaldi]] and [[Microsoft Edge]]
* [[Chromium (web browser)|Chromium]]-based [[web browser]]s – [[Google Chrome]], [[Brave (web browser)|Brave]], [[Opera (web browser)|Opera]], [[Vivaldi (web browser)|Vivaldi]] and [[Microsoft Edge]]
* Cloud-based environments, like [[Google Apps Script]]<ref>{{Cite web |title=V8 Runtime Overview {{!}} Apps Script |url=https://developers.google.com/apps-script/guides/v8-runtime |access-date=26 January 2025 |website=Google for Developers |language=en}}</ref>
* Cloud-based environments, like [[Google Apps Script]]<ref>{{Cite web |title=V8 Runtime Overview {{!}} Apps Script |url=https://developers.google.com/apps-script/guides/v8-runtime |website=Google for Developers |access-date=26 January 2025 }}</ref>
* [[Couchbase Server|Couchbase]] database server
* [[Couchbase Server|Couchbase]] database server
* [[Deno (software)|Deno]] runtime environment<ref>{{Cite web|url=https://github.com/denoland/deno|title=A secure JavaScript/TypeScript runtime built with V8, Rust, and Tokio: denoland/deno|date=8 July 2019|via=GitHub}}</ref>
* [[Deno (software)|Deno]] runtime environment<ref>{{Cite web|url=https://github.com/denoland/deno|title=A secure JavaScript/TypeScript runtime built with V8, Rust, and Tokio: denoland/deno|date=8 July 2019|via=GitHub}}</ref>
* [[Electron (software framework)|Electron]] desktop application framework, used by apps such as the [[Visual Studio Code]] text editor and [[Discord]]
* [[Electron (software framework)|Electron]] desktop application framework, used by apps such as the [[Visual Studio Code]] text editor and [[Discord]]
* [[MarkLogic Server|MarkLogic]] database server
* [[MarkLogic Server|MarkLogic]] database server
* [[NativeScript]] mobile application framework<ref>{{Cite web|url=https://docs.nativescript.org/core-concepts/android-runtime/overview|title=Overview - NativeScript Docs|website=docs.nativescript.org|access-date=8 July 2019|archive-date=28 July 2020|archive-url=https://web.archive.org/web/20200728141911/https://docs.nativescript.org/core-concepts/android-runtime/overview|url-status=dead}}</ref>
* [[NativeScript]] mobile application framework<ref>{{Cite web |url=https://docs.nativescript.org/core-concepts/android-runtime/overview |title=Overview - NativeScript Docs |website=docs.nativescript.org |access-date=8 July 2019 |archive-date=28 July 2020 |archive-url=https://web.archive.org/web/20200728141911/https://docs.nativescript.org/core-concepts/android-runtime/overview |url-status=dead }}</ref>
* [[Node.js]] runtime environment<ref>{{cite web|url=http://mashable.com/2011/03/10/node-js/|title=Why Everyone Is Talking About Node|author=Jolie O'Dell|date=10 March 2011|publisher=Mashable}}</ref>
* [[Node.js]] runtime environment<ref>{{cite web |url=http://mashable.com/2011/03/10/node-js/ |title=Why Everyone Is Talking About Node |first=Jolie |last=O'Dell |date=10 March 2011 |publisher=Mashable }}</ref>


==See also==
==See also==

Revision as of 15:27, 7 October 2026

V8
DeveloperGoogle[1]
Release2 September 2008; 18 years ago (2008-09-02)
Stable release
11.4[2] Edit this on Wikidata / 24 May 2023; 3 years ago (24 May 2023)
Written inC++[1]
PlatformIA-32, x86-64, 32-bit ARM, AArch64, 32-bit MIPS, MIPS64, PowerPC, IBM ESA/390, z/Architecture
TypeJavaScript and WebAssembly engine
LicenseBSD-3-Clause[3]
Websitev8.dev Edit this on Wikidata
Repository

V8 is a JavaScript and WebAssembly engine developed by Google for its Chrome browser.[1] V8 is free and open-source software (FOSS) and part of the Chromium project. It is also used in non-browser contexts, notably including the Node.js runtime system.[1] Other server-side JavaScript runtimes use alternative engines, such as Bun (which uses JavaScriptCore) and Hermes (used by React Native).

History

Google created V8 for its Chrome browser, so V8's first release coincided with Chrome's first release in 2008.[citation needed] It was named after the V8 engine, and its lead developer was Lars Bak.[4] For several years, Chrome was faster than other browsers at executing JavaScript.[5][6][7]

The V8 assembler is based on the Strongtalk assembler.[8] On 7 December 2010, a new compiling infrastructure named Crankshaft was released, with speed improvements.[9] In version 41 of Chrome in 2015, project TurboFan was added to provide more performance improvements with previously challenging workloads such as asm.js.[10] Much of V8's development is strongly inspired by the Java HotSpot Virtual Machine developed by Sun Microsystems, with the newer execution pipelines being very similar to those of HotSpot's.

Support for the WebAssembly language began in 2015.[11]

In 2016, the Ignition interpreter was added to V8 with the design goal of reducing the memory usage on small memory Android phones in comparison with TurboFan and Crankshaft.[12] Ignition is a register 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-new compiler pipeline, consisting of Ignition (the interpreter) and TurboFan (the optimizing 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.[13]

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 Maglev SSA-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.[14]

Design

V8 first generates an abstract syntax tree with its own parser.[15] Then, Ignition generates bytecode from this syntax tree using the internal V8 bytecode format.[16] TurboFan compiles this bytecode into machine code. In other words, V8 compiles ECMAScript to native machine code using just-in-time compilation before executing it.[17] The compiled code is additionally optimized (and re-optimized) dynamically at runtime, based on heuristics of the code's execution profile. Optimization techniques used include inlining, elision of expensive runtime properties, and inline caching. The garbage collector is a generational incremental collector.[18]

Usage

V8 can compile to x86, ARM or MIPS instruction set architectures in both their 32-bit and 64-bit editions; it has additionally been ported to PowerPC,[19][20] and to IBM ESA/390 and z/Architecture,[21][19] for use in servers.[22]

V8 can be used in a browser or integrated into independent projects. V8 is used in the following software:

See also

References

  1. 1 2 3 4 "Documentation · V8". Google. Retrieved 3 March 2024.
  2. ↑ "Chrome Platform Status". Retrieved 29 June 2023.
  3. ↑ "v8/LICENSE.v8 at master". Github.
  4. ↑ "V8: an open source JavaScript engine". YouTube. Google. 15 September 2008. Retrieved 15 March 2024.
  5. ↑ "Big browser comparison test: Internet Explorer vs. Firefox, Opera, Safari and Chrome". PC Games Hardware. Computec Media AG. 3 July 2009. Archived from the original on 2 May 2012. Retrieved 28 June 2010.
  6. ↑ Purdy, Kevin (11 June 2009). "Lifehacker Speed Tests: Safari 4, Chrome 2". Lifehacker. Archived from the original on 14 April 2021. Retrieved 8 May 2021.
  7. ↑ "Mozilla asks, 'Are we fast yet?'". Wired. Archived from the original on 22 June 2018. Retrieved 18 January 2019.
  8. ↑ "V8 JavaScript Engine: License". Google Code. Archived from the original on 22 July 2010. Retrieved 17 August 2010.
  9. ↑ "A New Crankshaft for V8". Chromium Blog. 7 December 2010. Retrieved 22 April 2011.
  10. ↑ "Revving up JavaScript performance with TurboFan". 7 July 2015. Retrieved 5 March 2016.
  11. ↑ "Experimental support for WebAssembly in V8". v8.dev. Retrieved 12 March 2024.
  12. ↑ "BlinkOn 6 Day 1 Talk 2: Ignition - an interpreter for V8". YouTube. 26 June 2016. Archived from the original on 21 December 2021. Retrieved 2 September 2016.
  13. ↑ "Launching Ignition and TurboFan". 16 May 2017. Retrieved 13 July 2017.
  14. ↑ "Maglev - V8's Fastest Optimizing JIT". 5 December 2023. Retrieved 26 January 2024.
  15. ↑ Verwaest, Toon (25 March 2019). "Blazingly fast parsing, part 1: optimizing the scanner · V8". v8.dev. Archived from the original on 21 April 2021. Retrieved 1 June 2021.
  16. ↑ Hinkelmann, Franziska (19 December 2017). "Understanding V8's Bytecode". Medium. Retrieved 17 October 2019.
  17. ↑ "Firing up the Ignition interpreter · V8". v8.dev. Retrieved 30 September 2020.
  18. ↑ "A game changer for interactive performance". blog.chromium.org. 21 November 2011. Retrieved 6 February 2022.
  19. 1 2 "PPC support for Google V8 goes mainstream". 30 June 2015. Archived from the original on 12 September 2015.
  20. ↑ "GitHub - ibmruntimes/v8ppc: Port of Google V8 javascript engine to PowerPC". 21 April 2019 – via GitHub.
  21. ↑ "Port of Google V8 JavaScript engine to z/OS. The Linux on Z port is maintained in the community: ibmruntimes/v8z". 2 April 2019 – via GitHub.
  22. ↑ "V8 Changelog v3.8.2". Archived from the original on 22 October 2012. Retrieved 23 October 2012.
  23. ↑ "V8 Runtime Overview | Apps Script". Google for Developers. Retrieved 26 January 2025.
  24. ↑ "A secure JavaScript/TypeScript runtime built with V8, Rust, and Tokio: denoland/deno". 8 July 2019 – via GitHub.
  25. ↑ "Overview - NativeScript Docs". docs.nativescript.org. Archived from the original on 28 July 2020. Retrieved 8 July 2019.
  26. ↑ O'Dell, Jolie (10 March 2011). "Why Everyone Is Talking About Node". Mashable.