Skip to content

chore: update V8 to 15.8 - #37269

Open
bartlomieju wants to merge 12 commits into
mainfrom
chore/update-v8-158
Open

bartlomieju wants to merge 12 commits into
mainfrom
chore/update-v8-158

Conversation

@bartlomieju

@bartlomieju bartlomieju commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Updates the v8 crate from 150.4.0 to 158.0.0, which brings V8 15.8.62.23.
This supersedes #36665 (152.2.0) and includes its changes: Global::open
is now unsafe, so call sites go through v8::Local::new, and the node:vm
microtask queue is owned explicitly instead of leaked.

V8 15.8 removed three flags we passed. --js-float16array and
--js-explicit-resource-management are gone because those features now ship
by default; since V8 stops parsing at the first unknown flag, they were also
silently dropping --js-source-phase-imports, --js-defer-import-eval and
--enable-queue-microtask. --inspector-live-edit is gone because V8
removed live edit entirely, so Debugger.setScriptSource always fails.
--watch-hmr now notices that, prints a one-time message and falls back to
restarting like --watch, and desktop HMR reloads the page instead of
dropping the change. The HMR integration tests are updated accordingly.

V8 15.8 also turns reading an embedder data slot past the end of a context's
embedder data into a fatal error. node:vm's wasm code generation callback
runs for every context and reads slots 3 and 4, which deno_core's contexts
didn't have, so compiling wasm after vm.createContext() crashed (the
vm_wasm_streaming spec and two WASI node compat tests). deno_core now
initializes those slots to null in every context it creates.

Closes #36665

- `Global::open` is now `unsafe`; migrate call sites to the safe
  `v8::Local::new(scope, handle)`.
- Interceptor setter/definer callbacks now take `ReturnValue<Boolean>`.
- V8 removed asm.js validation, so `--no-validate-asm` is gone. Leaving it
  in made V8 reject the flag string and silently drop every flag after it.
- Bootstrap no longer fits in a 5MB heap; raise the heap-limit test caps.
`MicrotaskQueue::new` now returns an owning `MicrotaskQueueHandle` instead of
a `UniqueRef`, so the leak that hands the queue to the context is now explicit.
Indexed/named setter and definer interceptors take `ReturnValue<Boolean>`.
The setter/definer `ReturnValue` payload changed to `Boolean` in v8 152, but
the QuickJS backend vendors an older rusty_v8 that still expects `()`. Add a
`PropertyInterceptorReturnValue` alias to the deno_v8 facade, which is where
backend differences belong, and name it from the interceptors.
v8 152 replaced the `UniqueRef<MicrotaskQueue>` from `MicrotaskQueue::new`
with an owning `MicrotaskQueueHandle`. Two things followed from that which the
first pass got wrong.

`MicrotaskQueue` no longer implements `Drop` — only the handle does — so the
`drop_in_place` in `ContextifyContext::drop` silently became a no-op, and
forgetting the handle to recover a raw pointer leaked it outright. Under the
default `v8_cppgc_microtask_queue` setting the handle is a root into the
isolate's heap that contexts outlive on their own, so it wants to be held and
dropped, not leaked.

`ContextifyContext` now stores an `Option<OwnedMicrotaskQueue>` and lets
ordinary ownership release it, which drops the hand-written `Drop` impl, the
`mem::forget`, and the `unsafe { drop_in_place }` along with it.
`ContextifyModule` keeps borrowing the queue as a raw alias, which is now
sounder: a context keeps its queue alive independently of the handle, so the
alias survives even if the owning `ContextifyContext` is collected first.

`OwnedMicrotaskQueue` is aliased in the deno_v8 facade because the QuickJS
backend still returns `UniqueRef<MicrotaskQueue>`; both are RAII wrappers that
deref to `MicrotaskQueue`, so callers just name the alias.
The ModuleMap split moved these call sites after the v8 152 changes were
written; use v8::Local::new like the rest.
Float16Array and explicit resource management ship by default, so their
flags are gone. V8 stops parsing at the first unknown flag, which silently
dropped the flags after them, including --enable-queue-microtask.

V8 also removed live edit, along with --inspector-live-edit.
Brings V8 15.8.62.23.
V8 15.8 removed live edit, so Debugger.setScriptSource now always fails
with a protocol error. Previously that aborted --watch-hmr; now it prints
a one-time notice and restarts the program like --watch, and desktop HMR
asks the host to reload the page instead of dropping the change.
V8 15.8 aborts when reading an embedder data slot past the end of a
context's embedder data. node:vm's wasm code generation callback runs for
every context and reads slots 3 and 4, which deno_core's own contexts
didn't have, so compiling wasm after creating a vm context crashed.
deno_core now initializes the slots up to MAX_EMBEDDER_DATA_SLOT_INDEX to
null in every context it creates.
code-cache-base-url.html now passes. The two tentative import defer tests
with a cyclic top-level await dependency no longer reject: V8 15.8's
reworked ReadyForSyncExecution leaves the import.defer() promise pending.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant