Skip to content

Commit

Permalink
deps: revert ABI-breaking change from V8 9.2
Browse files Browse the repository at this point in the history
Refs: v8/v8@a7980d4
Refs: v8/v8@ad4eab0
Fixes: #39623

PR-URL: #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>
  • Loading branch information
targos committed Aug 2, 2021
1 parent c6efb63 commit 41e105b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####

Expand Down
11 changes: 11 additions & 0 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -6796,6 +6796,17 @@ class V8_EXPORT FunctionTemplate : public Template {
* API call, see the comment above the class declaration.
*/
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 = {});
Expand Down
14 changes: 12 additions & 2 deletions deps/v8/src/api/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -1308,6 +1308,16 @@ Local<AccessorSignature> AccessorSignature::New(
} while (false)

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) {
Expand Down

0 comments on commit 41e105b

Please sign in to comment.