| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SRC_WASM_ASM_TYPES_H_ | 5 #ifndef SRC_WASM_ASM_TYPES_H_ |
| 6 #define SRC_WASM_ASM_TYPES_H_ | 6 #define SRC_WASM_ASM_TYPES_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <type_traits> | |
| 10 | 9 |
| 11 #include "src/base/macros.h" | 10 #include "src/base/macros.h" |
| 12 #include "src/zone-containers.h" | 11 #include "src/zone-containers.h" |
| 13 #include "src/zone.h" | 12 #include "src/zone.h" |
| 14 | 13 |
| 15 namespace v8 { | 14 namespace v8 { |
| 16 namespace internal { | 15 namespace internal { |
| 17 namespace wasm { | 16 namespace wasm { |
| 18 | 17 |
| 19 class AsmType; | 18 class AsmType; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 V(Float, "float", 13, kAsmFloatQ) \ | 39 V(Float, "float", 13, kAsmFloatQ) \ |
| 41 /* Types used for expressing the Heap accesses. */ \ | 40 /* Types used for expressing the Heap accesses. */ \ |
| 42 V(Uint8Array, "Uint8Array", 14, kAsmHeap) \ | 41 V(Uint8Array, "Uint8Array", 14, kAsmHeap) \ |
| 43 V(Int8Array, "Int8Array", 15, kAsmHeap) \ | 42 V(Int8Array, "Int8Array", 15, kAsmHeap) \ |
| 44 V(Uint16Array, "Uint16Array", 16, kAsmHeap) \ | 43 V(Uint16Array, "Uint16Array", 16, kAsmHeap) \ |
| 45 V(Int16Array, "Int16Array", 17, kAsmHeap) \ | 44 V(Int16Array, "Int16Array", 17, kAsmHeap) \ |
| 46 V(Uint32Array, "Uint32Array", 18, kAsmHeap) \ | 45 V(Uint32Array, "Uint32Array", 18, kAsmHeap) \ |
| 47 V(Int32Array, "Int32Array", 19, kAsmHeap) \ | 46 V(Int32Array, "Int32Array", 19, kAsmHeap) \ |
| 48 V(Float32Array, "Float32Array", 20, kAsmHeap) \ | 47 V(Float32Array, "Float32Array", 20, kAsmHeap) \ |
| 49 V(Float64Array, "Float64Array", 21, kAsmHeap) \ | 48 V(Float64Array, "Float64Array", 21, kAsmHeap) \ |
| 50 V(FloatishDoubleQ, "floatish|double?", 22, kAsmFloatish | kAsmDoubleQ) \ | 49 /* Pseudo-types used in representing heap access for fp types.*/ \ |
| 51 V(FloatQDoubleQ, "float?|double?", 23, kAsmFloatQ | kAsmDoubleQ) \ | 50 V(FloatishDoubleQ, "floatish|double?", 23, kAsmFloatish | kAsmDoubleQ) \ |
| 51 V(FloatQDoubleQ, "float?|double?", 24, kAsmFloatQ | kAsmDoubleQ) \ |
| 52 /* None is used to represent errors in the type checker. */ \ | 52 /* None is used to represent errors in the type checker. */ \ |
| 53 V(None, "<none>", 31, 0) | 53 V(None, "<none>", 31, 0) |
| 54 | 54 |
| 55 // List of V(CamelName) | 55 // List of V(CamelName) |
| 56 #define FOR_EACH_ASM_CALLABLE_TYPE_LIST(V) \ | 56 #define FOR_EACH_ASM_CALLABLE_TYPE_LIST(V) \ |
| 57 V(FunctionType) \ | 57 V(FunctionType) \ |
| 58 V(OverloadedFunctionType) | 58 V(OverloadedFunctionType) |
| 59 | 59 |
| 60 class AsmValueType { | 60 class AsmValueType { |
| 61 public: | 61 public: |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 | 194 |
| 195 // Overloaded function types. Not creatable by asm source, but useful to | 195 // Overloaded function types. Not creatable by asm source, but useful to |
| 196 // represent the overloaded stdlib functions. | 196 // represent the overloaded stdlib functions. |
| 197 static AsmType* OverloadedFunction(Zone* zone) { | 197 static AsmType* OverloadedFunction(Zone* zone) { |
| 198 auto* f = new (zone) AsmOverloadedFunctionType(zone); | 198 auto* f = new (zone) AsmOverloadedFunctionType(zone); |
| 199 return reinterpret_cast<AsmType*>(f); | 199 return reinterpret_cast<AsmType*>(f); |
| 200 } | 200 } |
| 201 | 201 |
| 202 // The type for fround(src). | 202 // The type for fround(src). |
| 203 static AsmType* FroundType(Zone* zone, AsmType* src); | 203 static AsmType* FroundType(Zone* zone); |
| 204 | 204 |
| 205 // The (variadic) type for min and max. | 205 // The (variadic) type for min and max. |
| 206 static AsmType* MinMaxType(Zone* zone, AsmType* type); | 206 static AsmType* MinMaxType(Zone* zone, AsmType* dest, AsmType* src); |
| 207 | 207 |
| 208 std::string Name(); | 208 std::string Name(); |
| 209 // IsExactly returns true if this is the exact same type as that. For | 209 // IsExactly returns true if this is the exact same type as that. For |
| 210 // non-value types (e.g., callables), this returns this == that. | 210 // non-value types (e.g., callables), this returns this == that. |
| 211 bool IsExactly(AsmType* that); | 211 bool IsExactly(AsmType* that); |
| 212 // IsA is used to query whether this is an instance of that (i.e., if this is | 212 // IsA is used to query whether this is an instance of that (i.e., if this is |
| 213 // a type derived from that.) For non-value types (e.g., callables), this | 213 // a type derived from that.) For non-value types (e.g., callables), this |
| 214 // returns this == that. | 214 // returns this == that. |
| 215 bool IsA(AsmType* that); | 215 bool IsA(AsmType* that); |
| 216 | 216 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 246 // Returns the store type if this is a heap type. AsmType::None is returned if | 246 // Returns the store type if this is a heap type. AsmType::None is returned if |
| 247 // this is not a heap type. | 247 // this is not a heap type. |
| 248 AsmType* StoreType(); | 248 AsmType* StoreType(); |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 } // namespace wasm | 251 } // namespace wasm |
| 252 } // namespace internal | 252 } // namespace internal |
| 253 } // namespace v8 | 253 } // namespace v8 |
| 254 | 254 |
| 255 #endif // SRC_WASM_ASM_TYPES_H_ | 255 #endif // SRC_WASM_ASM_TYPES_H_ |
| OLD | NEW |