src: make BuiltinLoader threadsafe and non-global
(Current first commit is https://github.com/nodejs/node/pull/46119)
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.