deps: revert ABI-breaking change from V8 9.2

Refs: a7980d43e0
Refs: ad4eab00e7
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>
This commit is contained in:
Michaël Zasso 2021-08-02 09:01:01 +02:00
parent 06d7b8e8c8
commit 3091295609
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
3 changed files with 24 additions and 3 deletions

View File

@ -36,7 +36,7 @@
# Reset this number to 0 on major V8 upgrades. # Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8. # 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 ##### ##### V8 defaults for Node.js #####

11
deps/v8/include/v8.h vendored
View File

@ -6796,6 +6796,17 @@ class V8_EXPORT FunctionTemplate : public Template {
* API call, see the comment above the class declaration. * API call, see the comment above the class declaration.
*/ */
void SetCallHandler( 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>(), FunctionCallback callback, Local<Value> data = Local<Value>(),
SideEffectType side_effect_type = SideEffectType::kHasSideEffect, SideEffectType side_effect_type = SideEffectType::kHasSideEffect,
const MemorySpan<const CFunction>& c_function_overloads = {}); const MemorySpan<const CFunction>& c_function_overloads = {});

View File

@ -1244,8 +1244,8 @@ static Local<FunctionTemplate> FunctionTemplateNew(
if (behavior == ConstructorBehavior::kThrow) raw.set_remove_prototype(true); if (behavior == ConstructorBehavior::kThrow) raw.set_remove_prototype(true);
} }
if (callback != nullptr) { if (callback != nullptr) {
Utils::ToLocal(obj)->SetCallHandler(callback, data, side_effect_type, Utils::ToLocal(obj)->SetCallHandlerV8_92(callback, data, side_effect_type,
c_function_overloads); c_function_overloads);
} }
return Utils::ToLocal(obj); return Utils::ToLocal(obj);
} }
@ -1308,6 +1308,16 @@ Local<AccessorSignature> AccessorSignature::New(
} while (false) } while (false)
void FunctionTemplate::SetCallHandler( 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, FunctionCallback callback, v8::Local<Value> data,
SideEffectType side_effect_type, SideEffectType side_effect_type,
const MemorySpan<const CFunction>& c_function_overloads) { const MemorySpan<const CFunction>& c_function_overloads) {