src: snapshot node
This runs `lib/internal/bootstrap/node.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:
parent
b1c3909bd7
commit
7a447bcd54
@ -23,6 +23,7 @@
|
||||
#include "async_wrap-inl.h"
|
||||
#include "env-inl.h"
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "tracing/traced_value.h"
|
||||
#include "util-inl.h"
|
||||
|
||||
@ -695,6 +696,25 @@ void AsyncWrap::Initialize(Local<Object> target,
|
||||
PromiseWrap::Initialize(env);
|
||||
}
|
||||
|
||||
void AsyncWrap::RegisterExternalReferences(
|
||||
ExternalReferenceRegistry* registry) {
|
||||
registry->Register(SetupHooks);
|
||||
registry->Register(SetCallbackTrampoline);
|
||||
registry->Register(PushAsyncContext);
|
||||
registry->Register(PopAsyncContext);
|
||||
registry->Register(ExecutionAsyncResource);
|
||||
registry->Register(ClearAsyncIdStack);
|
||||
registry->Register(QueueDestroyAsyncId);
|
||||
registry->Register(EnablePromiseHook);
|
||||
registry->Register(DisablePromiseHook);
|
||||
registry->Register(RegisterDestroyHook);
|
||||
registry->Register(AsyncWrapObject::New);
|
||||
registry->Register(AsyncWrap::GetAsyncId);
|
||||
registry->Register(AsyncWrap::AsyncReset);
|
||||
registry->Register(AsyncWrap::GetProviderType);
|
||||
registry->Register(PromiseWrap::GetAsyncId);
|
||||
registry->Register(PromiseWrap::GetTriggerAsyncId);
|
||||
}
|
||||
|
||||
AsyncWrap::AsyncWrap(Environment* env,
|
||||
Local<Object> object,
|
||||
@ -924,3 +944,5 @@ Local<Object> AsyncWrap::GetOwner(Environment* env, Local<Object> obj) {
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(async_wrap, node::AsyncWrap::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(async_wrap,
|
||||
node::AsyncWrap::RegisterExternalReferences)
|
||||
|
@ -106,6 +106,7 @@ namespace node {
|
||||
|
||||
class Environment;
|
||||
class DestroyParam;
|
||||
class ExternalReferenceRegistry;
|
||||
|
||||
class AsyncWrap : public BaseObject {
|
||||
public:
|
||||
@ -135,6 +136,7 @@ class AsyncWrap : public BaseObject {
|
||||
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
|
||||
Environment* env);
|
||||
|
||||
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
||||
static void Initialize(v8::Local<v8::Object> target,
|
||||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "handle_wrap.h"
|
||||
#include "async_wrap-inl.h"
|
||||
#include "env-inl.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "util-inl.h"
|
||||
|
||||
namespace node {
|
||||
@ -152,5 +153,15 @@ Local<FunctionTemplate> HandleWrap::GetConstructorTemplate(Environment* env) {
|
||||
return tmpl;
|
||||
}
|
||||
|
||||
void HandleWrap::RegisterExternalReferences(
|
||||
ExternalReferenceRegistry* registry) {
|
||||
registry->Register(HandleWrap::Close);
|
||||
registry->Register(HandleWrap::HasRef);
|
||||
registry->Register(HandleWrap::Ref);
|
||||
registry->Register(HandleWrap::Unref);
|
||||
}
|
||||
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(handle_wrap,
|
||||
node::HandleWrap::RegisterExternalReferences)
|
||||
|
@ -32,6 +32,7 @@
|
||||
namespace node {
|
||||
|
||||
class Environment;
|
||||
class ExternalReferenceRegistry;
|
||||
|
||||
// Rules:
|
||||
//
|
||||
@ -77,6 +78,7 @@ class HandleWrap : public AsyncWrap {
|
||||
|
||||
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
|
||||
Environment* env);
|
||||
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
||||
|
||||
protected:
|
||||
HandleWrap(Environment* env,
|
||||
|
@ -2,9 +2,10 @@
|
||||
#include "inspector_agent.h"
|
||||
#include "inspector_io.h"
|
||||
#include "memory_tracker-inl.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "util-inl.h"
|
||||
#include "v8.h"
|
||||
#include "v8-inspector.h"
|
||||
#include "v8.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -345,8 +346,35 @@ void Initialize(Local<Object> target, Local<Value> unused,
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(InspectorConsoleCall);
|
||||
registry->Register(SetConsoleExtensionInstaller);
|
||||
registry->Register(CallAndPauseOnStart);
|
||||
registry->Register(Open);
|
||||
registry->Register(Url);
|
||||
registry->Register(WaitForDebugger);
|
||||
|
||||
registry->Register(AsyncTaskScheduledWrapper);
|
||||
registry->Register(InvokeAsyncTaskFnWithId<&Agent::AsyncTaskCanceled>);
|
||||
registry->Register(InvokeAsyncTaskFnWithId<&Agent::AsyncTaskStarted>);
|
||||
registry->Register(InvokeAsyncTaskFnWithId<&Agent::AsyncTaskFinished>);
|
||||
|
||||
registry->Register(RegisterAsyncHookWrapper);
|
||||
registry->Register(IsEnabled);
|
||||
|
||||
registry->Register(JSBindingsConnection<LocalConnection>::New);
|
||||
registry->Register(JSBindingsConnection<LocalConnection>::Dispatch);
|
||||
registry->Register(JSBindingsConnection<LocalConnection>::Disconnect);
|
||||
registry->Register(JSBindingsConnection<MainThreadConnection>::New);
|
||||
registry->Register(JSBindingsConnection<MainThreadConnection>::Dispatch);
|
||||
registry->Register(JSBindingsConnection<MainThreadConnection>::Disconnect);
|
||||
}
|
||||
|
||||
} // namespace inspector
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(inspector,
|
||||
node::inspector::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(inspector,
|
||||
node::inspector::RegisterExternalReferences)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "allocated_buffer-inl.h"
|
||||
#include "node.h"
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_internals.h"
|
||||
|
||||
#include "env-inl.h"
|
||||
@ -1197,7 +1198,45 @@ void Initialize(Local<Object> target,
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(SetBufferPrototype);
|
||||
registry->Register(CreateFromString);
|
||||
|
||||
registry->Register(ByteLengthUtf8);
|
||||
registry->Register(Copy);
|
||||
registry->Register(Compare);
|
||||
registry->Register(CompareOffset);
|
||||
registry->Register(Fill);
|
||||
registry->Register(IndexOfBuffer);
|
||||
registry->Register(IndexOfNumber);
|
||||
registry->Register(IndexOfString);
|
||||
|
||||
registry->Register(Swap16);
|
||||
registry->Register(Swap32);
|
||||
registry->Register(Swap64);
|
||||
|
||||
registry->Register(EncodeInto);
|
||||
registry->Register(EncodeUtf8String);
|
||||
|
||||
registry->Register(StringSlice<ASCII>);
|
||||
registry->Register(StringSlice<BASE64>);
|
||||
registry->Register(StringSlice<LATIN1>);
|
||||
registry->Register(StringSlice<HEX>);
|
||||
registry->Register(StringSlice<UCS2>);
|
||||
registry->Register(StringSlice<UTF8>);
|
||||
|
||||
registry->Register(StringWrite<ASCII>);
|
||||
registry->Register(StringWrite<BASE64>);
|
||||
registry->Register(StringWrite<LATIN1>);
|
||||
registry->Register(StringWrite<HEX>);
|
||||
registry->Register(StringWrite<UCS2>);
|
||||
registry->Register(StringWrite<UTF8>);
|
||||
registry->Register(GetZeroFillToggle);
|
||||
}
|
||||
|
||||
} // namespace Buffer
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(buffer, node::Buffer::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(buffer, node::Buffer::RegisterExternalReferences)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "env-inl.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_internals.h"
|
||||
#include "util-inl.h"
|
||||
|
||||
@ -371,6 +372,25 @@ static void InitGroups(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
#endif // NODE_IMPLEMENTS_POSIX_CREDENTIALS
|
||||
|
||||
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(SafeGetenv);
|
||||
|
||||
#ifdef NODE_IMPLEMENTS_POSIX_CREDENTIALS
|
||||
registry->Register(GetUid);
|
||||
registry->Register(GetEUid);
|
||||
registry->Register(GetGid);
|
||||
registry->Register(GetEGid);
|
||||
registry->Register(GetGroups);
|
||||
|
||||
registry->Register(InitGroups);
|
||||
registry->Register(SetEGid);
|
||||
registry->Register(SetEUid);
|
||||
registry->Register(SetGid);
|
||||
registry->Register(SetUid);
|
||||
registry->Register(SetGroups);
|
||||
#endif // NODE_IMPLEMENTS_POSIX_CREDENTIALS
|
||||
}
|
||||
|
||||
static void Initialize(Local<Object> target,
|
||||
Local<Value> unused,
|
||||
Local<Context> context,
|
||||
@ -403,3 +423,5 @@ static void Initialize(Local<Object> target,
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(credentials, node::credentials::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(credentials,
|
||||
node::credentials::RegisterExternalReferences)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "debug_utils-inl.h"
|
||||
#include "env-inl.h"
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_process.h"
|
||||
|
||||
#include <time.h> // tzset(), _tzset()
|
||||
@ -384,4 +385,14 @@ MaybeLocal<Object> CreateEnvVarProxy(Local<Context> context, Isolate* isolate) {
|
||||
PropertyHandlerFlags::kHasNoSideEffect));
|
||||
return scope.EscapeMaybe(env_proxy_template->NewInstance(context));
|
||||
}
|
||||
|
||||
void RegisterEnvVarExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(EnvGetter);
|
||||
registry->Register(EnvSetter);
|
||||
registry->Register(EnvQuery);
|
||||
registry->Register(EnvDeleter);
|
||||
registry->Register(EnvEnumerator);
|
||||
}
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(env_var, node::RegisterEnvVarExternalReferences)
|
||||
|
@ -3,9 +3,10 @@
|
||||
|
||||
#include "debug_utils-inl.h"
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_internals.h"
|
||||
#include "node_report.h"
|
||||
#include "node_process.h"
|
||||
#include "node_report.h"
|
||||
#include "node_v8_platform-inl.h"
|
||||
#include "util-inl.h"
|
||||
|
||||
@ -852,6 +853,14 @@ static void TriggerUncaughtException(const FunctionCallbackInfo<Value>& args) {
|
||||
errors::TriggerUncaughtException(isolate, exception, message, from_promise);
|
||||
}
|
||||
|
||||
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(SetPrepareStackTraceCallback);
|
||||
registry->Register(EnableSourceMaps);
|
||||
registry->Register(SetEnhanceStackForFatalException);
|
||||
registry->Register(NoSideEffectsToString);
|
||||
registry->Register(TriggerUncaughtException);
|
||||
}
|
||||
|
||||
void Initialize(Local<Object> target,
|
||||
Local<Value> unused,
|
||||
Local<Context> context,
|
||||
@ -1023,3 +1032,4 @@ void TriggerUncaughtException(Isolate* isolate, const v8::TryCatch& try_catch) {
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(errors, node::errors::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(errors, node::errors::RegisterExternalReferences)
|
||||
|
@ -47,12 +47,41 @@ class ExternalReferenceRegistry {
|
||||
};
|
||||
|
||||
#define EXTERNAL_REFERENCE_BINDING_LIST_BASE(V) \
|
||||
V(async_wrap) \
|
||||
V(binding) \
|
||||
V(buffer) \
|
||||
V(credentials) \
|
||||
V(env_var) \
|
||||
V(errors) \
|
||||
V(handle_wrap) \
|
||||
V(messaging) \
|
||||
V(native_module) \
|
||||
V(process_object)
|
||||
V(process_methods) \
|
||||
V(process_object) \
|
||||
V(task_queue) \
|
||||
V(url) \
|
||||
V(util) \
|
||||
V(string_decoder) \
|
||||
V(trace_events) \
|
||||
V(timers) \
|
||||
V(types)
|
||||
|
||||
#if NODE_HAVE_I18N_SUPPORT
|
||||
#define EXTERNAL_REFERENCE_BINDING_LIST_I18N(V) V(icu)
|
||||
#else
|
||||
#define EXTERNAL_REFERENCE_BINDING_LIST_I18N(V)
|
||||
#endif // NODE_HAVE_I18N_SUPPORT
|
||||
|
||||
#if HAVE_INSPECTOR
|
||||
#define EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V) V(inspector)
|
||||
#else
|
||||
#define EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V)
|
||||
#endif // HAVE_INSPECTOR
|
||||
|
||||
#define EXTERNAL_REFERENCE_BINDING_LIST(V) \
|
||||
EXTERNAL_REFERENCE_BINDING_LIST_BASE(V)
|
||||
EXTERNAL_REFERENCE_BINDING_LIST_BASE(V) \
|
||||
EXTERNAL_REFERENCE_BINDING_LIST_INSPECTOR(V) \
|
||||
EXTERNAL_REFERENCE_BINDING_LIST_I18N(V)
|
||||
|
||||
} // namespace node
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
|
||||
#include "node_i18n.h"
|
||||
#include "node_external_reference.h"
|
||||
|
||||
#if defined(NODE_HAVE_I18N_SUPPORT)
|
||||
|
||||
@ -824,9 +825,21 @@ void Initialize(Local<Object> target,
|
||||
env->SetMethod(target, "hasConverter", ConverterObject::Has);
|
||||
}
|
||||
|
||||
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(ToUnicode);
|
||||
registry->Register(ToASCII);
|
||||
registry->Register(GetStringWidth);
|
||||
registry->Register(ICUErrorName);
|
||||
registry->Register(Transcode);
|
||||
registry->Register(ConverterObject::Create);
|
||||
registry->Register(ConverterObject::Decode);
|
||||
registry->Register(ConverterObject::Has);
|
||||
}
|
||||
|
||||
} // namespace i18n
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(icu, node::i18n::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(icu, node::i18n::RegisterExternalReferences)
|
||||
|
||||
#endif // NODE_HAVE_I18N_SUPPORT
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include <string>
|
||||
|
||||
namespace node {
|
||||
|
||||
namespace i18n {
|
||||
|
||||
bool InitializeICUDirectory(const std::string& path);
|
||||
|
@ -263,10 +263,6 @@ NodeMainInstance::CreateMainEnvironment(int* exit_code,
|
||||
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);
|
||||
|
@ -3,9 +3,10 @@
|
||||
#include "async_wrap-inl.h"
|
||||
#include "debug_utils-inl.h"
|
||||
#include "memory_tracker-inl.h"
|
||||
#include "node_contextify.h"
|
||||
#include "node_buffer.h"
|
||||
#include "node_contextify.h"
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_process.h"
|
||||
#include "util-inl.h"
|
||||
|
||||
@ -1352,9 +1353,24 @@ static void InitMessaging(Local<Object> target,
|
||||
}
|
||||
}
|
||||
|
||||
static void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(MessageChannel);
|
||||
registry->Register(JSTransferable::New);
|
||||
registry->Register(MessagePort::New);
|
||||
registry->Register(MessagePort::PostMessage);
|
||||
registry->Register(MessagePort::Start);
|
||||
registry->Register(MessagePort::Stop);
|
||||
registry->Register(MessagePort::Drain);
|
||||
registry->Register(MessagePort::ReceiveMessage);
|
||||
registry->Register(MessagePort::MoveToContext);
|
||||
registry->Register(SetDeserializerCreateObjectFunction);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
} // namespace worker
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(messaging, node::worker::InitMessaging)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(messaging,
|
||||
node::worker::RegisterExternalReferences)
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "memory_tracker-inl.h"
|
||||
#include "node.h"
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_internals.h"
|
||||
#include "node_process.h"
|
||||
#include "util-inl.h"
|
||||
@ -547,6 +548,32 @@ static void InitializeProcessMethods(Local<Object> target,
|
||||
env->SetMethod(target, "getFastAPIs", GetFastAPIs);
|
||||
}
|
||||
|
||||
void RegisterProcessMethodsExternalReferences(
|
||||
ExternalReferenceRegistry* registry) {
|
||||
registry->Register(DebugProcess);
|
||||
registry->Register(DebugEnd);
|
||||
registry->Register(Abort);
|
||||
registry->Register(CauseSegfault);
|
||||
registry->Register(Chdir);
|
||||
|
||||
registry->Register(Umask);
|
||||
registry->Register(RawDebug);
|
||||
registry->Register(MemoryUsage);
|
||||
registry->Register(CPUUsage);
|
||||
registry->Register(ResourceUsage);
|
||||
|
||||
registry->Register(GetActiveRequests);
|
||||
registry->Register(GetActiveHandles);
|
||||
registry->Register(Kill);
|
||||
|
||||
registry->Register(Cwd);
|
||||
registry->Register(binding::DLOpen);
|
||||
registry->Register(ReallyExit);
|
||||
registry->Register(Uptime);
|
||||
registry->Register(PatchProcessObject);
|
||||
registry->Register(GetFastAPIs);
|
||||
}
|
||||
|
||||
} // namespace node
|
||||
|
||||
namespace v8 {
|
||||
@ -562,3 +589,5 @@ class WrapperTraits<node::FastHrtime> {
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(process_methods,
|
||||
node::InitializeProcessMethods)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(process_methods,
|
||||
node::RegisterProcessMethodsExternalReferences)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "env-inl.h"
|
||||
#include "node.h"
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_internals.h"
|
||||
#include "node_process.h"
|
||||
#include "util-inl.h"
|
||||
@ -145,7 +146,16 @@ static void Initialize(Local<Object> target,
|
||||
SetPromiseRejectCallback);
|
||||
}
|
||||
|
||||
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(EnqueueMicrotask);
|
||||
registry->Register(SetTickCallback);
|
||||
registry->Register(RunMicrotasks);
|
||||
registry->Register(SetPromiseRejectCallback);
|
||||
}
|
||||
|
||||
} // namespace task_queue
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(task_queue, node::task_queue::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(task_queue,
|
||||
node::task_queue::RegisterExternalReferences)
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "env-inl.h"
|
||||
#include "memory_tracker-inl.h"
|
||||
#include "node.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_internals.h"
|
||||
#include "node_v8_platform-inl.h"
|
||||
#include "tracing/agent.h"
|
||||
@ -12,6 +13,8 @@
|
||||
|
||||
namespace node {
|
||||
|
||||
class ExternalReferenceRegistry;
|
||||
|
||||
using v8::Array;
|
||||
using v8::Context;
|
||||
using v8::Function;
|
||||
@ -29,7 +32,7 @@ class NodeCategorySet : public BaseObject {
|
||||
Local<Value> unused,
|
||||
Local<Context> context,
|
||||
void* priv);
|
||||
|
||||
static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
|
||||
static void New(const FunctionCallbackInfo<Value>& args);
|
||||
static void Enable(const FunctionCallbackInfo<Value>& args);
|
||||
static void Disable(const FunctionCallbackInfo<Value>& args);
|
||||
@ -154,7 +157,18 @@ void NodeCategorySet::Initialize(Local<Object> target,
|
||||
binding->Get(context, trace).ToLocalChecked()).Check();
|
||||
}
|
||||
|
||||
void NodeCategorySet::RegisterExternalReferences(
|
||||
ExternalReferenceRegistry* registry) {
|
||||
registry->Register(GetEnabledCategories);
|
||||
registry->Register(SetTraceCategoryStateUpdateHandler);
|
||||
registry->Register(NodeCategorySet::New);
|
||||
registry->Register(NodeCategorySet::Enable);
|
||||
registry->Register(NodeCategorySet::Disable);
|
||||
}
|
||||
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(trace_events,
|
||||
node::NodeCategorySet::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(
|
||||
trace_events, node::NodeCategorySet::RegisterExternalReferences)
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "env-inl.h"
|
||||
#include "node.h"
|
||||
#include "node_external_reference.h"
|
||||
|
||||
using v8::Context;
|
||||
using v8::FunctionCallbackInfo;
|
||||
@ -77,6 +78,16 @@ void InitializeTypes(Local<Object> target,
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void RegisterTypesExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
#define V(type) registry->Register(Is##type);
|
||||
VALUE_METHOD_MAP(V)
|
||||
#undef V
|
||||
|
||||
registry->Register(IsAnyArrayBuffer);
|
||||
registry->Register(IsBoxedPrimitive);
|
||||
}
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(types, node::InitializeTypes)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(types, node::RegisterTypesExternalReferences)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "node_url.h"
|
||||
#include "base_object-inl.h"
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "node_i18n.h"
|
||||
#include "util-inl.h"
|
||||
|
||||
@ -2325,6 +2326,15 @@ void Initialize(Local<Object> target,
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(Parse);
|
||||
registry->Register(EncodeAuthSet);
|
||||
registry->Register(ToUSVString);
|
||||
registry->Register(DomainToASCII);
|
||||
registry->Register(DomainToUnicode);
|
||||
registry->Register(SetURLConstructor);
|
||||
}
|
||||
|
||||
std::string URL::ToFilePath() const {
|
||||
if (context_.scheme != "file:") {
|
||||
return "";
|
||||
@ -2446,3 +2456,4 @@ MaybeLocal<Value> URL::ToObject(Environment* env) const {
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(url, node::url::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(url, node::url::RegisterExternalReferences)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "node_errors.h"
|
||||
#include "util-inl.h"
|
||||
#include "base_object-inl.h"
|
||||
#include "node_errors.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "util-inl.h"
|
||||
|
||||
namespace node {
|
||||
namespace util {
|
||||
@ -262,6 +263,23 @@ static void GuessHandleType(const FunctionCallbackInfo<Value>& args) {
|
||||
args.GetReturnValue().Set(OneByteString(env->isolate(), type));
|
||||
}
|
||||
|
||||
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(GetHiddenValue);
|
||||
registry->Register(SetHiddenValue);
|
||||
registry->Register(GetPromiseDetails);
|
||||
registry->Register(GetProxyDetails);
|
||||
registry->Register(PreviewEntries);
|
||||
registry->Register(GetOwnNonIndexProperties);
|
||||
registry->Register(GetConstructorName);
|
||||
registry->Register(Sleep);
|
||||
registry->Register(ArrayBufferViewHasBuffer);
|
||||
registry->Register(WeakReference::New);
|
||||
registry->Register(WeakReference::Get);
|
||||
registry->Register(WeakReference::IncRef);
|
||||
registry->Register(WeakReference::DecRef);
|
||||
registry->Register(GuessHandleType);
|
||||
}
|
||||
|
||||
void Initialize(Local<Object> target,
|
||||
Local<Value> unused,
|
||||
Local<Context> context,
|
||||
@ -339,3 +357,4 @@ void Initialize(Local<Object> target,
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(util, node::util::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(util, node::util::RegisterExternalReferences)
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "env-inl.h"
|
||||
#include "node_buffer.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "string_bytes.h"
|
||||
#include "util.h"
|
||||
|
||||
@ -322,7 +323,15 @@ void InitializeStringDecoder(Local<Object> target,
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void RegisterStringDecoderExternalReferences(
|
||||
ExternalReferenceRegistry* registry) {
|
||||
registry->Register(DecodeData);
|
||||
registry->Register(FlushData);
|
||||
}
|
||||
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(string_decoder,
|
||||
node::InitializeStringDecoder)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(string_decoder,
|
||||
node::RegisterStringDecoderExternalReferences)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "env-inl.h"
|
||||
#include "node_external_reference.h"
|
||||
#include "util-inl.h"
|
||||
#include "v8.h"
|
||||
|
||||
@ -57,9 +58,16 @@ void Initialize(Local<Object> target,
|
||||
FIXED_ONE_BYTE_STRING(env->isolate(), "immediateInfo"),
|
||||
env->immediate_info()->fields().GetJSArray()).Check();
|
||||
}
|
||||
|
||||
|
||||
} // anonymous namespace
|
||||
void RegisterTimerExternalReferences(ExternalReferenceRegistry* registry) {
|
||||
registry->Register(GetLibuvNow);
|
||||
registry->Register(SetupTimers);
|
||||
registry->Register(ScheduleTimer);
|
||||
registry->Register(ToggleTimerRef);
|
||||
registry->Register(ToggleImmediateRef);
|
||||
}
|
||||
|
||||
} // namespace node
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_INTERNAL(timers, node::Initialize)
|
||||
NODE_MODULE_EXTERNAL_REFERENCE(timers, node::RegisterTimerExternalReferences)
|
||||
|
@ -130,7 +130,7 @@ std::string SnapshotBuilder::Generate(
|
||||
nullptr,
|
||||
node::EnvironmentFlags::kDefaultFlags,
|
||||
{});
|
||||
env->BootstrapInternalLoaders().ToLocalChecked();
|
||||
env->RunBootstrapping().ToLocalChecked();
|
||||
if (per_process::enabled_debug_list.enabled(DebugCategory::MKSNAPSHOT)) {
|
||||
env->PrintAllBaseObjects();
|
||||
printf("Environment = %p\n", env);
|
||||
|
Loading…
x
Reference in New Issue
Block a user