src: fix external reference registration for new CFunction lifetime

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/7828135
Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63679
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Joyee Cheung authored and GitHub committed 2026-06-02 14:33:56 +00:00
1 parent 93ab3c72ab
commit 0401a2d083
2 files changed
+3 -1

No files matched your search

+2
View File
@@ -42,6 +42,8 @@ class ExternalReferenceRegistry {
// Registers both the underlying function pointer
// and the corresponding CFunctionInfo.
void Register(const v8::CFunction& c_func) {
RegisterT(&c_func);
// TODO(joyeecheung): remove below when V8 14.8 lands.
RegisterT(c_func.GetAddress());
RegisterT(c_func.GetTypeInfo());
}
+1 -1
View File
@@ -234,7 +234,7 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) {
template <typename FT, FT F, typename R, typename... Args>
void WASI::WasiFunction<FT, F, R, Args...>::SetFunction(
Environment* env, const char* name, Local<FunctionTemplate> tmpl) {
auto c_function = CFunction::Make(FastCallback);
static auto c_function = CFunction::Make(FastCallback);
Local<FunctionTemplate> t =
FunctionTemplate::New(env->isolate(),
SlowCallback,