Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
deps: revert ABI-breaking change from V8 9.2
  • Loading branch information
targos committed Aug 2, 2021
commit f2def6f79af1bfd414305a1f69df8aee5b2acfdc
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