v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
value-type.h File Reference
Include dependency graph for value-type.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  v8::internal::wasm::TypeIndex
 
struct  v8::internal::wasm::ModuleTypeIndex
 
struct  v8::internal::wasm::CanonicalTypeIndex
 
class  v8::internal::wasm::ValueTypeBase
 
class  v8::internal::wasm::HeapType
 
class  v8::internal::wasm::ValueType
 
class  v8::internal::wasm::CanonicalValueType
 
class  v8::internal::wasm::IndependentValueType
 
class  v8::internal::wasm::IndependentHeapType
 
class  v8::internal::wasm::CanonicalSig
 
class  v8::internal::wasm::CanonicalSig::Builder
 
class  v8::internal::wasm::LoadType
 
class  v8::internal::wasm::StoreType
 

Namespaces

namespace  v8
 
namespace  v8::internal
 
namespace  v8::internal::wasm
 
namespace  v8::internal::wasm::value_type_impl
 

Macros

#define FOREACH_NUMERIC_VALUE_TYPE(V)
 
#define FOREACH_VALUE_TYPE(V)
 
#define DEF_ENUM(kind, ...)
 
#define FUNC   value_type_impl::RefTypeKindField::encode(RefTypeKind::kFunction)
 
#define STRUCT   value_type_impl::RefTypeKindField::encode(RefTypeKind::kStruct)
 
#define ARRAY   value_type_impl::RefTypeKindField::encode(RefTypeKind::kArray)
 
#define CONT   value_type_impl::RefTypeKindField::encode(RefTypeKind::kCont)
 
#define REF   value_type_impl::IsRefField::encode(true)
 
#define SENTINEL   value_type_impl::HasIndexOrSentinelField::encode(true)
 
#define EXACT   value_type_impl::IsExactField::encode(Exactness::kExact)
 
#define FOREACH_NONE_TYPE(V)
 
#define FOREACH_ABSTRACT_TYPE(V)
 
#define FOREACH_INTERNAL_TYPE(V)
 
#define FOREACH_GENERIC_TYPE(V)
 
#define COUNT(...)
 
#define DEF_ENUM(kind, ...)
 
#define DEF_ENUM(kind, code, extra_bits, ...)
 
#define DEF_ENUM(kind, ...)
 
#define NULLTYPE(name, ...)
 
#define VALUE_KIND_SIZE_LOG2(kind, log2Size, ...)
 
#define ELEM_SIZE_LOG2(kind, log2Size, ...)
 
#define MACH_TYPE(kind, log2Size, code, machineType, ...)
 
#define SHORT_NAME(kind, log2, code, mtype, shortName, ...)
 
#define CASE(name, code, ...)
 
#define CASE(name, ...)
 
#define VALUE_KIND_SIZE_LOG2(kind, log2Size, ...)
 
#define ELEM_SIZE_LOG2(kind, log2Size, ...)
 
#define KIND_NAME(kind, log2Size, code, machineType, shortName, kindName, ...)
 
#define MACH_TYPE(kind, log2Size, code, machineType, ...)
 
#define FOREACH_WASMVALUE_CTYPES(V)
 
#define FOREACH_LOAD_TYPE(V)
 
#define DEF_ENUM(type, suffix, ...)
 
#define LOAD_SIZE(_, __, memtype)
 
#define LOAD_SIZE(_, __, memtype)
 
#define VALUE_TYPE(type, ...)
 
#define MEMTYPE(_, __, memtype)
 
#define FOREACH_STORE_TYPE(V)
 
#define DEF_ENUM(type, suffix, ...)
 
#define STORE_SIZE(_, __, memrep)
 
#define VALUE_TYPE(type, ...)
 
#define MEMREP(_, __, memrep)
 

Typedefs

using v8::internal::wasm::value_type_impl::IsRefField = base::BitField<bool, 0, 1>
 
using v8::internal::wasm::value_type_impl::HasIndexOrSentinelField = IsRefField::Next<bool, 1>
 
using v8::internal::wasm::value_type_impl::TypeKindField = base::BitField<TypeKind, 0, 2>
 
using v8::internal::wasm::value_type_impl::IsNullableField = TypeKindField::Next<Nullability, 1>
 
using v8::internal::wasm::value_type_impl::IsExactField = IsNullableField::Next<Exactness, 1>
 
using v8::internal::wasm::value_type_impl::IsSharedField = IsExactField::Next<bool, 1>
 
using v8::internal::wasm::value_type_impl::RefTypeKindField = IsSharedField::Next<RefTypeKind, 3>
 
using v8::internal::wasm::value_type_impl::PayloadField = RefTypeKindField::Next<uint32_t, 20>
 
using v8::internal::wasm::value_type_impl::ReservedField = PayloadField::Next<uint32_t, 4>
 
using v8::internal::wasm::FunctionSig = Signature<ValueType>
 

Enumerations

enum  v8::internal::wasm::Nullability : bool { v8::internal::wasm::kNonNullable = false , v8::internal::wasm::kNullable = true }
 
enum  v8::internal::wasm::Exactness : bool { v8::internal::wasm::kAnySubtype , v8::internal::wasm::kExact }
 
enum  v8::internal::wasm::ValueKind : uint8_t
 
enum class  v8::internal::wasm::TypeKind : uint8_t { v8::internal::wasm::kNumeric = 0b00 , v8::internal::wasm::kSentinel = SENTINEL , v8::internal::wasm::kAbstractRef = REF , v8::internal::wasm::kIndexedRef = REF | SENTINEL }
 
enum class  v8::internal::wasm::RefTypeKind : uint8_t {
  v8::internal::wasm::kOther = 0 , v8::internal::wasm::kFunction = 1 , v8::internal::wasm::kStruct = 2 , v8::internal::wasm::kArray = 3 ,
  v8::internal::wasm::kCont = 4 , v8::internal::wasm::kLastValue = kCont
}
 
enum class  v8::internal::wasm::StandardType : uint8_t { v8::internal::wasm::DEF_ENUM , v8::internal::wasm::FOREACH_GENERIC_TYPE =(DEF_ENUM) FOREACH_NUMERIC_VALUE_TYPE(DEF_ENUM) }
 
enum class  v8::internal::wasm::GenericKind : uint32_t { v8::internal::wasm::DEF_ENUM }
 
enum class  v8::internal::wasm::NumericKind : uint32_t { v8::internal::wasm::DEF_ENUM }
 

Functions

 v8::internal::wasm::ASSERT_TRIVIALLY_COPYABLE (ModuleTypeIndex)
 
 v8::internal::wasm::ASSERT_TRIVIALLY_COPYABLE (CanonicalTypeIndex)
 
std::ostream & v8::internal::wasm::operator<< (std::ostream &oss, TypeIndex index)
 
constexpr uint32_t v8::internal::wasm::value_type_impl::ToZeroBasedIndex (NumericKind kind)
 
constexpr bool v8::internal::wasm::IsNullKind (GenericKind kind)
 
 v8::internal::wasm::ASSERT_TRIVIALLY_COPYABLE (ValueTypeBase)
 
 v8::internal::wasm::ASSERT_TRIVIALLY_COPYABLE (ValueType)
 
 v8::internal::wasm::ASSERT_TRIVIALLY_COPYABLE (CanonicalValueType)
 
constexpr bool v8::internal::wasm::is_reference (ValueKind kind)
 
constexpr bool v8::internal::wasm::is_object_reference (ValueKind kind)
 
constexpr int v8::internal::wasm::value_kind_size_log2 (ValueKind kind)
 
constexpr int v8::internal::wasm::value_kind_size (ValueKind kind)
 
constexpr int v8::internal::wasm::value_kind_full_size (ValueKind kind)
 
constexpr const char * v8::internal::wasm::name (ValueKind kind)
 
std::ostream & v8::internal::wasm::operator<< (std::ostream &oss, ValueKind kind)
 
constexpr MachineType v8::internal::wasm::machine_type (ValueKind kind)
 
constexpr bool v8::internal::wasm::is_packed (ValueKind kind)
 
constexpr ValueKind v8::internal::wasm::unpacked (ValueKind kind)
 
std::ostream & v8::internal::wasm::operator<< (std::ostream &oss, ValueType type)
 
bool v8::internal::wasm::EquivalentNumericSig (const CanonicalSig *a, const FunctionSig *b)
 
std::optional< wasm::ValueKindv8::internal::wasm::WasmReturnTypeFromSignature (const CanonicalSig *wasm_signature)
 
const wasm::FunctionSigv8::internal::wasm::GetI32Sig (Zone *zone, const wasm::FunctionSig *sig)
 

Variables

constexpr int v8::internal::wasm::kMaxValueTypeSize = 16
 
static constexpr bool v8::internal::wasm::kNotShared = false
 
static constexpr uint32_t v8::internal::wasm::value_type_impl::kGenericKindMask
 
static constexpr uint32_t v8::internal::wasm::value_type_impl::kNumericKindMask
 
static constexpr uint32_t v8::internal::wasm::value_type_impl::kNumericExtraBits = IsSharedField::encode(true)
 
static constexpr uint32_t v8::internal::wasm::value_type_impl::kNumberOfGenericKinds = 0 FOREACH_GENERIC_TYPE(COUNT)
 
static constexpr uint32_t v8::internal::wasm::value_type_impl::kNumberOfNumericKinds
 
static constexpr uint32_t v8::internal::wasm::value_type_impl::kNumberOfStandardTypes
 
constexpr IndependentValueType v8::internal::wasm::kWasmI32 {NumericKind::kI32}
 
constexpr IndependentValueType v8::internal::wasm::kWasmI64 {NumericKind::kI64}
 
constexpr IndependentValueType v8::internal::wasm::kWasmF32 {NumericKind::kF32}
 
constexpr IndependentValueType v8::internal::wasm::kWasmF64 {NumericKind::kF64}
 
constexpr IndependentValueType v8::internal::wasm::kWasmS128 {NumericKind::kS128}
 
constexpr IndependentValueType v8::internal::wasm::kWasmI8 {NumericKind::kI8}
 
constexpr IndependentValueType v8::internal::wasm::kWasmI16 {NumericKind::kI16}
 
constexpr IndependentValueType v8::internal::wasm::kWasmF16 {NumericKind::kF16}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmVoid {GenericKind::kVoid, kNonNullable}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmTop {GenericKind::kTop}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmBottom {GenericKind::kBottom, kNonNullable}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmFuncRef {GenericKind::kFunc}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmAnyRef {GenericKind::kAny}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmExternRef {GenericKind::kExtern}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmRefExtern
 
constexpr IndependentHeapType v8::internal::wasm::kWasmExnRef {GenericKind::kExn}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmEqRef {GenericKind::kEq}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmI31Ref {GenericKind::kI31}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmRefI31 {GenericKind::kI31, kNonNullable}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmStructRef {GenericKind::kStruct}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmArrayRef {GenericKind::kArray}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmStringRef {GenericKind::kString}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmRefString
 
constexpr IndependentHeapType v8::internal::wasm::kWasmRefNullExternString
 
constexpr IndependentHeapType v8::internal::wasm::kWasmRefExternString
 
constexpr IndependentHeapType v8::internal::wasm::kWasmStringViewWtf8
 
constexpr IndependentHeapType v8::internal::wasm::kWasmStringViewWtf16
 
constexpr IndependentHeapType v8::internal::wasm::kWasmStringViewIter
 
constexpr IndependentHeapType v8::internal::wasm::kWasmNullRef {GenericKind::kNone}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmNullExternRef {GenericKind::kNoExtern}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmNullExnRef {GenericKind::kNoExn}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmNullFuncRef {GenericKind::kNoFunc}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmContRef {GenericKind::kCont}
 
constexpr IndependentHeapType v8::internal::wasm::kWasmNullContRef {GenericKind::kNoCont}
 

Macro Definition Documentation

◆ ARRAY

#define ARRAY   value_type_impl::RefTypeKindField::encode(RefTypeKind::kArray)

Definition at line 158 of file value-type.h.

◆ CASE [1/2]

#define CASE ( name,
code,
... )
Value:
case (k##code##Code - kFirst): \
static_assert(k##code##Code >= kFirst && k##code##Code <= kLast); \
return GenericKind::k##name;
const char * name
Definition builtins.cc:39

◆ CASE [2/2]

#define CASE ( name,
... )
Value:
case GenericKind::k##name: \
return distinguish_shared && is_shared() ? HeapType::k##name##Shared \
: HeapType::k##name;

◆ CONT

#define CONT   value_type_impl::RefTypeKindField::encode(RefTypeKind::kCont)

Definition at line 159 of file value-type.h.

◆ COUNT

#define COUNT ( ...)
Value:
+1

Definition at line 253 of file value-type.h.

◆ DEF_ENUM [1/6]

#define DEF_ENUM ( kind,
code,
extra_bits,
... )
Value:
k##kind = value_type_impl::PayloadField::encode( \
static_cast<uint8_t>(StandardType::k##kind)) + \
(extra_bits),
Builtins::Kind kind
Definition builtins.cc:40

Definition at line 104 of file value-type.h.

◆ DEF_ENUM [2/6]

#define DEF_ENUM ( kind,
... )
Value:
k##kind,

Definition at line 104 of file value-type.h.

◆ DEF_ENUM [3/6]

#define DEF_ENUM ( kind,
... )
Value:
k##kind,

Definition at line 104 of file value-type.h.

◆ DEF_ENUM [4/6]

#define DEF_ENUM ( kind,
... )
Value:
k##kind = value_type_impl::PayloadField::encode( \
static_cast<uint8_t>(StandardType::k##kind)) + \
value_type_impl::kNumericExtraBits,

Definition at line 104 of file value-type.h.

◆ DEF_ENUM [5/6]

#define DEF_ENUM ( type,
suffix,
... )
Value:
k##type##Load##suffix,

Definition at line 104 of file value-type.h.

◆ DEF_ENUM [6/6]

#define DEF_ENUM ( type,
suffix,
... )
Value:
k##type##Store##suffix,

Definition at line 104 of file value-type.h.

◆ ELEM_SIZE_LOG2 [1/2]

#define ELEM_SIZE_LOG2 ( kind,
log2Size,
... )
Value:
(1 << log2Size),

◆ ELEM_SIZE_LOG2 [2/2]

#define ELEM_SIZE_LOG2 ( kind,
log2Size,
... )
Value:
log2Size == -1 ? -1 : (1 << std::max(0, log2Size)),

◆ EXACT

#define EXACT   value_type_impl::IsExactField::encode(Exactness::kExact)

Definition at line 162 of file value-type.h.

◆ FOREACH_ABSTRACT_TYPE

#define FOREACH_ABSTRACT_TYPE ( V)
Value:
/* force 80 cols */ \
FOREACH_NONE_TYPE(V) \
/* Established (non-proposal) types. */ \
V(Func, FuncRef, REF | FUNC, "func") \
V(Any, AnyRef, REF, "any") \
V(Eq, EqRef, REF, "eq") \
V(I31, I31Ref, REF, "i31") \
V(Struct, StructRef, REF | STRUCT, "struct") \
V(Array, ArrayRef, REF | ARRAY, "array") \
V(Extern, ExternRef, REF, "extern") \
V(Exn, ExnRef, REF, "exn") \
/* WasmFX aka Core Stack Switching. */ \
V(Cont, ContRef, REF | CONT, "cont") \
/* Stringref proposal. */ \
V(String, StringRef, REF, "string") \
V(StringViewWtf8, StringViewWtf8, REF, "stringview_wtf8") \
V(StringViewWtf16, StringViewWtf16, REF, "stringview_wtf16") \
V(StringViewIter, StringViewIter, REF, "stringview_iter")
#define V(Name)
#define FUNC
Definition value-type.h:156
#define CONT
Definition value-type.h:159
#define STRUCT
Definition value-type.h:157
#define REF
Definition value-type.h:160
#define ARRAY
Definition value-type.h:158

Definition at line 175 of file value-type.h.

◆ FOREACH_GENERIC_TYPE

#define FOREACH_GENERIC_TYPE ( V)
Value:
/* force 80 cols */ \
FOREACH_INTERNAL_TYPE(V) \
FOREACH_ABSTRACT_TYPE(V)

Definition at line 201 of file value-type.h.

◆ FOREACH_INTERNAL_TYPE

#define FOREACH_INTERNAL_TYPE ( V)
Value:
/* force 80 cols */ \
V(Void, Void, SENTINEL, "<void>") \
V(Top, Void, SENTINEL, "<top>") \
V(Bottom, Void, SENTINEL | EXACT, "<bot>") \
V(ExternString, Void, REF, "<extern_string>")
#define EXACT
Definition value-type.h:162
#define SENTINEL
Definition value-type.h:161

Definition at line 195 of file value-type.h.

◆ FOREACH_LOAD_TYPE

#define FOREACH_LOAD_TYPE ( V)
Value:
V(I32, , Int32) \
V(I32, 8S, Int8) \
V(I32, 8U, Uint8) \
V(I32, 16S, Int16) \
V(I32, 16U, Uint16) \
V(I64, , Int64) \
V(I64, 8S, Int8) \
V(I64, 8U, Uint8) \
V(I64, 16S, Int16) \
V(I64, 16U, Uint16) \
V(I64, 32S, Int32) \
V(I64, 32U, Uint32) \
V(F32, F16, Float16) \
V(F32, , Float32) \
V(F64, , Float64) \
V(S128, , Simd128)

Definition at line 1305 of file value-type.h.

◆ FOREACH_NONE_TYPE

#define FOREACH_NONE_TYPE ( V)
Value:
/* force 80 cols */ \
V(NoCont, NoCont, REF | CONT | EXACT, "nocont") \
V(NoExn, NoExn, REF | EXACT, "noexn") \
V(NoExtern, NoExtern, REF | EXACT, "noextern") \
V(NoFunc, NoFunc, REF | FUNC | EXACT, "nofunc") \
V(None, None, REF | EXACT, "none")

Definition at line 168 of file value-type.h.

◆ FOREACH_NUMERIC_VALUE_TYPE

#define FOREACH_NUMERIC_VALUE_TYPE ( V)
Value:
V(I32, 2, I32, Int32, 'i', "i32") \
V(I64, 3, I64, Int64, 'l', "i64") \
V(F32, 2, F32, Float32, 'f', "f32") \
V(F64, 3, F64, Float64, 'd', "f64") \
V(S128, 4, S128, Simd128, 's', "v128") \
V(I8, 0, I8, Int8, 'b', "i8") \
V(I16, 1, I16, Int16, 'h', "i16") \
V(F16, 1, F16, Float16, 'p', "f16")

Definition at line 31 of file value-type.h.

◆ FOREACH_STORE_TYPE

#define FOREACH_STORE_TYPE ( V)
Value:
V(I32, , Word32) \
V(I32, 8, Word8) \
V(I32, 16, Word16) \
V(I64, , Word64) \
V(I64, 8, Word8) \
V(I64, 16, Word16) \
V(I64, 32, Word32) \
V(F32, F16, Float16) \
V(F32, , Float32) \
V(F64, , Float64) \
V(S128, , Simd128)

Definition at line 1398 of file value-type.h.

◆ FOREACH_VALUE_TYPE

#define FOREACH_VALUE_TYPE ( V)
Value:
V(Void, -1, Void, None, 'v', "<void>") \
FOREACH_NUMERIC_VALUE_TYPE(V) \
V(Ref, kTaggedSizeLog2, Ref, AnyTagged, 'r', "ref") \
V(RefNull, kTaggedSizeLog2, RefNull, AnyTagged, 'n', "ref null") \
V(Top, -1, Void, None, '\\', "<top>") \
V(Bottom, -1, Void, None, '*', "<bot>")

Definition at line 41 of file value-type.h.

◆ FOREACH_WASMVALUE_CTYPES

#define FOREACH_WASMVALUE_CTYPES ( V)
Value:
V(kI32, int32_t) \
V(kI64, int64_t) \
V(kF32, float) \
V(kF64, double) \
V(kS128, Simd128)

Definition at line 1271 of file value-type.h.

◆ FUNC

#define FUNC   value_type_impl::RefTypeKindField::encode(RefTypeKind::kFunction)

Definition at line 156 of file value-type.h.

◆ KIND_NAME

#define KIND_NAME ( kind,
log2Size,
code,
machineType,
shortName,
kindName,
... )
Value:
kindName,

◆ LOAD_SIZE [1/2]

#define LOAD_SIZE ( _,
__,
memtype )
Value:
static_cast<uint8_t>( \
ElementSizeInBytes(MachineType::memtype().representation())),

◆ LOAD_SIZE [2/2]

#define LOAD_SIZE ( _,
__,
memtype )
Value:
static_cast<uint8_t>( \
ElementSizeLog2Of(MachineType::memtype().representation())),

◆ MACH_TYPE [1/2]

#define MACH_TYPE ( kind,
log2Size,
code,
machineType,
... )
Value:
MachineType::machineType(),

◆ MACH_TYPE [2/2]

#define MACH_TYPE ( kind,
log2Size,
code,
machineType,
... )
Value:
MachineType::machineType(),

◆ MEMREP

#define MEMREP ( _,
__,
memrep )
Value:
MachineRepresentation::k##memrep,

◆ MEMTYPE

#define MEMTYPE ( _,
__,
memtype )
Value:
MachineType::memtype(),

◆ NULLTYPE

#define NULLTYPE ( name,
... )
Value:
case GenericKind::k##name: \
return true;

◆ REF

#define REF   value_type_impl::IsRefField::encode(true)

Definition at line 160 of file value-type.h.

◆ SENTINEL

#define SENTINEL   value_type_impl::HasIndexOrSentinelField::encode(true)

Definition at line 161 of file value-type.h.

◆ SHORT_NAME

#define SHORT_NAME ( kind,
log2,
code,
mtype,
shortName,
... )
Value:
shortName,

◆ STORE_SIZE

#define STORE_SIZE ( _,
__,
memrep )
Value:
static_cast<uint8_t>(ElementSizeLog2Of(MachineRepresentation::k##memrep)),

◆ STRUCT

#define STRUCT   value_type_impl::RefTypeKindField::encode(RefTypeKind::kStruct)

Definition at line 157 of file value-type.h.

◆ VALUE_KIND_SIZE_LOG2 [1/2]

#define VALUE_KIND_SIZE_LOG2 ( kind,
log2Size,
... )
Value:
log2Size,

◆ VALUE_KIND_SIZE_LOG2 [2/2]

#define VALUE_KIND_SIZE_LOG2 ( kind,
log2Size,
... )
Value:
log2Size,

◆ VALUE_TYPE [1/2]

#define VALUE_TYPE ( type,
... )
Value:
ValueType::Primitive(k##type),

◆ VALUE_TYPE [2/2]

#define VALUE_TYPE ( type,
... )
Value:
ValueType::Primitive(k##type),