From 41e105b29438499ec024820b4bbfc6797cbf9311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 2 Aug 2021 09:01:01 +0200 Subject: [PATCH] deps: revert ABI-breaking change from V8 9.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Antoine du Hamel Reviewed-By: Gireesh Punathil Reviewed-By: Beth Griggs Reviewed-By: Richard Lau Reviewed-By: Gerhard Stöbich --- common.gypi | 2 +- deps/v8/include/v8.h | 11 +++++++++++ deps/v8/src/api/api.cc | 14 ++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/common.gypi b/common.gypi index 88764c8f6b75a8..d4f1d425f83958 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 cbdca19367d766..101e3c8accfa07 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -6796,6 +6796,17 @@ class V8_EXPORT FunctionTemplate : public Template { * API call, see the comment above the class declaration. */ void SetCallHandler( + FunctionCallback callback, Local data = Local(), + 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 data = Local(), SideEffectType side_effect_type = SideEffectType::kHasSideEffect, const MemorySpan& c_function_overloads = {}); diff --git a/deps/v8/src/api/api.cc b/deps/v8/src/api/api.cc index 2c1223afedc5c0..031d4244f7f80b 100644 --- a/deps/v8/src/api/api.cc +++ b/deps/v8/src/api/api.cc @@ -1244,8 +1244,8 @@ static Local 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); } @@ -1308,6 +1308,16 @@ Local AccessorSignature::New( } while (false) void FunctionTemplate::SetCallHandler( + FunctionCallback callback, v8::Local data, + SideEffectType side_effect_type, + const CFunction* c_function) { + SetCallHandlerV8_92( + callback, data, side_effect_type, + c_function ? MemorySpan{c_function, 1} + : MemorySpan{}); +} + +void FunctionTemplate::SetCallHandlerV8_92( FunctionCallback callback, v8::Local data, SideEffectType side_effect_type, const MemorySpan& c_function_overloads) {