Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: get binding data store directly from the realm #47437

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/node_realm-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ inline T* Realm::AddBindingData(v8::Local<v8::Context> context,
// This won't compile if T is not a BaseObject subclass.
BaseObjectPtr<T> item =
MakeDetachedBaseObject<T>(this, target, std::forward<Args>(args)...);
BindingDataStore* map =
static_cast<BindingDataStore*>(context->GetAlignedPointerFromEmbedderData(
ContextEmbedderIndex::kBindingDataStoreIndex));
DCHECK_NOT_NULL(map);
DCHECK_EQ(context->GetAlignedPointerFromEmbedderData(
ContextEmbedderIndex::kBindingDataStoreIndex),
&binding_data_store_);
constexpr size_t binding_index = static_cast<size_t>(T::binding_type_int);
static_assert(binding_index < std::tuple_size_v<BindingDataStore>);
CHECK(!(*map)[binding_index]); // Should not insert the binding twice.
(*map)[binding_index] = item;
// Should not insert the binding twice.
CHECK(!binding_data_store_[binding_index]);
binding_data_store_[binding_index] = item;
DCHECK_EQ(GetBindingData<T>(context), item.get());
return item.get();
}
Expand Down