d8
Compile Java bytecode to DEX format
TLDR
Start a REPL (interactive shell)
Run a JavaScript file
Evaluate a JavaScript expression
SYNOPSIS
d8 [options] [script.js] [-- args]
PARAMETERS
--help
Print help and usage information.
--version
-v
Print the V8 version string.
--print-ast
Print the AST before compiling.
--print-code
-p
Print generated machine code.
--allow-natives-syntax
Allow inline runtime functions like %DebugPrint.
--harmony
Enable all completed harmony features (deprecated).
--expose-gc
Expose gc() function globally.
--max-old-space-size=size
Max size of the old space (in Mbytes).
--trace-gc
Trace garbage collections.
--interactive
-i
Force interactive mode (REPL).
--shell-mode
Similar to interactive but specialized.
--check
Check script syntax only.
DESCRIPTION
d8 is the command-line shell for Google's V8 JavaScript engine, extracted from Chromium. It allows direct execution of JavaScript code, scripts, or interactive REPL sessions without a browser environment.
Primarily used by developers for testing JavaScript performance, debugging engine behavior, and benchmarking. Supports ECMAScript standards, modules, and V8-specific features like native syntax for optimization inspection.
Invoke with a script file for batch execution or without arguments for REPL mode. Outputs results to stdout; errors to stderr. Highly configurable via flags mirroring V8's runtime options, enabling fine-tuned control over garbage collection, JIT compilation, and more.
Not installed by default on most Linux distributions; obtain via Chromium source builds, prebuilt binaries, or packages like chromium-d8 in some repos.
CAVEATS
Not standard on most systems; requires manual installation. Hundreds of V8-specific flags exist (--help for full list); undocumented or experimental flags may change. High memory usage with large heaps.
BASIC USAGE EXAMPLE
d8 script.js runs JS file.
d8 -i starts REPL: > print('Hello');
INSTALLATION NOTE
On Ubuntu/Debian: apt install chromium-browser. Then /path/to/chrome --no-sandbox --dump-dom d8 or build from source.
HISTORY
Introduced with V8 in 2008 by Google. Evolved alongside Chromium; binaries from depot_tools or official builds. Key milestones: ES6 support (2015), ES2017+ features progressively added.


