GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
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
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: 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
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsPort 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]> Uh oh!
There was an error while loading. Please reload this page.
Andarist
added a commit
that referenced
this pull request
…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]>
bhackett1024
pushed a commit
that referenced
this pull request
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. |