diff options
-rw-r--r-- | src/async_wrap.cc | 22 | ||||
-rw-r--r-- | src/async_wrap.h | 2 | ||||
-rw-r--r-- | src/handle_wrap.cc | 11 | ||||
-rw-r--r-- | src/handle_wrap.h | 2 | ||||
-rw-r--r-- | src/inspector_js_api.cc | 30 | ||||
-rw-r--r-- | src/node_buffer.cc | 39 | ||||
-rw-r--r-- | src/node_credentials.cc | 22 | ||||
-rw-r--r-- | src/node_env_var.cc | 11 | ||||
-rw-r--r-- | src/node_errors.cc | 12 | ||||
-rw-r--r-- | src/node_external_reference.h | 33 | ||||
-rw-r--r-- | src/node_i18n.cc | 13 | ||||
-rw-r--r-- | src/node_i18n.h | 1 | ||||
-rw-r--r-- | src/node_main_instance.cc | 4 | ||||
-rw-r--r-- | src/node_messaging.cc | 18 | ||||
-rw-r--r-- | src/node_process_methods.cc | 29 | ||||
-rw-r--r-- | src/node_task_queue.cc | 10 | ||||
-rw-r--r-- | src/node_trace_events.cc | 16 | ||||
-rw-r--r-- | src/node_types.cc | 11 | ||||
-rw-r--r-- | src/node_url.cc | 11 | ||||
-rw-r--r-- | src/node_util.cc | 21 | ||||
-rw-r--r-- | src/string_decoder.cc | 9 | ||||
-rw-r--r-- | src/timers.cc | 12 | ||||
-rw-r--r-- | tools/snapshot/snapshot_builder.cc | 2 |
23 files changed, 326 insertions, 15 deletions
diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 09775db79a..3e4cbbbcbb 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -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) diff --git a/src/async_wrap.h b/src/async_wrap.h index e202314331..f0e49c3df2 100644 --- a/src/async_wrap.h +++ b/src/async_wrap.h @@ -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, diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 4e039d5dbf..e573698446 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -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) diff --git a/src/handle_wrap.h b/src/handle_wrap.h index 4134b28bfc..47eef32940 100644 --- a/src/handle_wrap.h +++ b/src/handle_wrap.h @@ -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, diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index c318f78646..12569e9791 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -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) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 2028849775..b2fa0ef201 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -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) diff --git a/src/node_credentials.cc b/src/node_credentials.cc index 83db705e10..acc48cac3c 100644 --- a/src/node_credentials.cc +++ b/src/node_credentials.cc @@ -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) diff --git a/src/node_env_var.cc b/src/node_env_var.cc index 1a162888fd..1cf959a609 100644 --- a/src/node_env_var.cc +++ b/src/node_env_var.cc @@ -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) diff --git a/src/node_errors.cc b/src/node_errors.cc index 813bc3fd8e..dc6d20b500 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -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) diff --git a/src/node_external_reference.h b/src/node_external_reference.h index 8c97eca226..f332103c3f 100644 --- a/src/node_external_reference.h +++ b/src/node_external_reference.h @@ -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 diff --git a/src/node_i18n.cc b/src/node_i18n.cc index cc2d245b8a..48f95ceb68 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -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 diff --git a/src/node_i18n.h b/src/node_i18n.h index 5c1501ea19..22164e6647 100644 --- a/src/node_i18n.h +++ b/src/node_i18n.h @@ -36,7 +36,6 @@ #include <string> namespace node { - namespace i18n { bool InitializeICUDirectory(const std::string& path); diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc index 617a71e7ca..14e0d49ce9 100644 --- a/src/node_main_instance.cc +++ b/src/node_main_instance.cc @@ -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); diff --git a/src/node_messaging.cc b/src/node_messaging.cc index 3da2358ce8..add851e083 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -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) diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index e714cdd30f..105cbff151 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -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) diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc index 3c7d9bae08..9a22cabded 100644 --- a/src/node_task_queue.cc +++ b/src/node_task_queue.cc @@ -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) diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc index 58813a9083..9cefaa9227 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc @@ -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) diff --git a/src/node_types.cc b/src/node_types.cc index 9643a66668..1889d8c304 100644 --- a/src/node_types.cc +++ b/src/node_types.cc @@ -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) diff --git a/src/node_url.cc b/src/node_url.cc index a4549ea4b8..efab1060f8 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -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) diff --git a/src/node_util.cc b/src/node_util.cc index 22a372ad09..44148ba2b0 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -1,6 +1,7 @@ +#include "base_object-inl.h" #include "node_errors.h" +#include "node_external_reference.h" #include "util-inl.h" -#include "base_object-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) diff --git a/src/string_decoder.cc b/src/string_decoder.cc index 6ec84e0e11..a25c903987 100644 --- a/src/string_decoder.cc +++ b/src/string_decoder.cc @@ -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) diff --git a/src/timers.cc b/src/timers.cc index fab1b12018..5014f2c66a 100644 --- a/src/timers.cc +++ b/src/timers.cc @@ -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) diff --git a/tools/snapshot/snapshot_builder.cc b/tools/snapshot/snapshot_builder.cc index 3642027111..94fe160414 100644 --- a/tools/snapshot/snapshot_builder.cc +++ b/tools/snapshot/snapshot_builder.cc @@ -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); |