|
v8
9.0.257(node16.0.0)
V8 is Google's open source JavaScript engine
|
Go to the documentation of this file.
184 #ifndef INCLUDE_V8_FAST_API_CALLS_H_
185 #define INCLUDE_V8_FAST_API_CALLS_H_
219 : type_(type), flags_(flags) {}
275 template <
typename T>
278 #define SPECIALIZE_GET_C_TYPE_FOR(ctype, ctypeinfo)
280 struct GetCType<ctype> {
281 static constexpr CTypeInfo Get() {
282 return CTypeInfo(CTypeInfo::Type::ctypeinfo);
286 #define SUPPORTED_C_TYPES(V)
295 V(ApiObject, kV8Value)
307 template <
typename T,
typename... List>
309 template <
typename T,
typename... Args>
312 template <
typename T,
typename U,
typename... Args>
315 template <
typename R,
typename... Args>
322 : return_info_(
internal::GetCType<R>::Get()),
324 arg_info_{
internal::GetCType<Args>::Get()...} {
326 "Only one options parameter is supported.");
328 "The receiver or the fallback argument is missing.");
336 "64-bit int and api object values are not currently "
337 "supported return types.");
346 return arg_info_[index];
352 const unsigned int arg_count_;
353 const CTypeInfo arg_info_[
sizeof...(Args)];
360 constexpr CFunction() : address_(
nullptr), type_info_(
nullptr) {}
373 template <
typename F>
375 return ArgUnwrap<F*>::Make(func);
378 template <
typename F>
381 return ArgUnwrap<F*>::Make(func);
384 template <
typename F>
386 return CFunction(
reinterpret_cast<
const void*>(func), type_info);
390 const void* address_;
393 CFunction(
const void* address,
const CFunctionInfo* type_info);
395 template <
typename R,
typename... Args>
401 template <
typename F>
403 static_assert(
sizeof(F) !=
sizeof(F),
404 "CFunction must be created from a function pointer.");
407 template <
typename R,
typename... Args>
408 class ArgUnwrap<R (*)(Args...)> {
410 static CFunction Make(R (*func)(Args...)) {
411 return CFunction(
reinterpret_cast<
const void*>(func),
412 GetCFunctionInfo<R, Args...>());
virtual const CTypeInfo & ArgumentInfo(unsigned int index) const =0
virtual const CTypeInfo & ReturnInfo() const =0
constexpr CTypeInfo(Type type, ArgFlags flags=ArgFlags::kNone)
static CFunction Make(F *func)
static CFunction Make(F *func, const CFunctionInfo *type_info)
unsigned int ArgumentCount() const override
#define SUPPORTED_C_TYPES(V)
virtual bool HasOptions() const =0
static const CTypeInfo & Invalid()
const CTypeInfo & ArgumentInfo(unsigned int index) const override
const CTypeInfo & ReturnInfo() const
static CFunction MakeWithFallbackSupport(F *func)
const void * GetAddress() const
constexpr ArgFlags GetFlags() const
static constexpr int kReceiverCount
static constexpr CTypeInfo Get()
#define V8_DEPRECATED(message)
virtual unsigned int ArgumentCount() const =0
static constexpr int kOptionsArgCount
const CTypeInfo & ArgumentInfo(unsigned int index) const
unsigned int ArgumentCount() const
const CTypeInfo & ReturnInfo() const override
static constexpr Type kInvalidType
static constexpr Type kCallbackOptionsType
bool HasOptions() const override
constexpr Type GetType() const
const CFunctionInfo * GetTypeInfo() const