src: snapshot loaders

This runs `lib/internal/bootstrap/loaders.js` before creating
the builtin snapshot and deserialize the loaders from the
snapshot in deserialization mode.

PR-URL: https://github.com/nodejs/node/pull/32984
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
This commit is contained in:
Joyee Cheung committed 2020-07-18 11:23:15 +08:00
1 parent 7ecb285842
commit 0b8ae5f2cd
6 files changed
+39 -3

No files matched your search

+8 -1
View File
@@ -259,10 +259,17 @@ NodeMainInstance::CreateMainEnvironment(int* exit_code,
env->InitializeInspector({});
#endif
if (env->RunBootstrapping().IsEmpty()) {
if (!deserialize_mode_ && env->RunBootstrapping().IsEmpty()) {
return nullptr;
}
if (deserialize_mode_ && env->BootstrapNode().IsEmpty()) {
return nullptr;
}
CHECK(env->req_wrap_queue()->IsEmpty());
CHECK(env->handle_wrap_queue()->IsEmpty());
env->set_has_run_bootstrapping_code(true);
return env;
}