v8 11.3.244 (node 20.3.0)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
v8-fast-api-calls.h
Go to the documentation of this file.
1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
219#ifndef INCLUDE_V8_FAST_API_CALLS_H_
220#define INCLUDE_V8_FAST_API_CALLS_H_
221
222#include <stddef.h>
223#include <stdint.h>
224
225#include <tuple>
226#include <type_traits>
227
228#include "v8-internal.h" // NOLINT(build/include_directory)
229#include "v8-local-handle.h" // NOLINT(build/include_directory)
230#include "v8-typed-array.h" // NOLINT(build/include_directory)
231#include "v8-value.h" // NOLINT(build/include_directory)
232#include "v8config.h" // NOLINT(build/include_directory)
233
234namespace v8 {
235
236class Isolate;
237
239 public:
240 enum class Type : uint8_t {
241 kVoid,
242 kBool,
243 kUint8,
244 kInt32,
245 kUint32,
246 kInt64,
247 kUint64,
248 kFloat32,
249 kFloat64,
250 kPointer,
251 kV8Value,
253 kApiObject, // This will be deprecated once all users have
254 // migrated from v8::ApiObject to v8::Local<v8::Value>.
255 kAny, // This is added to enable untyped representation of fast
256 // call arguments for test purposes. It can represent any of
257 // the other types stored in the same memory as a union (see
258 // the AnyCType struct declared below). This allows for
259 // uniform passing of arguments w.r.t. their location
260 // (in a register or on the stack), independent of their
261 // actual type. It's currently used by the arm64 simulator
262 // and can be added to the other simulators as well when fast
263 // calls having both GP and FP params need to be supported.
264 };
265
266 // kCallbackOptionsType is not part of the Type enum
267 // because it is only used internally. Use value 255 that is larger
268 // than any valid Type enum.
269 static constexpr Type kCallbackOptionsType = Type(255);
270
271 enum class SequenceType : uint8_t {
272 kScalar,
273 kIsSequence, // sequence<T>
274 kIsTypedArray, // TypedArray of T or any ArrayBufferView if T
275 // is void
276 kIsArrayBuffer // ArrayBuffer
277 };
278
279 enum class Flags : uint8_t {
280 kNone = 0,
281 kAllowSharedBit = 1 << 0, // Must be an ArrayBuffer or TypedArray
282 kEnforceRangeBit = 1 << 1, // T must be integral
283 kClampBit = 1 << 2, // T must be integral
284 kIsRestrictedBit = 1 << 3, // T must be float or double
285 };
286
287 explicit constexpr CTypeInfo(
288 Type type, SequenceType sequence_type = SequenceType::kScalar,
289 Flags flags = Flags::kNone)
290 : type_(type), sequence_type_(sequence_type), flags_(flags) {}
291
292 typedef uint32_t Identifier;
293 explicit constexpr CTypeInfo(Identifier identifier)
294 : CTypeInfo(static_cast<Type>(identifier >> 16),
295 static_cast<SequenceType>((identifier >> 8) & 255),
296 static_cast<Flags>(identifier & 255)) {}
297 constexpr Identifier GetId() const {
298 return static_cast<uint8_t>(type_) << 16 |
299 static_cast<uint8_t>(sequence_type_) << 8 |
300 static_cast<uint8_t>(flags_);
301 }
302
303 constexpr Type GetType() const { return type_; }
304 constexpr SequenceType GetSequenceType() const { return sequence_type_; }
305 constexpr Flags GetFlags() const { return flags_; }
306
307 static constexpr bool IsIntegralType(Type type) {
308 return type == Type::kUint8 || type == Type::kInt32 ||
309 type == Type::kUint32 || type == Type::kInt64 ||
310 type == Type::kUint64;
311 }
312
313 static constexpr bool IsFloatingPointType(Type type) {
314 return type == Type::kFloat32 || type == Type::kFloat64;
315 }
316
317 static constexpr bool IsPrimitive(Type type) {
318 return IsIntegralType(type) || IsFloatingPointType(type) ||
319 type == Type::kBool;
320 }
321
322 private:
323 Type type_;
324 SequenceType sequence_type_;
325 Flags flags_;
326};
327
329 public:
330 // Returns the length in number of elements.
331 size_t V8_EXPORT length() const { return length_; }
332 // Checks whether the given index is within the bounds of the collection.
333 void V8_EXPORT ValidateIndex(size_t index) const;
334
335 protected:
336 size_t length_ = 0;
337};
338
339template <typename T>
341 public:
342 V8_INLINE T get(size_t index) const {
343#ifdef DEBUG
344 ValidateIndex(index);
345#endif // DEBUG
346 T tmp;
347 memcpy(&tmp, reinterpret_cast<T*>(data_) + index, sizeof(T));
348 return tmp;
349 }
350
351 bool getStorageIfAligned(T** elements) const {
352 if (reinterpret_cast<uintptr_t>(data_) % alignof(T) != 0) {
353 return false;
354 }
355 *elements = reinterpret_cast<T*>(data_);
356 return true;
357 }
358
359 private:
360 // This pointer should include the typed array offset applied.
361 // It's not guaranteed that it's aligned to sizeof(T), it's only
362 // guaranteed that it's 4-byte aligned, so for 8-byte types we need to
363 // provide a special implementation for reading from it, which hides
364 // the possibly unaligned read in the `get` method.
365 void* data_;
366};
367
368// Any TypedArray. It uses kTypedArrayBit with base type void
369// Overloaded args of ArrayBufferView and TypedArray are not supported
370// (for now) because the generic “any” ArrayBufferView doesn’t have its
371// own instance type. It could be supported if we specify that
372// TypedArray<T> always has precedence over the generic ArrayBufferView,
373// but this complicates overload resolution.
375 void* data;
377};
378
380 void* data;
382};
383
385 const char* data;
386 uint32_t length;
387};
388
390 public:
391 // Construct a struct to hold a CFunction's type information.
392 // |return_info| describes the function's return type.
393 // |arg_info| is an array of |arg_count| CTypeInfos describing the
394 // arguments. Only the last argument may be of the special type
395 // CTypeInfo::kCallbackOptionsType.
396 CFunctionInfo(const CTypeInfo& return_info, unsigned int arg_count,
397 const CTypeInfo* arg_info);
398
399 const CTypeInfo& ReturnInfo() const { return return_info_; }
400
401 // The argument count, not including the v8::FastApiCallbackOptions
402 // if present.
403 unsigned int ArgumentCount() const {
404 return HasOptions() ? arg_count_ - 1 : arg_count_;
405 }
406
407 // |index| must be less than ArgumentCount().
408 // Note: if the last argument passed on construction of CFunctionInfo
409 // has type CTypeInfo::kCallbackOptionsType, it is not included in
410 // ArgumentCount().
411 const CTypeInfo& ArgumentInfo(unsigned int index) const;
412
413 bool HasOptions() const {
414 // The options arg is always the last one.
415 return arg_count_ > 0 && arg_info_[arg_count_ - 1].GetType() ==
416 CTypeInfo::kCallbackOptionsType;
417 }
418
419 private:
420 const CTypeInfo return_info_;
421 const unsigned int arg_count_;
422 const CTypeInfo* arg_info_;
423};
424
425struct FastApiCallbackOptions;
426
427// Provided for testing.
428struct AnyCType {
430
431 union {
433 int32_t int32_value;
434 uint32_t uint32_value;
435 int64_t int64_value;
436 uint64_t uint64_value;
451 };
452};
453
454static_assert(
455 sizeof(AnyCType) == 8,
456 "The AnyCType struct should have size == 64 bits, as this is assumed "
457 "by EffectControlLinearizer.");
458
460 public:
461 constexpr CFunction() : address_(nullptr), type_info_(nullptr) {}
462
463 const CTypeInfo& ReturnInfo() const { return type_info_->ReturnInfo(); }
464
465 const CTypeInfo& ArgumentInfo(unsigned int index) const {
466 return type_info_->ArgumentInfo(index);
467 }
468
469 unsigned int ArgumentCount() const { return type_info_->ArgumentCount(); }
470
471 const void* GetAddress() const { return address_; }
472 const CFunctionInfo* GetTypeInfo() const { return type_info_; }
473
474 enum class OverloadResolution { kImpossible, kAtRuntime, kAtCompileTime };
475
476 // Returns whether an overload between this and the given CFunction can
477 // be resolved at runtime by the RTTI available for the arguments or at
478 // compile time for functions with different number of arguments.
480 // Runtime overload resolution can only deal with functions with the
481 // same number of arguments. Functions with different arity are handled
482 // by compile time overload resolution though.
483 if (ArgumentCount() != other->ArgumentCount()) {
484 return OverloadResolution::kAtCompileTime;
485 }
486
487 // The functions can only differ by a single argument position.
488 int diff_index = -1;
489 for (unsigned int i = 0; i < ArgumentCount(); ++i) {
490 if (ArgumentInfo(i).GetSequenceType() !=
491 other->ArgumentInfo(i).GetSequenceType()) {
492 if (diff_index >= 0) {
493 return OverloadResolution::kImpossible;
494 }
495 diff_index = i;
496
497 // We only support overload resolution between sequence types.
498 if (ArgumentInfo(i).GetSequenceType() ==
499 CTypeInfo::SequenceType::kScalar ||
500 other->ArgumentInfo(i).GetSequenceType() ==
501 CTypeInfo::SequenceType::kScalar) {
502 return OverloadResolution::kImpossible;
503 }
504 }
505 }
506
507 return OverloadResolution::kAtRuntime;
508 }
509
510 template <typename F>
511 static CFunction Make(F* func) {
512 return ArgUnwrap<F*>::Make(func);
513 }
514
515 // Provided for testing purposes.
516 template <typename R, typename... Args, typename R_Patch,
517 typename... Args_Patch>
518 static CFunction Make(R (*func)(Args...),
519 R_Patch (*patching_func)(Args_Patch...)) {
520 CFunction c_func = ArgUnwrap<R (*)(Args...)>::Make(func);
521 static_assert(
522 sizeof...(Args_Patch) == sizeof...(Args),
523 "The patching function must have the same number of arguments.");
524 c_func.address_ = reinterpret_cast<void*>(patching_func);
525 return c_func;
526 }
527
528 CFunction(const void* address, const CFunctionInfo* type_info);
529
530 private:
531 const void* address_;
532 const CFunctionInfo* type_info_;
533
534 template <typename F>
535 class ArgUnwrap {
536 static_assert(sizeof(F) != sizeof(F),
537 "CFunction must be created from a function pointer.");
538 };
539
540 template <typename R, typename... Args>
541 class ArgUnwrap<R (*)(Args...)> {
542 public:
543 static CFunction Make(R (*func)(Args...));
544 };
545};
546
559 return {false, {0}, nullptr};
560 }
561
574
579 union {
580 uintptr_t data_ptr;
582 };
583
588};
589
590namespace internal {
591
592// Helper to count the number of occurances of `T` in `List`
593template <typename T, typename... List>
594struct count : std::integral_constant<int, 0> {};
595template <typename T, typename... Args>
596struct count<T, T, Args...>
597 : std::integral_constant<std::size_t, 1 + count<T, Args...>::value> {};
598template <typename T, typename U, typename... Args>
599struct count<T, U, Args...> : count<T, Args...> {};
600
601template <typename RetBuilder, typename... ArgBuilders>
603 static constexpr int kOptionsArgCount =
604 count<FastApiCallbackOptions&, ArgBuilders...>();
605 static constexpr int kReceiverCount = 1;
606
607 static_assert(kOptionsArgCount == 0 || kOptionsArgCount == 1,
608 "Only one options parameter is supported.");
609
610 static_assert(sizeof...(ArgBuilders) >= kOptionsArgCount + kReceiverCount,
611 "The receiver or the options argument is missing.");
612
613 public:
615 : CFunctionInfo(RetBuilder::Build(), sizeof...(ArgBuilders),
616 arg_info_storage_),
617 arg_info_storage_{ArgBuilders::Build()...} {
618 constexpr CTypeInfo::Type kReturnType = RetBuilder::Build().GetType();
619 static_assert(kReturnType == CTypeInfo::Type::kVoid ||
620 kReturnType == CTypeInfo::Type::kBool ||
621 kReturnType == CTypeInfo::Type::kInt32 ||
622 kReturnType == CTypeInfo::Type::kUint32 ||
623 kReturnType == CTypeInfo::Type::kFloat32 ||
624 kReturnType == CTypeInfo::Type::kFloat64 ||
625 kReturnType == CTypeInfo::Type::kPointer ||
626 kReturnType == CTypeInfo::Type::kAny,
627 "64-bit int, string and api object values are not currently "
628 "supported return types.");
629 }
630
631 private:
632 const CTypeInfo arg_info_storage_[sizeof...(ArgBuilders)];
633};
634
635template <typename T>
637 static_assert(sizeof(T) != sizeof(T), "This type is not supported");
638};
639
640#define SPECIALIZE_GET_TYPE_INFO_HELPER_FOR(T, Enum) \
641 template <> \
642 struct TypeInfoHelper<T> { \
643 static constexpr CTypeInfo::Flags Flags() { \
644 return CTypeInfo::Flags::kNone; \
645 } \
646 \
647 static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::Enum; } \
648 static constexpr CTypeInfo::SequenceType SequenceType() { \
649 return CTypeInfo::SequenceType::kScalar; \
650 } \
651 };
652
653template <CTypeInfo::Type type>
655
656#define DEFINE_TYPE_INFO_TRAITS(CType, Enum) \
657 template <> \
658 struct CTypeInfoTraits<CTypeInfo::Type::Enum> { \
659 using ctype = CType; \
660 };
661
662#define PRIMITIVE_C_TYPES(V) \
663 V(bool, kBool) \
664 V(uint8_t, kUint8) \
665 V(int32_t, kInt32) \
666 V(uint32_t, kUint32) \
667 V(int64_t, kInt64) \
668 V(uint64_t, kUint64) \
669 V(float, kFloat32) \
670 V(double, kFloat64) \
671 V(void*, kPointer)
672
673// Same as above, but includes deprecated types for compatibility.
674#define ALL_C_TYPES(V) \
675 PRIMITIVE_C_TYPES(V) \
676 V(void, kVoid) \
677 V(v8::Local<v8::Value>, kV8Value) \
678 V(v8::Local<v8::Object>, kV8Value) \
679 V(AnyCType, kAny)
680
681// ApiObject was a temporary solution to wrap the pointer to the v8::Value.
682// Please use v8::Local<v8::Value> in new code for the arguments and
683// v8::Local<v8::Object> for the receiver, as ApiObject will be deprecated.
684
687
688#undef PRIMITIVE_C_TYPES
689#undef ALL_C_TYPES
690
691#define SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA(T, Enum) \
692 template <> \
693 struct TypeInfoHelper<const FastApiTypedArray<T>&> { \
694 static constexpr CTypeInfo::Flags Flags() { \
695 return CTypeInfo::Flags::kNone; \
696 } \
697 \
698 static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::Enum; } \
699 static constexpr CTypeInfo::SequenceType SequenceType() { \
700 return CTypeInfo::SequenceType::kIsTypedArray; \
701 } \
702 };
703
704#define TYPED_ARRAY_C_TYPES(V) \
705 V(uint8_t, kUint8) \
706 V(int32_t, kInt32) \
707 V(uint32_t, kUint32) \
708 V(int64_t, kInt64) \
709 V(uint64_t, kUint64) \
710 V(float, kFloat32) \
711 V(double, kFloat64)
712
714
715#undef TYPED_ARRAY_C_TYPES
716
717template <>
718struct TypeInfoHelper<v8::Local<v8::Array>> {
719 static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; }
720
721 static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::kVoid; }
724 }
725};
726
727template <>
728struct TypeInfoHelper<v8::Local<v8::Uint32Array>> {
729 static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; }
730
731 static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::kUint32; }
734 }
735};
736
737template <>
739 static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; }
740
741 static constexpr CTypeInfo::Type Type() {
743 }
746 }
747};
748
749template <>
751 static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; }
752
753 static constexpr CTypeInfo::Type Type() {
755 }
758 }
759};
760
761#define STATIC_ASSERT_IMPLIES(COND, ASSERTION, MSG) \
762 static_assert(((COND) == 0) || (ASSERTION), MSG)
763
764} // namespace internal
765
766template <typename T, CTypeInfo::Flags... Flags>
768 public:
769 using BaseType = T;
770
771 static constexpr CTypeInfo Build() {
772 constexpr CTypeInfo::Flags kFlags =
773 MergeFlags(internal::TypeInfoHelper<T>::Flags(), Flags...);
775 constexpr CTypeInfo::SequenceType kSequenceType =
777
779 uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kAllowSharedBit),
780 (kSequenceType == CTypeInfo::SequenceType::kIsTypedArray ||
781 kSequenceType == CTypeInfo::SequenceType::kIsArrayBuffer),
782 "kAllowSharedBit is only allowed for TypedArrays and ArrayBuffers.");
784 uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kEnforceRangeBit),
785 CTypeInfo::IsIntegralType(kType),
786 "kEnforceRangeBit is only allowed for integral types.");
788 uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kClampBit),
789 CTypeInfo::IsIntegralType(kType),
790 "kClampBit is only allowed for integral types.");
792 uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kIsRestrictedBit),
793 CTypeInfo::IsFloatingPointType(kType),
794 "kIsRestrictedBit is only allowed for floating point types.");
795 STATIC_ASSERT_IMPLIES(kSequenceType == CTypeInfo::SequenceType::kIsSequence,
796 kType == CTypeInfo::Type::kVoid,
797 "Sequences are only supported from void type.");
799 kSequenceType == CTypeInfo::SequenceType::kIsTypedArray,
800 CTypeInfo::IsPrimitive(kType) || kType == CTypeInfo::Type::kVoid,
801 "TypedArrays are only supported from primitive types or void.");
802
803 // Return the same type with the merged flags.
806 }
807
808 private:
809 template <typename... Rest>
810 static constexpr CTypeInfo::Flags MergeFlags(CTypeInfo::Flags flags,
811 Rest... rest) {
812 return CTypeInfo::Flags(uint8_t(flags) | uint8_t(MergeFlags(rest...)));
813 }
814 static constexpr CTypeInfo::Flags MergeFlags() { return CTypeInfo::Flags(0); }
815};
816
817namespace internal {
818template <typename RetBuilder, typename... ArgBuilders>
820 public:
821 explicit constexpr CFunctionBuilderWithFunction(const void* fn) : fn_(fn) {}
822
823 template <CTypeInfo::Flags... Flags>
824 constexpr auto Ret() {
826 CTypeInfoBuilder<typename RetBuilder::BaseType, Flags...>,
827 ArgBuilders...>(fn_);
828 }
829
830 template <unsigned int N, CTypeInfo::Flags... Flags>
831 constexpr auto Arg() {
832 // Return a copy of the builder with the Nth arg builder merged with
833 // template parameter pack Flags.
834 return ArgImpl<N, Flags...>(
835 std::make_index_sequence<sizeof...(ArgBuilders)>());
836 }
837
838 // Provided for testing purposes.
839 template <typename Ret, typename... Args>
840 auto Patch(Ret (*patching_func)(Args...)) {
841 static_assert(
842 sizeof...(Args) == sizeof...(ArgBuilders),
843 "The patching function must have the same number of arguments.");
844 fn_ = reinterpret_cast<void*>(patching_func);
845 return *this;
846 }
847
848 auto Build() {
849 static CFunctionInfoImpl<RetBuilder, ArgBuilders...> instance;
850 return CFunction(fn_, &instance);
851 }
852
853 private:
854 template <bool Merge, unsigned int N, CTypeInfo::Flags... Flags>
855 struct GetArgBuilder;
856
857 // Returns the same ArgBuilder as the one at index N, including its flags.
858 // Flags in the template parameter pack are ignored.
859 template <unsigned int N, CTypeInfo::Flags... Flags>
860 struct GetArgBuilder<false, N, Flags...> {
861 using type =
862 typename std::tuple_element<N, std::tuple<ArgBuilders...>>::type;
863 };
864
865 // Returns an ArgBuilder with the same base type as the one at index N,
866 // but merges the flags with the flags in the template parameter pack.
867 template <unsigned int N, CTypeInfo::Flags... Flags>
868 struct GetArgBuilder<true, N, Flags...> {
869 using type = CTypeInfoBuilder<
870 typename std::tuple_element<N,
871 std::tuple<ArgBuilders...>>::type::BaseType,
872 std::tuple_element<N, std::tuple<ArgBuilders...>>::type::Build()
873 .GetFlags(),
874 Flags...>;
875 };
876
877 // Return a copy of the CFunctionBuilder, but merges the Flags on
878 // ArgBuilder index N with the new Flags passed in the template parameter
879 // pack.
880 template <unsigned int N, CTypeInfo::Flags... Flags, size_t... I>
881 constexpr auto ArgImpl(std::index_sequence<I...>) {
882 return CFunctionBuilderWithFunction<
883 RetBuilder, typename GetArgBuilder<N == I, I, Flags...>::type...>(fn_);
884 }
885
886 const void* fn_;
887};
888
890 public:
891 constexpr CFunctionBuilder() {}
892
893 template <typename R, typename... Args>
894 constexpr auto Fn(R (*fn)(Args...)) {
897 reinterpret_cast<const void*>(fn));
898 }
899};
900
901} // namespace internal
902
903// static
904template <typename R, typename... Args>
905CFunction CFunction::ArgUnwrap<R (*)(Args...)>::Make(R (*func)(Args...)) {
906 return internal::CFunctionBuilder().Fn(func).Build();
907}
908
910
911static constexpr CTypeInfo kTypeInfoInt32 = CTypeInfo(CTypeInfo::Type::kInt32);
912static constexpr CTypeInfo kTypeInfoFloat64 =
914
927template <CTypeInfo::Identifier type_info_id, typename T>
929 Local<Array> src, T* dst, uint32_t max_length);
930
931template <>
933TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<int32_t>::Build().GetId(),
934 int32_t>(Local<Array> src, int32_t* dst,
935 uint32_t max_length);
936
937template <>
939TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<uint32_t>::Build().GetId(),
940 uint32_t>(Local<Array> src, uint32_t* dst,
941 uint32_t max_length);
942
943template <>
945TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<float>::Build().GetId(),
946 float>(Local<Array> src, float* dst,
947 uint32_t max_length);
948
949template <>
951TryToCopyAndConvertArrayToCppBuffer<CTypeInfoBuilder<double>::Build().GetId(),
952 double>(Local<Array> src, double* dst,
953 uint32_t max_length);
954
955} // namespace v8
956
957#endif // INCLUDE_V8_FAST_API_CALLS_H_
constexpr CFunction()
CFunction(const void *address, const CFunctionInfo *type_info)
static CFunction Make(R(*func)(Args...), R_Patch(*patching_func)(Args_Patch...))
const CTypeInfo & ArgumentInfo(unsigned int index) const
OverloadResolution GetOverloadResolution(const CFunction *other)
const void * GetAddress() const
const CFunctionInfo * GetTypeInfo() const
unsigned int ArgumentCount() const
const CTypeInfo & ReturnInfo() const
static CFunction Make(F *func)
CFunctionInfo(const CTypeInfo &return_info, unsigned int arg_count, const CTypeInfo *arg_info)
const CTypeInfo & ArgumentInfo(unsigned int index) const
unsigned int ArgumentCount() const
const CTypeInfo & ReturnInfo() const
static constexpr CTypeInfo Build()
constexpr Identifier GetId() const
constexpr SequenceType GetSequenceType() const
static constexpr Type kCallbackOptionsType
static constexpr bool IsIntegralType(Type type)
constexpr CTypeInfo(Identifier identifier)
constexpr CTypeInfo(Type type, SequenceType sequence_type=SequenceType::kScalar, Flags flags=Flags::kNone)
constexpr Flags GetFlags() const
static constexpr bool IsFloatingPointType(Type type)
constexpr Type GetType() const
static constexpr bool IsPrimitive(Type type)
constexpr auto Fn(R(*fn)(Args...))
constexpr CFunctionBuilderWithFunction(const void *fn)
auto Patch(Ret(*patching_func)(Args...))
bool V8_EXPORT V8_WARN_UNUSED_RESULT TryToCopyAndConvertArrayToCppBuffer(Local< Array > src, T *dst, uint32_t max_length)
const FastOneByteString * string_value
const FastApiTypedArray< int32_t > * int32_ta_value
const FastApiTypedArray< uint8_t > * uint8_ta_value
const FastApiTypedArray< uint32_t > * uint32_ta_value
FastApiCallbackOptions * options_value
const FastApiTypedArray< float > * float_ta_value
const FastApiTypedArray< double > * double_ta_value
Local< Object > object_value
Local< Array > sequence_value
const FastApiTypedArray< int64_t > * int64_ta_value
const FastApiTypedArray< uint64_t > * uint64_ta_value
FastApiTypedArray< uint8_t > *const wasm_memory
static FastApiCallbackOptions CreateForTesting(Isolate *isolate)
v8::Local< v8::Value > data
void V8_EXPORT ValidateIndex(size_t index) const
size_t V8_EXPORT length() const
V8_INLINE T get(size_t index) const
bool getStorageIfAligned(T **elements) const
static constexpr CTypeInfo::SequenceType SequenceType()
static constexpr CTypeInfo::SequenceType SequenceType()
static constexpr CTypeInfo::SequenceType SequenceType()
static constexpr CTypeInfo::SequenceType SequenceType()
#define DEFINE_TYPE_INFO_TRAITS(CType, Enum)
#define SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA(T, Enum)
#define PRIMITIVE_C_TYPES(V)
#define TYPED_ARRAY_C_TYPES(V)
#define SPECIALIZE_GET_TYPE_INFO_HELPER_FOR(T, Enum)
#define ALL_C_TYPES(V)
#define STATIC_ASSERT_IMPLIES(COND, ASSERTION, MSG)
#define V8_EXPORT
Definition v8config.h:719
#define V8_INLINE
Definition v8config.h:460
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:609