/src/node/src/node_realm-inl.h
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef SRC_NODE_REALM_INL_H_ |
2 | | #define SRC_NODE_REALM_INL_H_ |
3 | | |
4 | | #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
5 | | |
6 | | #include "cleanup_queue-inl.h" |
7 | | #include "node_realm.h" |
8 | | |
9 | | namespace node { |
10 | | |
11 | 0 | inline Realm* Realm::GetCurrent(v8::Isolate* isolate) { |
12 | 0 | if (UNLIKELY(!isolate->InContext())) return nullptr; |
13 | 0 | v8::HandleScope handle_scope(isolate); |
14 | 0 | return GetCurrent(isolate->GetCurrentContext()); |
15 | 0 | } |
16 | | |
17 | 18.0M | inline Realm* Realm::GetCurrent(v8::Local<v8::Context> context) { |
18 | 18.0M | if (UNLIKELY(!ContextEmbedderTag::IsNodeContext(context))) return nullptr; |
19 | 18.0M | return static_cast<Realm*>( |
20 | 18.0M | context->GetAlignedPointerFromEmbedderData(ContextEmbedderIndex::kRealm)); |
21 | 18.0M | } |
22 | | |
23 | | inline Realm* Realm::GetCurrent( |
24 | 16.4M | const v8::FunctionCallbackInfo<v8::Value>& info) { |
25 | 16.4M | return GetCurrent(info.GetIsolate()->GetCurrentContext()); |
26 | 16.4M | } |
27 | | |
28 | | template <typename T> |
29 | | inline Realm* Realm::GetCurrent(const v8::PropertyCallbackInfo<T>& info) { |
30 | | return GetCurrent(info.GetIsolate()->GetCurrentContext()); |
31 | | } |
32 | | |
33 | 6.15M | inline IsolateData* Realm::isolate_data() const { |
34 | 6.15M | return env_->isolate_data(); |
35 | 6.15M | } |
36 | | |
37 | 26.3M | inline Environment* Realm::env() const { |
38 | 26.3M | return env_; |
39 | 26.3M | } |
40 | | |
41 | 36.7M | inline v8::Isolate* Realm::isolate() const { |
42 | 36.7M | return isolate_; |
43 | 36.7M | } |
44 | | |
45 | 225k | inline Realm::Kind Realm::kind() const { |
46 | 225k | return kind_; |
47 | 225k | } |
48 | | |
49 | 1.13M | inline bool Realm::has_run_bootstrapping_code() const { |
50 | 1.13M | return has_run_bootstrapping_code_; |
51 | 1.13M | } |
52 | | |
53 | | // static |
54 | | template <typename T, typename U> |
55 | | inline T* Realm::GetBindingData(const v8::PropertyCallbackInfo<U>& info) { |
56 | | return GetBindingData<T>(info.GetIsolate()->GetCurrentContext()); |
57 | | } |
58 | | |
59 | | // static |
60 | | template <typename T> |
61 | | inline T* Realm::GetBindingData( |
62 | 9.46k | const v8::FunctionCallbackInfo<v8::Value>& info) { |
63 | 9.46k | return GetBindingData<T>(info.GetIsolate()->GetCurrentContext()); |
64 | 9.46k | } node::fs::BindingData* node::Realm::GetBindingData<node::fs::BindingData>(v8::FunctionCallbackInfo<v8::Value> const&) Line | Count | Source | 62 | 4.83k | const v8::FunctionCallbackInfo<v8::Value>& info) { | 63 | 4.83k | return GetBindingData<T>(info.GetIsolate()->GetCurrentContext()); | 64 | 4.83k | } |
node_http_parser.cc:node::(anonymous namespace)::BindingData* node::Realm::GetBindingData<node::(anonymous namespace)::BindingData>(v8::FunctionCallbackInfo<v8::Value> const&) Line | Count | Source | 62 | 1.22k | const v8::FunctionCallbackInfo<v8::Value>& info) { | 63 | 1.22k | return GetBindingData<T>(info.GetIsolate()->GetCurrentContext()); | 64 | 1.22k | } |
Unexecuted instantiation: node::http2::Http2State* node::Realm::GetBindingData<node::http2::Http2State>(v8::FunctionCallbackInfo<v8::Value> const&) Unexecuted instantiation: node::v8_utils::BindingData* node::Realm::GetBindingData<node::v8_utils::BindingData>(v8::FunctionCallbackInfo<v8::Value> const&) node::timers::BindingData* node::Realm::GetBindingData<node::timers::BindingData>(v8::FunctionCallbackInfo<v8::Value> const&) Line | Count | Source | 62 | 3.39k | const v8::FunctionCallbackInfo<v8::Value>& info) { | 63 | 3.39k | return GetBindingData<T>(info.GetIsolate()->GetCurrentContext()); | 64 | 3.39k | } |
|
65 | | |
66 | | // static |
67 | | template <typename T> |
68 | 9.46k | inline T* Realm::GetBindingData(v8::Local<v8::Context> context) { |
69 | 9.46k | Realm* realm = GetCurrent(context); |
70 | 9.46k | return realm->GetBindingData<T>(); |
71 | 9.46k | } node::fs::BindingData* node::Realm::GetBindingData<node::fs::BindingData>(v8::Local<v8::Context>) Line | Count | Source | 68 | 4.83k | inline T* Realm::GetBindingData(v8::Local<v8::Context> context) { | 69 | 4.83k | Realm* realm = GetCurrent(context); | 70 | 4.83k | return realm->GetBindingData<T>(); | 71 | 4.83k | } |
node_http_parser.cc:node::(anonymous namespace)::BindingData* node::Realm::GetBindingData<node::(anonymous namespace)::BindingData>(v8::Local<v8::Context>) Line | Count | Source | 68 | 1.22k | inline T* Realm::GetBindingData(v8::Local<v8::Context> context) { | 69 | 1.22k | Realm* realm = GetCurrent(context); | 70 | 1.22k | return realm->GetBindingData<T>(); | 71 | 1.22k | } |
Unexecuted instantiation: node::http2::Http2State* node::Realm::GetBindingData<node::http2::Http2State>(v8::Local<v8::Context>) Unexecuted instantiation: node::v8_utils::BindingData* node::Realm::GetBindingData<node::v8_utils::BindingData>(v8::Local<v8::Context>) node::timers::BindingData* node::Realm::GetBindingData<node::timers::BindingData>(v8::Local<v8::Context>) Line | Count | Source | 68 | 3.39k | inline T* Realm::GetBindingData(v8::Local<v8::Context> context) { | 69 | 3.39k | Realm* realm = GetCurrent(context); | 70 | 3.39k | return realm->GetBindingData<T>(); | 71 | 3.39k | } |
|
72 | | |
73 | | template <typename T> |
74 | 10.4k | inline T* Realm::GetBindingData() { |
75 | 10.4k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); |
76 | 10.4k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); |
77 | 10.4k | auto ptr = binding_data_store_[binding_index]; |
78 | 10.4k | if (UNLIKELY(!ptr)) return nullptr; |
79 | 10.4k | T* result = static_cast<T*>(ptr.get()); |
80 | 10.4k | DCHECK_NOT_NULL(result); |
81 | 10.4k | return result; |
82 | 10.4k | } Unexecuted instantiation: node::BlobBindingData* node::Realm::GetBindingData<node::BlobBindingData>() node::fs::BindingData* node::Realm::GetBindingData<node::fs::BindingData>() Line | Count | Source | 74 | 5.80k | inline T* Realm::GetBindingData() { | 75 | 5.80k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 76 | 5.80k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 77 | 5.80k | auto ptr = binding_data_store_[binding_index]; | 78 | 5.80k | if (UNLIKELY(!ptr)) return nullptr; | 79 | 5.80k | T* result = static_cast<T*>(ptr.get()); | 80 | 5.80k | DCHECK_NOT_NULL(result); | 81 | 5.80k | return result; | 82 | 5.80k | } |
node_http_parser.cc:node::(anonymous namespace)::BindingData* node::Realm::GetBindingData<node::(anonymous namespace)::BindingData>() Line | Count | Source | 74 | 1.22k | inline T* Realm::GetBindingData() { | 75 | 1.22k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 76 | 1.22k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 77 | 1.22k | auto ptr = binding_data_store_[binding_index]; | 78 | 1.22k | if (UNLIKELY(!ptr)) return nullptr; | 79 | 1.22k | T* result = static_cast<T*>(ptr.get()); | 80 | 1.22k | DCHECK_NOT_NULL(result); | 81 | 1.22k | return result; | 82 | 1.22k | } |
Unexecuted instantiation: node::http2::Http2State* node::Realm::GetBindingData<node::http2::Http2State>() node::modules::BindingData* node::Realm::GetBindingData<node::modules::BindingData>() Line | Count | Source | 74 | 3 | inline T* Realm::GetBindingData() { | 75 | 3 | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 76 | 3 | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 77 | 3 | auto ptr = binding_data_store_[binding_index]; | 78 | 3 | if (UNLIKELY(!ptr)) return nullptr; | 79 | 3 | T* result = static_cast<T*>(ptr.get()); | 80 | 3 | DCHECK_NOT_NULL(result); | 81 | 3 | return result; | 82 | 3 | } |
node::url::BindingData* node::Realm::GetBindingData<node::url::BindingData>() Line | Count | Source | 74 | 6 | inline T* Realm::GetBindingData() { | 75 | 6 | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 76 | 6 | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 77 | 6 | auto ptr = binding_data_store_[binding_index]; | 78 | 6 | if (UNLIKELY(!ptr)) return nullptr; | 79 | 6 | T* result = static_cast<T*>(ptr.get()); | 80 | 6 | DCHECK_NOT_NULL(result); | 81 | 6 | return result; | 82 | 6 | } |
Unexecuted instantiation: node::v8_utils::BindingData* node::Realm::GetBindingData<node::v8_utils::BindingData>() node::timers::BindingData* node::Realm::GetBindingData<node::timers::BindingData>() Line | Count | Source | 74 | 3.39k | inline T* Realm::GetBindingData() { | 75 | 3.39k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 76 | 3.39k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 77 | 3.39k | auto ptr = binding_data_store_[binding_index]; | 78 | 3.39k | if (UNLIKELY(!ptr)) return nullptr; | 79 | 3.39k | T* result = static_cast<T*>(ptr.get()); | 80 | 3.39k | DCHECK_NOT_NULL(result); | 81 | 3.39k | return result; | 82 | 3.39k | } |
Unexecuted instantiation: node::encoding_binding::BindingData* node::Realm::GetBindingData<node::encoding_binding::BindingData>() Unexecuted instantiation: node::quic::BindingData* node::Realm::GetBindingData<node::quic::BindingData>() |
83 | | |
84 | | template <typename T, typename... Args> |
85 | 1.07M | inline T* Realm::AddBindingData(v8::Local<v8::Object> target, Args&&... args) { |
86 | | // This won't compile if T is not a BaseObject subclass. |
87 | 1.07M | static_assert(std::is_base_of_v<BaseObject, T>); |
88 | | // The binding data must be weak so that it won't keep the realm reachable |
89 | | // from strong GC roots indefinitely. The wrapper object of binding data |
90 | | // should be referenced from JavaScript, thus the binding data should be |
91 | | // reachable throughout the lifetime of the realm. |
92 | 1.07M | BaseObjectWeakPtr<T> item = |
93 | 1.07M | MakeWeakBaseObject<T>(this, target, std::forward<Args>(args)...); |
94 | 1.07M | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); |
95 | 1.07M | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); |
96 | | // Each slot is expected to be assigned only once. |
97 | 1.07M | CHECK(!binding_data_store_[binding_index]); |
98 | 1.07M | binding_data_store_[binding_index] = item; |
99 | 1.07M | return item.get(); |
100 | 1.07M | } node::BlobBindingData* node::Realm::AddBindingData<node::BlobBindingData>(v8::Local<v8::Object>) Line | Count | Source | 85 | 134k | inline T* Realm::AddBindingData(v8::Local<v8::Object> target, Args&&... args) { | 86 | | // This won't compile if T is not a BaseObject subclass. | 87 | 134k | static_assert(std::is_base_of_v<BaseObject, T>); | 88 | | // The binding data must be weak so that it won't keep the realm reachable | 89 | | // from strong GC roots indefinitely. The wrapper object of binding data | 90 | | // should be referenced from JavaScript, thus the binding data should be | 91 | | // reachable throughout the lifetime of the realm. | 92 | 134k | BaseObjectWeakPtr<T> item = | 93 | 134k | MakeWeakBaseObject<T>(this, target, std::forward<Args>(args)...); | 94 | 134k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 95 | 134k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 96 | | // Each slot is expected to be assigned only once. | 97 | 134k | CHECK(!binding_data_store_[binding_index]); | 98 | 134k | binding_data_store_[binding_index] = item; | 99 | 134k | return item.get(); | 100 | 134k | } |
node::fs::BindingData* node::Realm::AddBindingData<node::fs::BindingData>(v8::Local<v8::Object>) Line | Count | Source | 85 | 134k | inline T* Realm::AddBindingData(v8::Local<v8::Object> target, Args&&... args) { | 86 | | // This won't compile if T is not a BaseObject subclass. | 87 | 134k | static_assert(std::is_base_of_v<BaseObject, T>); | 88 | | // The binding data must be weak so that it won't keep the realm reachable | 89 | | // from strong GC roots indefinitely. The wrapper object of binding data | 90 | | // should be referenced from JavaScript, thus the binding data should be | 91 | | // reachable throughout the lifetime of the realm. | 92 | 134k | BaseObjectWeakPtr<T> item = | 93 | 134k | MakeWeakBaseObject<T>(this, target, std::forward<Args>(args)...); | 94 | 134k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 95 | 134k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 96 | | // Each slot is expected to be assigned only once. | 97 | 134k | CHECK(!binding_data_store_[binding_index]); | 98 | 134k | binding_data_store_[binding_index] = item; | 99 | 134k | return item.get(); | 100 | 134k | } |
Unexecuted instantiation: node::fs::BindingData* node::Realm::AddBindingData<node::fs::BindingData, node::fs::BindingData::InternalFieldInfo*&>(v8::Local<v8::Object>, node::fs::BindingData::InternalFieldInfo*&) node_http_parser.cc:node::(anonymous namespace)::BindingData* node::Realm::AddBindingData<node::(anonymous namespace)::BindingData>(v8::Local<v8::Object>) Line | Count | Source | 85 | 2.07k | inline T* Realm::AddBindingData(v8::Local<v8::Object> target, Args&&... args) { | 86 | | // This won't compile if T is not a BaseObject subclass. | 87 | 2.07k | static_assert(std::is_base_of_v<BaseObject, T>); | 88 | | // The binding data must be weak so that it won't keep the realm reachable | 89 | | // from strong GC roots indefinitely. The wrapper object of binding data | 90 | | // should be referenced from JavaScript, thus the binding data should be | 91 | | // reachable throughout the lifetime of the realm. | 92 | 2.07k | BaseObjectWeakPtr<T> item = | 93 | 2.07k | MakeWeakBaseObject<T>(this, target, std::forward<Args>(args)...); | 94 | 2.07k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 95 | 2.07k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 96 | | // Each slot is expected to be assigned only once. | 97 | 2.07k | CHECK(!binding_data_store_[binding_index]); | 98 | 2.07k | binding_data_store_[binding_index] = item; | 99 | 2.07k | return item.get(); | 100 | 2.07k | } |
Unexecuted instantiation: node::http2::Http2State* node::Realm::AddBindingData<node::http2::Http2State>(v8::Local<v8::Object>) node::modules::BindingData* node::Realm::AddBindingData<node::modules::BindingData>(v8::Local<v8::Object>) Line | Count | Source | 85 | 134k | inline T* Realm::AddBindingData(v8::Local<v8::Object> target, Args&&... args) { | 86 | | // This won't compile if T is not a BaseObject subclass. | 87 | 134k | static_assert(std::is_base_of_v<BaseObject, T>); | 88 | | // The binding data must be weak so that it won't keep the realm reachable | 89 | | // from strong GC roots indefinitely. The wrapper object of binding data | 90 | | // should be referenced from JavaScript, thus the binding data should be | 91 | | // reachable throughout the lifetime of the realm. | 92 | 134k | BaseObjectWeakPtr<T> item = | 93 | 134k | MakeWeakBaseObject<T>(this, target, std::forward<Args>(args)...); | 94 | 134k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 95 | 134k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 96 | | // Each slot is expected to be assigned only once. | 97 | 134k | CHECK(!binding_data_store_[binding_index]); | 98 | 134k | binding_data_store_[binding_index] = item; | 99 | 134k | return item.get(); | 100 | 134k | } |
node::process::BindingData* node::Realm::AddBindingData<node::process::BindingData>(v8::Local<v8::Object>) Line | Count | Source | 85 | 134k | inline T* Realm::AddBindingData(v8::Local<v8::Object> target, Args&&... args) { | 86 | | // This won't compile if T is not a BaseObject subclass. | 87 | 134k | static_assert(std::is_base_of_v<BaseObject, T>); | 88 | | // The binding data must be weak so that it won't keep the realm reachable | 89 | | // from strong GC roots indefinitely. The wrapper object of binding data | 90 | | // should be referenced from JavaScript, thus the binding data should be | 91 | | // reachable throughout the lifetime of the realm. | 92 | 134k | BaseObjectWeakPtr<T> item = | 93 | 134k | MakeWeakBaseObject<T>(this, target, std::forward<Args>(args)...); | 94 | 134k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 95 | 134k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 96 | | // Each slot is expected to be assigned only once. | 97 | 134k | CHECK(!binding_data_store_[binding_index]); | 98 | 134k | binding_data_store_[binding_index] = item; | 99 | 134k | return item.get(); | 100 | 134k | } |
Unexecuted instantiation: node::process::BindingData* node::Realm::AddBindingData<node::process::BindingData, node::process::BindingData::InternalFieldInfo*&>(v8::Local<v8::Object>, node::process::BindingData::InternalFieldInfo*&) Unexecuted instantiation: node::mksnapshot::BindingData* node::Realm::AddBindingData<node::mksnapshot::BindingData, node::mksnapshot::BindingData::InternalFieldInfo*&>(v8::Local<v8::Object>, node::mksnapshot::BindingData::InternalFieldInfo*&) node::mksnapshot::BindingData* node::Realm::AddBindingData<node::mksnapshot::BindingData>(v8::Local<v8::Object>) Line | Count | Source | 85 | 134k | inline T* Realm::AddBindingData(v8::Local<v8::Object> target, Args&&... args) { | 86 | | // This won't compile if T is not a BaseObject subclass. | 87 | 134k | static_assert(std::is_base_of_v<BaseObject, T>); | 88 | | // The binding data must be weak so that it won't keep the realm reachable | 89 | | // from strong GC roots indefinitely. The wrapper object of binding data | 90 | | // should be referenced from JavaScript, thus the binding data should be | 91 | | // reachable throughout the lifetime of the realm. | 92 | 134k | BaseObjectWeakPtr<T> item = | 93 | 134k | MakeWeakBaseObject<T>(this, target, std::forward<Args>(args)...); | 94 | 134k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 95 | 134k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 96 | | // Each slot is expected to be assigned only once. | 97 | 134k | CHECK(!binding_data_store_[binding_index]); | 98 | 134k | binding_data_store_[binding_index] = item; | 99 | 134k | return item.get(); | 100 | 134k | } |
node::url::BindingData* node::Realm::AddBindingData<node::url::BindingData>(v8::Local<v8::Object>) Line | Count | Source | 85 | 134k | inline T* Realm::AddBindingData(v8::Local<v8::Object> target, Args&&... args) { | 86 | | // This won't compile if T is not a BaseObject subclass. | 87 | 134k | static_assert(std::is_base_of_v<BaseObject, T>); | 88 | | // The binding data must be weak so that it won't keep the realm reachable | 89 | | // from strong GC roots indefinitely. The wrapper object of binding data | 90 | | // should be referenced from JavaScript, thus the binding data should be | 91 | | // reachable throughout the lifetime of the realm. | 92 | 134k | BaseObjectWeakPtr<T> item = | 93 | 134k | MakeWeakBaseObject<T>(this, target, std::forward<Args>(args)...); | 94 | 134k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 95 | 134k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 96 | | // Each slot is expected to be assigned only once. | 97 | 134k | CHECK(!binding_data_store_[binding_index]); | 98 | 134k | binding_data_store_[binding_index] = item; | 99 | 134k | return item.get(); | 100 | 134k | } |
Unexecuted instantiation: node::v8_utils::BindingData* node::Realm::AddBindingData<node::v8_utils::BindingData, node::v8_utils::BindingData::InternalFieldInfo*&>(v8::Local<v8::Object>, node::v8_utils::BindingData::InternalFieldInfo*&) Unexecuted instantiation: node::v8_utils::BindingData* node::Realm::AddBindingData<node::v8_utils::BindingData>(v8::Local<v8::Object>) node::timers::BindingData* node::Realm::AddBindingData<node::timers::BindingData>(v8::Local<v8::Object>) Line | Count | Source | 85 | 134k | inline T* Realm::AddBindingData(v8::Local<v8::Object> target, Args&&... args) { | 86 | | // This won't compile if T is not a BaseObject subclass. | 87 | 134k | static_assert(std::is_base_of_v<BaseObject, T>); | 88 | | // The binding data must be weak so that it won't keep the realm reachable | 89 | | // from strong GC roots indefinitely. The wrapper object of binding data | 90 | | // should be referenced from JavaScript, thus the binding data should be | 91 | | // reachable throughout the lifetime of the realm. | 92 | 134k | BaseObjectWeakPtr<T> item = | 93 | 134k | MakeWeakBaseObject<T>(this, target, std::forward<Args>(args)...); | 94 | 134k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 95 | 134k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 96 | | // Each slot is expected to be assigned only once. | 97 | 134k | CHECK(!binding_data_store_[binding_index]); | 98 | 134k | binding_data_store_[binding_index] = item; | 99 | 134k | return item.get(); | 100 | 134k | } |
Unexecuted instantiation: node::encoding_binding::BindingData* node::Realm::AddBindingData<node::encoding_binding::BindingData, node::encoding_binding::BindingData::InternalFieldInfo*&>(v8::Local<v8::Object>, node::encoding_binding::BindingData::InternalFieldInfo*&) node::encoding_binding::BindingData* node::Realm::AddBindingData<node::encoding_binding::BindingData>(v8::Local<v8::Object>) Line | Count | Source | 85 | 134k | inline T* Realm::AddBindingData(v8::Local<v8::Object> target, Args&&... args) { | 86 | | // This won't compile if T is not a BaseObject subclass. | 87 | 134k | static_assert(std::is_base_of_v<BaseObject, T>); | 88 | | // The binding data must be weak so that it won't keep the realm reachable | 89 | | // from strong GC roots indefinitely. The wrapper object of binding data | 90 | | // should be referenced from JavaScript, thus the binding data should be | 91 | | // reachable throughout the lifetime of the realm. | 92 | 134k | BaseObjectWeakPtr<T> item = | 93 | 134k | MakeWeakBaseObject<T>(this, target, std::forward<Args>(args)...); | 94 | 134k | constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int); | 95 | 134k | static_assert(binding_index < std::tuple_size_v<BindingDataStore>); | 96 | | // Each slot is expected to be assigned only once. | 97 | 134k | CHECK(!binding_data_store_[binding_index]); | 98 | 134k | binding_data_store_[binding_index] = item; | 99 | 134k | return item.get(); | 100 | 134k | } |
Unexecuted instantiation: node::quic::BindingData* node::Realm::AddBindingData<node::quic::BindingData>(v8::Local<v8::Object>) |
101 | | |
102 | 0 | inline BindingDataStore* Realm::binding_data_store() { |
103 | 0 | return &binding_data_store_; |
104 | 0 | } |
105 | | |
106 | | template <typename T> |
107 | 0 | void Realm::ForEachBaseObject(T&& iterator) const { |
108 | 0 | cleanup_queue_.ForEachBaseObject(std::forward<T>(iterator)); |
109 | 0 | } Unexecuted instantiation: node_realm.cc:void node::Realm::ForEachBaseObject<node::Realm::PrintInfoForSnapshot()::$_0>(node::Realm::PrintInfoForSnapshot()::$_0&&) const Unexecuted instantiation: node_realm.cc:void node::Realm::ForEachBaseObject<node::Realm::VerifyNoStrongBaseObjects()::$_0>(node::Realm::VerifyNoStrongBaseObjects()::$_0&&) const Unexecuted instantiation: node_snapshotable.cc:void node::Realm::ForEachBaseObject<node::SerializeSnapshotableObjects(node::Realm*, v8::SnapshotCreator*, node::RealmSerializeInfo*)::$_0>(node::SerializeSnapshotableObjects(node::Realm*, v8::SnapshotCreator*, node::RealmSerializeInfo*)::$_0&&) const |
110 | | |
111 | 2.38M | void Realm::modify_base_object_count(int64_t delta) { |
112 | 2.38M | base_object_count_ += delta; |
113 | 2.38M | } |
114 | | |
115 | 0 | int64_t Realm::base_object_created_after_bootstrap() const { |
116 | 0 | return base_object_count_ - base_object_created_by_bootstrap_; |
117 | 0 | } |
118 | | |
119 | 0 | int64_t Realm::base_object_count() const { |
120 | 0 | return base_object_count_; |
121 | 0 | } |
122 | | |
123 | 1.19M | void Realm::AddCleanupHook(CleanupQueue::Callback fn, void* arg) { |
124 | 1.19M | cleanup_queue_.Add(fn, arg); |
125 | 1.19M | } |
126 | | |
127 | 1.19M | void Realm::RemoveCleanupHook(CleanupQueue::Callback fn, void* arg) { |
128 | 1.19M | cleanup_queue_.Remove(fn, arg); |
129 | 1.19M | } |
130 | | |
131 | 134k | bool Realm::HasCleanupHooks() const { |
132 | 134k | return !cleanup_queue_.empty(); |
133 | 134k | } |
134 | | |
135 | | } // namespace node |
136 | | |
137 | | #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
138 | | |
139 | | #endif // SRC_NODE_REALM_INL_H_ |