diff options
author | Michaël Zasso <targos@protonmail.com> | 2021-08-02 10:01:01 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-08-02 20:37:51 +0300 |
commit | 3091295609988ccb4a492a446581da0f9ada6fad (patch) | |
tree | 3c3d80f5b1e912b63e023b5616feb3607b6462fc | |
parent | 06d7b8e8c86221fd98960a061ad2daac9f9acb5e (diff) |
deps: revert ABI-breaking change from V8 9.2
Refs: https://github.com/v8/v8/commit/a7980d43e030ba4bdb36813d4bc99f85982bf4ee
Refs: https://github.com/v8/v8/commit/ad4eab00e7ec96730eb2c1b6ddcef14ba2e4becd
Fixes: https://github.com/nodejs/node/issues/39623
PR-URL: https://github.com/nodejs/node/pull/39624
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
-rw-r--r-- | common.gypi | 2 | ||||
-rw-r--r-- | deps/v8/include/v8.h | 11 | ||||
-rw-r--r-- | deps/v8/src/api/api.cc | 14 |
3 files changed, 24 insertions, 3 deletions
diff --git a/common.gypi b/common.gypi index 88764c8f6b7..d4f1d425f83 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.18', + 'v8_embedder_string': '-node.19', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index cbdca19367d..101e3c8accf 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -6798,6 +6798,17 @@ class V8_EXPORT FunctionTemplate : public Template { void SetCallHandler( FunctionCallback callback, Local<Value> data = Local<Value>(), SideEffectType side_effect_type = SideEffectType::kHasSideEffect, + const CFunction* c_function = nullptr); + + /** + * Set the call-handler callback for a FunctionTemplate. This + * callback is called whenever the function created from this + * FunctionTemplate is called. The 'c_function' represents a fast + * API call, see the comment above the class declaration. + */ + void SetCallHandlerV8_92( + FunctionCallback callback, Local<Value> data = Local<Value>(), + SideEffectType side_effect_type = SideEffectType::kHasSideEffect, const MemorySpan<const CFunction>& c_function_overloads = {}); /** Set the predefined length property for the FunctionTemplate. */ diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index 2c1223afedc..031d4244f7f 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -1244,8 +1244,8 @@ static Local<FunctionTemplate> FunctionTemplateNew( if (behavior == ConstructorBehavior::kThrow) raw.set_remove_prototype(true); } if (callback != nullptr) { - Utils::ToLocal(obj)->SetCallHandler(callback, data, side_effect_type, - c_function_overloads); + Utils::ToLocal(obj)->SetCallHandlerV8_92(callback, data, side_effect_type, + c_function_overloads); } return Utils::ToLocal(obj); } @@ -1310,6 +1310,16 @@ Local<AccessorSignature> AccessorSignature::New( void FunctionTemplate::SetCallHandler( FunctionCallback callback, v8::Local<Value> data, SideEffectType side_effect_type, + const CFunction* c_function) { + SetCallHandlerV8_92( + callback, data, side_effect_type, + c_function ? MemorySpan<const CFunction>{c_function, 1} + : MemorySpan<const CFunction>{}); +} + +void FunctionTemplate::SetCallHandlerV8_92( + FunctionCallback callback, v8::Local<Value> data, + SideEffectType side_effect_type, const MemorySpan<const CFunction>& c_function_overloads) { auto info = Utils::OpenHandle(this); EnsureNotPublished(info, "v8::FunctionTemplate::SetCallHandler"); |