V8 JavaScript Engine
   HOME

TheInfoList



OR:

V8 is a
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
and
WebAssembly WebAssembly (Wasm) defines a portable binary-code format and a corresponding text format for executable programs as well as software interfaces for facilitating communication between such programs and their host environment. The main goal of ...
engine developed by
Google Google LLC (, ) is an American multinational corporation and technology company focusing on online advertising, search engine technology, cloud computing, computer software, quantum computing, e-commerce, consumer electronics, and artificial ...
for its Chrome browser. V8 is
free and open-source software Free and open-source software (FOSS) is software available under a license that grants users the right to use, modify, and distribute the software modified or not to everyone free of charge. FOSS is an inclusive umbrella term encompassing free ...
that is part of the
Chromium Chromium is a chemical element; it has Symbol (chemistry), symbol Cr and atomic number 24. It is the first element in Group 6 element, group 6. It is a steely-grey, Luster (mineralogy), lustrous, hard, and brittle transition metal. Chromium ...
project and also used separately in non-browser contexts, notably the Node.js
runtime system In computer programming, a runtime system or runtime environment is a sub-system that exists in the computer where a program is created, as well as in the computers where the program is intended to be run. The name comes from the compile time ...
. Other server-side JavaScript runtimes use alternative engines, such as
Bun A bun is a type of bread that is round and small enough that it can generally be eaten hand-held. Whether a bun is considered sweetened or unsweetened differs between countries: it is considered sweetened in the United Kingdom, a savory bread in ...
(which uses
JavaScriptCore WebKit is a browser engine primarily used in Apple's Safari web browser, as well as all web browsers on iOS and iPadOS. WebKit is also used by the PlayStation consoles starting with the PS3, the Tizen mobile operating systems, the Amazon ...
) and Hermes (used by
React Native React Native is an open-source UI software framework developed by Meta Platforms (formerly Facebook Inc.). It is used to develop applications for Android, Android TV, iOS, macOS, tvOS, Web, Windows and UWP by enabling developers to use the R ...
).


History

Google Google LLC (, ) is an American multinational corporation and technology company focusing on online advertising, search engine technology, cloud computing, computer software, quantum computing, e-commerce, consumer electronics, and artificial ...
created V8 for its Chrome browser, and both were first released in 2008. The lead developer of V8 was
Lars Bak Lars Ytting Bak (born 16 January 1980) is a Danish former professional road bicycle racer, who rode professionally between 2002 and 2019 for the Fakta, , , , and squads. Since retiring as a rider, Bak has acted as a directeur sportif for in ...
, and it was named after the powerful
car engine An internal combustion engine (ICE or IC engine) is a heat engine in which the combustion of a fuel occurs with an oxidizer (usually air) in a combustion chamber that is an integral part of the working fluid flow circuit. In an internal co ...
. For several years, Chrome was faster than other browsers at executing
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
. The V8 assembler is based on the
Strongtalk In computing, Strongtalk is a Smalltalk environment with optional static typing support. Strongtalk can make some compile time checks, and offer ''stronger'' type safety guarantees; this is the source of its name. It is non-commercial, though it ...
assembler. On 7 December 2010, a new compiling infrastructure named Crankshaft was released, with speed improvements. In version 41 of Chrome in 2015, project TurboFan was added to provide more performance improvements with previously challenging workloads such as
asm.js asm.js is a subset of JavaScript designed to allow computer software written in languages such as C to be run as web applications while maintaining performance characteristics considerably better than standard JavaScript, which is the typical l ...
. Much of V8's development is strongly inspired by the Java HotSpot Virtual Machine developed by
Sun Microsystems Sun Microsystems, Inc., often known as Sun for short, was an American technology company that existed from 1982 to 2010 which developed and sold computers, computer components, software, and information technology services. Sun contributed sig ...
, with the newer execution pipelines being very similar to those of HotSpot's. Support for the new
WebAssembly WebAssembly (Wasm) defines a portable binary-code format and a corresponding text format for executable programs as well as software interfaces for facilitating communication between such programs and their host environment. The main goal of ...
language began in 2015. In 2016, the Ignition interpreter was added to V8 with the design goal of reducing the
memory Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembe ...
usage on small memory Android phones in comparison with TurboFan and Crankshaft. 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 In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
pipeline, consisting of Ignition (the
interpreter Interpreting is translation from a spoken or signed language into another language, usually in real time to facilitate live communication. It is distinguished from the translation of a written text, which can be more deliberative and make use o ...
) and TurboFan (the
optimizing compiler An optimizing compiler is a compiler designed to generate code that is optimized in aspects such as minimizing program execution time, memory usage, storage size, and power consumption. Optimization is generally implemented as a sequence of op ...
). 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. 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.


Design

V8 first generates an
abstract syntax tree An abstract syntax tree (AST) is a data structure used in computer science to represent the structure of a program or code snippet. It is a tree representation of the abstract syntactic structure of text (often source code) written in a formal ...
with its own parser. Then, Ignition generates
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
from this syntax tree using the internal V8
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
format. TurboFan compiles this bytecode into machine code. In other words, V8 compiles
ECMAScript ECMAScript (; ES) is a standard for scripting languages, including JavaScript, JScript, and ActionScript. It is best known as a JavaScript standard intended to ensure the interoperability of web pages across different web browsers. It is stan ...
directly to native
machine code In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
using
just-in-time compilation In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is compilation (of computer code) during execution of a program (at run time) rather than before execution. This may consist of source code transl ...
before executing it. 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 In computing, inline expansion, or inlining, is a manual or compiler optimization that replaces a function call site with the body of the called function. Inline expansion is similar to macro expansion, but occurs during compiling, without cha ...
,
elision In linguistics, an elision or deletion is the omission of one or more sounds (such as a vowel, a consonant, or a whole syllable) in a word or phrase. However, these terms are also used to refer more narrowly to cases where two words are run to ...
of expensive runtime properties, and
inline caching Inline caching is an optimization technique employed by some language runtimes, and first developed for Smalltalk. The goal of inline caching is to speed up runtime method binding by remembering the results of a previous method lookup directly ...
. The
garbage collector A waste collector, also known as a garbage man, garbage collector, trashman (in the U.S), binman or dustman (in the UK), is a person employed by a public or private enterprise to collect and dispose of municipal solid waste (refuse) and recycla ...
is a generational incremental collector.


Usage

V8 can compile to
x86 x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel, based on the 8086 microprocessor and its 8-bit-external-bus variant, the 8088. Th ...
,
ARM In human anatomy, the arm refers to the upper limb in common usage, although academically the term specifically means the upper arm between the glenohumeral joint (shoulder joint) and the elbow joint. The distal part of the upper limb between ...
or MIPS
instruction set architecture In computer science, an instruction set architecture (ISA) is an abstract model that generally defines how software controls the CPU in a computer or a family of computers. A device or program that executes instructions described by that ISA, ...
s in both their
32-bit In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in a maximum of 32- bit units. Compared to smaller bit widths, 32-bit computers can perform la ...
and
64-bit In computer architecture, 64-bit integers, memory addresses, or other data units are those that are 64 bits wide. Also, 64-bit central processing units (CPU) and arithmetic logic units (ALU) are those that are based on processor registers, a ...
editions; it has additionally been ported to
PowerPC PowerPC (with the backronym Performance Optimization With Enhanced RISC – Performance Computing, sometimes abbreviated as PPC) is a reduced instruction set computer (RISC) instruction set architecture (ISA) created by the 1991 Apple Inc., App ...
, and to
IBM ESA/390 IBM Enterprise Systems Architecture is an instruction set architecture introduced by IBM as Enterprise Systems Architecture/370 (ESA/370) in 1988. It is based on the IBM System/370-XA architecture. It extended the dual-address-space mechanism ...
and
z/Architecture z/Architecture, initially and briefly called ESA Modal Extensions (ESAME), is IBM's 64-bit complex instruction set computer (CISC) instruction set architecture, implemented by its mainframe computers. IBM introduced its first z/Architecture ...
, for use in servers. V8 can be used in a browser or integrated into independent projects. V8 is used in the following software: *
Chromium Chromium is a chemical element; it has Symbol (chemistry), symbol Cr and atomic number 24. It is the first element in Group 6 element, group 6. It is a steely-grey, Luster (mineralogy), lustrous, hard, and brittle transition metal. Chromium ...
-based
web browser A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scr ...
s -
Google Chrome Google Chrome is a web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS, iOS, iPadOS, an ...
, Brave,
Opera Opera is a form of History of theatre#European theatre, Western theatre in which music is a fundamental component and dramatic roles are taken by Singing, singers. Such a "work" (the literal translation of the Italian word "opera") is typically ...
,
Vivaldi Antonio Lucio Vivaldi (4 March 1678 – 28 July 1741) was an Italian composer, virtuoso violinist, impresario of Baroque music and Roman Catholic priest. Regarded as one of the greatest Baroque composers, Vivaldi's influence during his lif ...
and
Microsoft Edge Microsoft Edge is a Proprietary Software, proprietary cross-platform software, cross-platform web browser created by Microsoft and based on the Chromium (web browser), Chromium open-source project, superseding Edge Legacy. In Windows 11, Edge ...
. * Cloud-based environments, like
Google Apps Script Google Apps Script is a scripting platform developed by Google for light-weight application development in the Google Workspace platform. Google Apps Script was initially developed by Mike Harm as a side project while working as a developer on Go ...
*
Couchbase Couchbase Server, originally known as Membase, is a source-available, distributed ( shared-nothing architecture) multi-model NoSQL document-oriented database software package optimized for interactive applications. These applications may serv ...
database server * Deno runtime environment *
Electron The electron (, or in nuclear reactions) is a subatomic particle with a negative one elementary charge, elementary electric charge. It is a fundamental particle that comprises the ordinary matter that makes up the universe, along with up qua ...
desktop application framework, used by the
Atom Atoms are the basic particles of the chemical elements. An atom consists of a atomic nucleus, nucleus of protons and generally neutrons, surrounded by an electromagnetically bound swarm of electrons. The chemical elements are distinguished fr ...
and
Visual Studio Code Visual Studio Code, commonly referred to as VS Code, is an integrated development environment developed by Microsoft for Windows, Linux, macOS and web browsers. Features include support for debugging, syntax highlighting, intelligent code comp ...
text editors *
MarkLogic MarkLogic is an American software business that develops and provides an enterprise NoSQL database, which is also named ''MarkLogic''. They have offices in the United States, Europe, Asia, and Australia. In February 2023, MarkLogic was acquired ...
database server *
NativeScript NativeScript provides platform APIs directly to the JavaScript runtime (''with strong types'') for a rich TypeScript development experience. As an open-source framework to develop apps for iOS, visionOS and Android platforms combining a bes ...
mobile application framework * Node.js runtime environment


See also

*
Blink Blinking is a bodily function; it is a semi-autonomic rapid closing of the eyelid. A single blink is determined by the forceful closing of the eyelid or inactivation of the levator palpebrae superioris and the activation of the palpebral por ...
, the Chromium browser engine


References


External links

* {{NodeJs 2008 software Free and open source interpreters Google Chrome Google software JavaScript engines Software using the BSD license Virtual machines