GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Don't use compilation cache hits off the main thread when recording by Andarist · Pull Request #209 · replayio/node

Conversation

@Andarist

@Andarist Andarist commented Oct 29, 2026

Copy link
Copy Markdown
Member

Port of replayio/chromium-v8#356.

When recording, a script found in the isolate's compilation cache creates no new Script. The replay doesn't use the cache:
GetSharedFunctionInfoForScript records whether each lookup found a script and the replay uses the same Script, but only on the main thread with events allowed. Off the main thread nothing is recorded, so a worker that compiled the same source twice found it in the cache when recording and compiled it again when replaying, creating a Script the recording didn't.

In node a worker reaches the cache through its inspector session: Runtime.evaluate (outside REPL mode) and Runtime.compileScript, while Debugger.enable isn't on. vm.Script and ES modules never hit it (their host-defined options carry a per-script id), CommonJS compiles with compileFunction, and napi_run_script isn't recordable.

Off the main thread, drop what the lookup found when recording, as is already done for scripts the replay couldn't find.

The backend's node-recording case
worker-threads/inspector-compiles-same-script-twice (the node version of the chromium-recording cases from replayio/backend#13567) fails with master: the recording's two compiles get the same script and the replay's don't.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Andarist @claude
Don't use compilation cache hits off the main thread when recording
7ed07d3
Port of replayio/chromium-v8#356.

When recording, a script found in the isolate's compilation cache creates
no new Script. The replay doesn't use the cache:
GetSharedFunctionInfoForScript records whether each lookup found a script
and the replay uses the same Script, but only on the main thread with
events allowed. Off the main thread nothing is recorded, so a worker that
compiled the same source twice found it in the cache when recording and
compiled it again when replaying, creating a Script the recording didn't.

In node a worker reaches the cache through its inspector session:
Runtime.evaluate (outside REPL mode) and Runtime.compileScript, while
Debugger.enable isn't on. vm.Script and ES modules never hit it (their
host-defined options carry a per-script id), CommonJS compiles with
compileFunction, and napi_run_script isn't recordable.

Off the main thread, drop what the lookup found when recording, as is
already done for scripts the replay couldn't find.

The backend's node-recording case
worker-threads/inspector-compiles-same-script-twice (the node version of
the chromium-recording cases from replayio/backend#13567) fails with
master: the recording's two compiles get the same script and the replay's
don't.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Andarist
Andarist merged commit 6d0c37b into master Oct 29, 2026
2 of 3 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Andarist
Andarist deleted the andarist/off-main-thread-compilation-cache branch October 29, 2026 09:17
Andarist added a commit that referenced this pull request Nov 2, 2026
@Andarist @claude
Port script registration and instrumentation changes from Chromium's …
c7e987c
…V8 (#217)

Port of replayio/chromium-v8#357 and the parts of replayio/chromium-v8#360
that apply to node.

* Register a script as a Replay source when its main-thread compile
  finishes (nodejs#357), not when its function first runs. An ES module whose
  import graph failed to load never ran, so the recording had no source
  for it.

* Decide once per script whether its bytecode is instrumented (nodejs#360): the
  script records the decision when it's created and every later compile of
  it inherits it, replacing the per-(isolate, script id) map where the
  first compile decided. Only instrumented scripts are registered. Unlike
  Chromium, node still never instruments bytecode generated off the main
  thread, so scripts created by a streaming compile are uninstrumented. A
  CHECK enforces that main-thread and toplevel compiles agree with the
  script. With RECORD_REPLAY_INSTRUMENT_NODE, node internals from the
  startup snapshot are now consistently uninstrumented (their lazily
  compiled functions used to be instrumented).

* Queue sources registered before the first checkpoint and announce them
  right after it, and warn about and reset progress made before it.

* CHECK that the replay never finds a script in its compilation cache,
  which is off when replaying.

* Invalidate the recording for --lazy-compile-dispatcher and
  --parallel-compile-tasks.

* When the GC has collected a script's top-level function, recompile it
  when listing the script's possible breakpoints, so functions only it
  referenced still have them.

Not ported from nodejs#360: starting the recording before the first checkpoint
(node takes it before any user JS), the separate script id pool (node has
none), the JS asserts URL pattern and per-script asserts bit (node asserts
in every instrumented script), and the V8 extension rule (node already
skips them by URL). replayio/chromium-v8#356 is already in node
(#209) and replayio/chromium#1589 only touches Blink.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@Andarist Andarist mentioned this pull request Nov 2, 2026
Port script registration and instrumentation changes from Chromium's V8 #217
Merged
bhackett1024 pushed a commit that referenced this pull request Nov 5, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
7dc293c
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Domiii @Andarist
@bhackett1024 @claude
Keep the V8 compilation cache deterministic when recording/replaying
257bbb0
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Domiii @Andarist
@bhackett1024 @claude
Keep the V8 compilation cache deterministic when recording/replaying
9800f8a
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Domiii @Andarist
@bhackett1024 @claude
Keep the V8 compilation cache deterministic when recording/replaying
d80f7ce
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 6, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
2acda9a
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 6, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
9fe4ceb
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 6, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
17b97ae
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@Domiii @Andarist
@bhackett1024 @claude
Keep the V8 compilation cache deterministic when recording/replaying
54773f8
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
a312088
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
85d2db6
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
9f44786
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
284126d
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
8415921
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
21a74aa
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
302bef1
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
c6ac54e
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
648194c
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
74050b8
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
6493c70
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
b394ff2
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
b032149
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
218c708
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
454543e
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
f1e9c40
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
037ad71
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
8d9c592
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
93d680b
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 11, 2026
@Domiii @Andarist
Keep the V8 compilation cache deterministic when recording/replaying
4a61808
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 11, 2026
@Domiii @Andarist
@bhackett1024 @claude
Keep the V8 compilation cache deterministic when recording/replaying
e69d073
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 11, 2026
@Domiii @Andarist
@bhackett1024 @claude
Keep the V8 compilation cache deterministic when recording/replaying
f1f0074
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 12, 2026
@Domiii @Andarist
@bhackett1024 @claude
Keep the V8 compilation cache deterministic when recording/replaying
6f14063
Record the script ID that a compilation cache hit produced and reuse
that script when replaying. The cache is disabled while replaying, but
the same scripts must still be created with the same IDs, and the
shared function info can simply be recompiled. A hit whose script was
never registered with the recorder is dropped, since it could not be
found when replaying. Off the main thread nothing is recorded, so a
hit found there is dropped when recording too: otherwise a worker that
compiled the same source twice found it in the cache when recording
and compiled it again when replaying, creating a Script the recording
didn't. In node a worker reaches the cache through its inspector
session, with Runtime.evaluate outside REPL mode and
Runtime.compileScript. Streamed scripts skip the cache entirely,
because a hit with no top-level shared function info is not supported
yet, and their compiles are flagged record_replay_ignore, as bytecode
generated off the main thread is never instrumented. (Chromium feature
gates: "values", "no-streamed-script-cache")

Recompiling into a script a cache hit produced inherits that script's
instrumentation decision (RecordReplayInheritCompileFlags) rather than
deciding again, and finalizing a compile CHECKs that its flags agree
with the script it compiles into, where reading the script is safe: on
the main thread, or on the thread that just created it. Since the
cache is off when replaying, a replay must never find a script in it,
which is CHECKed too.

Rebase note: CompileScriptOnMainThread now takes the script to reuse;
new callers pass MaybeHandle<Script>(). The invariants are that a
cache lookup's result may only be used where whether it hit is
recorded, and that a compile reusing a script never re-decides that
script's instrumentation.

From #145, #146, #209 and #217.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Andarist
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.