Repository navigation
Conversation
Copy WorkerSource hints into bundle module definitions and use the shared V8 callback when compiling without a code cache. Keep installed and shared code caches ahead of hints, and let hinted compilation populate the shared cache for subsequent isolates. Preserve producer precedence so validation observes executed functions rather than supplied hints. Cover input ownership, both cache paths, and Worker registry construction.
There was a problem hiding this comment.
💬 Approved with comments — The code change is correct and covered by tests. One INFO note: the documentation states the isolate-cache precedence more broadly than the code applies it.
Findings: 1 info
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
📝 Documentation: 💬 1 info
The cache precedence statement is broader than the implementation.
Recommendation: 💬 Optional Nits
- [INFO] The docs say an installed isolate code cache takes precedence, but
getDescriptor()uses it only for modules with acodeCacheKey(modules-new.c++:250-255). Consider limiting the statement to keyed modules. (docs/reference/detail/new-module-registry.md:205)
View full review
docs/reference/detail/new-module-registry.md:205: The docs say an installed isolate code cache always takes precedence. In the code,EsModule::getDescriptor()uses the isolate cache only for modules that have acodeCacheKey(modules-new.c++:250-255). Modules without a key fall through to the shared cache or to hinted compilation even when an isolate cache is installed. Consider saying that this precedence applies to keyed modules.
✅ All other checks passed
🔒 Security: ✅ LGTM
No security issues. Compile hints are source positions only. The sorted lookup reads only the position values and never uses them to access the source buffer.
📖 AGENTS.md: ✅ LGTM
No issues found. The new comments and docs describe the current behaviour and follow the repository's comment guidelines.
📋 Code Quality: ✅ LGTM
The hint copies are owned by the module definition, so they outlive the source bundle. Cache precedence and producer precedence are preserved, and error handling stays the same in both registries.
⚡ Performance: ✅ LGTM
No performance concerns. Hints are copied once per module definition and are not used on code-cache paths.
Reviewed commit: ed597ac6
Bundle ES modules in the new module registry should eagerly compile the functions named by supplied compile hints when no code cache takes precedence. #7758 added this for the legacy registry; the new registry dropped
WorkerSource::EsModule::compileHintswhen building module definitions and compiled without the V8 hint callback, so stored hints had no effect for Workers usingnew_module_registry.Copy the hints into the shared module definition during registry construction and use the legacy registry’s sorted-position callback for bundle compilation. Owning the positions before the source bundle is released keeps them valid through lazy module resolution and across isolate replicas. The shared helper retains each registry’s existing compilation-error handling and reports consumption through the existing observer hook.
An installed isolate code cache keeps precedence on both misses and hits, and the shared module cache keeps precedence when no isolate store is installed. A hinted compilation can populate the shared cache for subsequent isolates. Hint production, added in #7917, still bypasses both caches and supplied hints so validation observes the functions that actually execute. Missing hints preserve ordinary compilation, and built-in modules do not consume bundle hints.