5#ifndef V8_ASMJS_ASM_TYPES_H_
6#define V8_ASMJS_ASM_TYPES_H_
21class AsmOverloadedFunctionType;
24#define FOR_EACH_ASM_VALUE_TYPE_LIST(V) \
28 V(FloatishDoubleQ, "floatish|double?", 2, 0) \
29 V(FloatQDoubleQ, "float?|double?", 3, 0) \
31 V(Void, "void", 4, 0) \
32 V(Extern, "extern", 5, 0) \
33 V(DoubleQ, "double?", 6, kAsmFloatishDoubleQ | kAsmFloatQDoubleQ) \
34 V(Double, "double", 7, kAsmDoubleQ | kAsmExtern) \
35 V(Intish, "intish", 8, 0) \
36 V(Int, "int", 9, kAsmIntish) \
37 V(Signed, "signed", 10, kAsmInt | kAsmExtern) \
38 V(Unsigned, "unsigned", 11, kAsmInt) \
39 V(FixNum, "fixnum", 12, kAsmSigned | kAsmUnsigned) \
40 V(Floatish, "floatish", 13, kAsmFloatishDoubleQ) \
41 V(FloatQ, "float?", 14, kAsmFloatQDoubleQ | kAsmFloatish) \
42 V(Float, "float", 15, kAsmFloatQ) \
44 V(Uint8Array, "Uint8Array", 16, kAsmHeap) \
45 V(Int8Array, "Int8Array", 17, kAsmHeap) \
46 V(Uint16Array, "Uint16Array", 18, kAsmHeap) \
47 V(Int16Array, "Int16Array", 19, kAsmHeap) \
48 V(Uint32Array, "Uint32Array", 20, kAsmHeap) \
49 V(Int32Array, "Int32Array", 21, kAsmHeap) \
50 V(Float32Array, "Float32Array", 22, kAsmHeap) \
51 V(Float64Array, "Float64Array", 23, kAsmHeap) \
53 V(None, "<none>", 31, 0)
56#define FOR_EACH_ASM_CALLABLE_TYPE_LIST(V) \
58 V(OverloadedFunctionType)
65#define DEFINE_TAG(CamelName, string_name, number, parent_types) \
66 kAsm##CamelName = ((1u << (number)) | (parent_types)),
87 return static_cast<bitset_t>(
reinterpret_cast<uintptr_t
>(
this) &
93 return reinterpret_cast<AsmType*
>(
106 virtual std::string
Name() = 0;
111#define DECLARE_CAST(CamelName) \
112 virtual Asm##CamelName* As##CamelName() { return nullptr; }
119 virtual bool IsA(
AsmType* other);
136 bool CanBeInvokedWith(
AsmType* return_type,
147 std::string
Name()
override;
148 bool IsA(
AsmType* other)
override;
161 void AddOverload(
AsmType* overload);
169 std::string
Name()
override;
170 bool CanBeInvokedWith(
AsmType* return_type,
180#define DEFINE_CONSTRUCTOR(CamelName, string_name, number, parent_types) \
181 static AsmType* CamelName() { \
182 return AsmValueType::New(AsmValueType::kAsm##CamelName); \
185#undef DEFINE_CONSTRUCTOR
187#define DEFINE_CAST(CamelCase) \
188 Asm##CamelCase* As##CamelCase() { \
189 if (AsValueType() != nullptr) { \
192 return reinterpret_cast<AsmCallableType*>(this)->As##CamelCase(); \
203 return reinterpret_cast<AsmType*
>(f);
210 return reinterpret_cast<AsmType*
>(f);
230 enum : int32_t { kNotHeapType = -1 };
#define DEFINE_TAG(CamelName, string_name, number, parent_types)
#define DEFINE_CONSTRUCTOR(CamelName, string_name, number, parent_types)
#define DECLARE_CAST(CamelName)
#define DEFINE_CAST(CamelCase)
#define FOR_EACH_ASM_CALLABLE_TYPE_LIST(V)
#define FOR_EACH_ASM_VALUE_TYPE_LIST(V)
virtual ~AsmCallableType()=default
AsmCallableType & operator=(const AsmCallableType &)=delete
virtual std::string Name()=0
AsmCallableType()=default
virtual bool CanBeInvokedWith(AsmType *return_type, const ZoneVector< AsmType * > &args)=0
AsmCallableType(const AsmCallableType &)=delete
AsmFunctionType * AsFunctionType() final
AsmFunctionType & operator=(const AsmFunctionType &)=delete
ZoneVector< AsmType * > args_
AsmType * ReturnType() const
AsmFunctionType(const AsmFunctionType &)=delete
AsmFunctionType(Zone *zone, AsmType *return_type)
const ZoneVector< AsmType * > & Arguments() const
void AddArgument(AsmType *type)
AsmOverloadedFunctionType * AsOverloadedFunctionType() override
DISALLOW_IMPLICIT_CONSTRUCTORS(AsmOverloadedFunctionType)
ZoneVector< AsmType * > overloads_
AsmOverloadedFunctionType(Zone *zone)
AsmValueType * AsValueType()
static AsmType * OverloadedFunction(Zone *zone)
static AsmType * Function(Zone *zone, AsmType *ret)
DISALLOW_IMPLICIT_CONSTRUCTORS(AsmValueType)
static AsmValueType * AsValueType(AsmType *type)
static AsmType * New(bitset_t bits)
base::Vector< const DirectHandle< Object > > args
V8_EXPORT_PRIVATE constexpr int ElementSizeInBytes(MachineRepresentation)
#define NON_EXPORTED_BASE(code)
#define DCHECK_EQ(v1, v2)
#define V8_EXPORT_PRIVATE