V8 is a
free and open-source JavaScript engine developed by the Chromium Project for
Google Chrome and
Chromium web browsers.
The project’s creator is
Lars Bak. The first version of the V8 engine was released at the same time as the first version of Chrome: 2 September 2008. It has also been used on the server side, for example in
Couchbase
Couchbase Server, originally known as Membase, is an open-source, distributed ( shared-nothing architecture) multi-model NoSQL document-oriented database software package optimized for interactive applications. These applications may serve many ...
and
Node.js.
History
The V8
assembler
Assembler may refer to:
Arts and media
* Nobukazu Takemura, avant-garde electronic musician, stage name Assembler
* Assemblers, a fictional race in the ''Star Wars'' universe
* Assemblers, an alternative name of the superhero group Champions of ...
is based on the
Strongtalk 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. 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.
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. 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
In computing, an optimizing compiler is a compiler that tries to minimize or maximize some attributes of an executable computer program. Common requirements are to minimize a program's execution time, memory footprint, storage size, and power cons ...
). 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.
Design
V8 first generates an
abstract syntax tree
In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of text (often source code) written in a formal language. Each node of the tree denotes a construct occurr ...
with its own parser. Then, Ignition generates
bytecode from this syntax tree using the internal V8 bytecode format. TurboFan compiles this bytecode into machine code. In other words, V8 compiles
ECMAScript
ECMAScript (; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the documenECMA-262
ECMAScript is commonly used for client-side scripting o ...
directly to native
machine code
In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ve ...
using
just-in-time compilation
In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is a way of executing computer code that involves compilation during execution of a program (at run time) rather than before execution. This may co ...
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 compilation, without cha ...
,
elision of expensive runtime properties, and
inline caching. The
garbage collector is a
generational incremental
Increment or incremental may refer to:
*Incrementalism, a theory (also used in politics as a synonym for gradualism)
*Increment and decrement operators, the operators ++ and -- in computer programming
*Incremental computing
*Incremental backup, wh ...
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 Intel 8086 microprocessor and its 8088 variant. The 8086 was intr ...
,
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 th ...
or
MIPS instruction set architectures in both their
32-bit and
64-bit editions; it has additionally been ported to
PowerPC and
IBM s390 for use in servers.
V8 can be used in a browser or integrated into independent projects. V8 is used in the following software:
*
Chromium-based
web browser
A web browser is application software 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 screen. Browsers are used o ...
s -
Google Chrome,
Brave,
Opera
Opera is a form of theatre in which music is a fundamental component and dramatic roles are taken by singers. Such a "work" (the literal translation of the Italian word "opera") is typically a collaboration between a composer and a libr ...
,
Vivaldi and
Microsoft Edge
Microsoft Edge is a proprietary, cross-platform web browser created by Microsoft. It was first released in 2015 as part of Windows 10 and Xbox One and later ported to other platforms as a fork of Google's Chromium open-source project: Android ...
.
*
Couchbase
Couchbase Server, originally known as Membase, is an open-source, distributed ( shared-nothing architecture) multi-model NoSQL document-oriented database software package optimized for interactive applications. These applications may serve many ...
database server
*
Deno runtime environment
*
Electron
The electron ( or ) is a subatomic particle with a negative one elementary electric charge. Electrons belong to the first generation of the lepton particle family,
and are generally thought to be elementary particles because they have no ...
desktop application framework, used by the
Atom
Every atom is composed of a nucleus and one or more electrons bound to the nucleus. The nucleus is made of one or more protons and a number of neutrons. Only the most common variety of hydrogen has no neutrons.
Every solid, liquid, gas, ...
and
Visual Studio Code
Visual Studio Code, also commonly referred to as VS Code, is a source-code editor made by Microsoft with the Electron Framework, for Windows, Linux and macOS. Features include support for debugging, syntax highlighting, intelligent code comple ...
text editors
*
MarkLogic database server
*
NativeScript
NativeScript is an open-source framework to develop mobile apps on the Apple iOS and Android platforms. It was originally conceived and developed by Progress. At the end of 2019 responsibility for the NativeScript project was taken over by long- ...
mobile application framework
*
Node.js runtime environment
*
Qt Quick
Qt Quick is a free software application framework developed and maintained by the Qt Project within the Qt framework. It provides a way of building custom, highly dynamic graphical user interfaces with fluid transitions and effects, which are b ...
runtime environment
See also
*
Blink, the Chromium browser engine
References
External links
*
{{NodeJs
2008 software
Free compilers and interpreters
Google Chrome
Google software
JavaScript engines
Software using the BSD license
Virtual machines