mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
src: make BuiltinLoader threadsafe and non-global
As discussed in https://github.com/nodejs/node/pull/45888, using a global `BuiltinLoader` instance is probably undesirable in a world in which embedders are able to create Node.js Environments with different sources and therefore mutually incompatible code caching properties. This PR makes it so that `BuiltinLoader` is no longer a global singleton and instead only shared between `Environment`s that have a direct relation to each other, and addresses a few thread safety issues along with that. PR-URL: https://github.com/nodejs/node/pull/45942 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
1 parent
5d560978ff
commit
d896f5befd
15 files changed
+347
-173
No files matched your search
@@ -159,6 +159,11 @@ NodeMainInstance::CreateMainEnvironment(ExitCode* exit_code) {
|
||||
&(snapshot_data_->env_info),
|
||||
EnvironmentFlags::kDefaultFlags,
|
||||
{}));
|
||||
#ifdef NODE_V8_SHARED_RO_HEAP
|
||||
// TODO(addaleax): Do this as part of creating the Environment
|
||||
// once we store the SnapshotData* itself on IsolateData.
|
||||
env->builtin_loader()->RefreshCodeCache(snapshot_data_->code_cache);
|
||||
#endif
|
||||
context = Context::FromSnapshot(isolate_,
|
||||
SnapshotData::kNodeMainContextIndex,
|
||||
{DeserializeNodeInternalFields, env.get()})
|
||||
|
||||
Reference in new issue
Block a user