Closed
Description
Following up on #21405
-
Better integrity check when using the code cache insimply relying on V8 to do the checks is fineNativeModule.prototype.compile
(right nowSerializedCodeData::SourceHash
returnssource->length()
) e.g. calculating the checksums of the source code in both js2c and the code cache generator and compare them before using the cache. See build: speed up startup with V8 code cache #21405 (comment) - build: create V8 code cache after script is run #21567: Use
script.createCachedData
to generate the code cache after the builtin modules haverunInThisContext()
, so that the cache of the lazily compiled inner functions are also included (right now only the top level function is included in the cache),see build: speed up startup with V8 code cache #21405 (comment) . We may need to include the code cache generator in core or expose the scripts to user land. - Cache
internal/bootstrap/loaders.js
andinternal/bootstrap/node.js
(these two are compiled in C++): src: use NativeModuleLoader to compile all the bootstrappers #24775 -
(might be related if we still use JS to generate the cache) Add support for the full range ofit's not using the JS land function anymoreCompileOptions
(and possiblyNoCacheReason
) toContextifyScript
/vm.Script
Long-term action items
- Refactors
node.js
and/ornode.cc
so that we can create something like amkcodecache
(similar tomksnapshot
) target instead of generating the code cache with a user-land JS script tools: implement mkcodecache as an executable #27135 - Resolve the dependency issue automatically in build files: make sure when the inputs to
node_js2c
is modified, the cache will be regenerated and compiled the next time Node.js is built withnode_code_cache_path
build,tools: use mkcodecache to add code cache to the binaries #27161 - Integrate the code-cached build into default workflow and releases and make sure a test like
test-code-cache
is run in the release CI to make sure we don't have a ~100% performance regression of startup time:build: build release/CI on non-Windows with code cache #22934build,tools: use mkcodecache to add code cache to the binaries #27161