summaryrefslogtreecommitdiff
path: root/src/node_snapshotable.cc
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2022-07-28 14:58:00 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2022-08-05 01:11:20 +0800
commit06f5d456472901b52811805f66f7bd6a7fd66d31 (patch)
treea6015c781dd43e56948704fa0aa5fa2fd4ce2893 /src/node_snapshotable.cc
parentb052bd4f18c6d79a80365ffb6333d4a0a347d715 (diff)
downloadnode-new-06f5d456472901b52811805f66f7bd6a7fd66d31.tar.gz
bootstrap: support more builtins in the embedded code cache
This patch: - Make NativeModuleLoader::LookupAndCompile() detect parameters based on module IDs. This allows us to compile more builtins when generating the embedded bootstrap, including - internal/per_context/* - internal/bootstrap/* - internal/main/* - Move pre_execution.js to lib/internal/process as it needs to be compiled as a regular built-in module, unlike other scripts in lib/internal/bootstrap - Move markBootstrapComplete() to the performance binding instead of making it a function-wrapper-based global to reduce number of special cases. PR-URL: https://github.com/nodejs/node/pull/44018 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_snapshotable.cc')
-rw-r--r--src/node_snapshotable.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc
index 0fb298814f..e11087f496 100644
--- a/src/node_snapshotable.cc
+++ b/src/node_snapshotable.cc
@@ -986,7 +986,8 @@ int SnapshotBuilder::Generate(SnapshotData* out,
#ifdef NODE_USE_NODE_CODE_CACHE
// Regenerate all the code cache.
- if (!native_module::NativeModuleLoader::CompileAllModules(main_context)) {
+ if (!native_module::NativeModuleLoader::CompileAllBuiltins(
+ main_context)) {
return UNCAUGHT_EXCEPTION_ERROR;
}
native_module::NativeModuleLoader::CopyCodeCache(&(out->code_cache));
@@ -1220,7 +1221,6 @@ void Initialize(Local<Object> target,
Local<Context> context,
void* priv) {
SetMethod(context, target, "compileSerializeMain", CompileSerializeMain);
- SetMethod(context, target, "markBootstrapComplete", MarkBootstrapComplete);
SetMethod(context, target, "setSerializeCallback", SetSerializeCallback);
SetMethod(context, target, "setDeserializeCallback", SetDeserializeCallback);
SetMethod(context,
@@ -1231,7 +1231,6 @@ void Initialize(Local<Object> target,
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(CompileSerializeMain);
- registry->Register(MarkBootstrapComplete);
registry->Register(SetSerializeCallback);
registry->Register(SetDeserializeCallback);
registry->Register(SetDeserializeMainFunction);