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