---
title: "Static Roots: Objects with Compile-Time Constant Addresses"
description: "V8's static roots place the read-only heap at the start of every pointer-compression cage and generate it deterministically, so core objects like `undefined` get compressed addresses known at compile time (e.g. `undefined` is always 0x61)."
url: "https://swe.quest/articles/static-roots-objects-with-compile-time-constant-addresses-91e4d5de9f87687b"
canonical: "https://v8.dev/blog/static-roots"
source: "V8"
published: "2024-02-05"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 4
tags: ["runtimes","memory-management","performance","javascript","c-cpp"]
---

# Static Roots: Objects with Compile-Time Constant Addresses

A post on [V8](https://swe.quest/sources/v8.md), published 2024-02-05, 4 min read, Deep dive. Original: [https://v8.dev/blog/static-roots](https://v8.dev/blog/static-roots)

## Summary

V8's static roots place the read-only heap at the start of every pointer-compression cage and generate it deterministically, so core objects like \`undefined\` get compressed addresses known at compile time (e.g. \`undefined\` is always 0x61). A generated static-roots.h file, cached in the repo and regenerated only when the read-only heap layout changes, lets libv8's C++ and the builtins compiler embed these constants instead of loading from a global roots array. Grouping related objects also turns checks such as "is string" or "is truthy" into address range comparisons. Shipped in Chrome 111, the change gave roughly a 1% Speedometer 2 gain on M1.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Runtimes & VMs](https://swe.quest/tags/runtimes.md) (Compilers & runtimes)
- [Memory management](https://swe.quest/tags/memory-management.md) (Compilers & runtimes)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [C & C++](https://swe.quest/tags/c-cpp.md) (Languages)

## Prerequisites

- pointer compression
- JavaScript engine heaps ([easy posts on Runtimes & VMs](https://swe.quest/tags/runtimes.md?difficulty=easy))
- heap snapshots

## Keywords

V8, static roots, read-only heap, pointer compression, mksnapshot, Chrome 111, Speedometer 2

## Related posts

- [V8 release v6.9 · V8](https://swe.quest/articles/v8-release-v6-9-v8-d0efd26e2594b2df.md): V8 · 2018-08-07 · Easy · 4 min read · Runtimes & VMs, JavaScript, Memory management, WebAssembly, Compilers
  V8 v6.9 embeds built-in functions directly into the binary on x64, so all Isolates share one copy instead of each holding up to 700 KB on its own heap.
- [How Bun supports V8 APIs without using V8 (part 1)](https://swe.quest/articles/how-bun-supports-v8-apis-without-using-v8-part-1-ff8148b61cb465d8.md): Bun · 2024-09-30 · Hard · 19 min read · Runtimes & VMs, C & C++, JavaScript, Memory management
  Bun, which runs on JavaScriptCore, implements a growing subset of V8's C++ embedding API so Node.js native modules like cpu-features load without V8.
- [How Bun supports V8 APIs without using V8 (part 2)](https://swe.quest/articles/how-bun-supports-v8-apis-without-using-v8-part-2-d765ff746fe7a86a.md): Bun · 2024-11-05 · Hard · 18 min read · Runtimes & VMs, JavaScript, C & C++, Memory management
  Bun emulates V8's memory layout on top of JavaScriptCore so that precompiled native addons, which inline V8 functions assuming specific pointer layouts, keep working.
- [Turbocharging V8 with mutable heap numbers](https://swe.quest/articles/turbocharging-v8-with-mutable-heap-numbers-d32025b1d5ea1f1c.md): V8 · 2025-02-25 · Hard · 5 min read · Runtimes & VMs, Compilers, JavaScript, Performance engineering, Memory management
  V8 eliminated a performance cliff in JetStream2's async-fs benchmark caused by a custom Math.random whose \`seed\` lives in a ScriptContext slot.
- [The V8 Sandbox](https://swe.quest/articles/the-v8-sandbox-705346b1934809ad.md): V8 · 2024-04-04 · Hard · 11 min read · Sandboxing & isolation, Runtimes & VMs, Memory safety, Browsers, Vulnerability research
  The V8 Sandbox is a lightweight, in-process software sandbox that isolates the V8 heap so memory corruption from engine bugs cannot spread to the rest of the renderer process.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
