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_ASMJS_ASM_TYPES_H_ | 5 #ifndef SRC_ASMJS_ASM_TYPES_H_ |
6 #define SRC_ASMJS_ASM_TYPES_H_ | 6 #define SRC_ASMJS_ASM_TYPES_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "src/base/macros.h" | 10 #include "src/base/macros.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 /* Types used for expressing the Heap accesses. */ \ | 42 /* Types used for expressing the Heap accesses. */ \ |
43 V(Uint8Array, "Uint8Array", 14, kAsmHeap) \ | 43 V(Uint8Array, "Uint8Array", 14, kAsmHeap) \ |
44 V(Int8Array, "Int8Array", 15, kAsmHeap) \ | 44 V(Int8Array, "Int8Array", 15, kAsmHeap) \ |
45 V(Uint16Array, "Uint16Array", 16, kAsmHeap) \ | 45 V(Uint16Array, "Uint16Array", 16, kAsmHeap) \ |
46 V(Int16Array, "Int16Array", 17, kAsmHeap) \ | 46 V(Int16Array, "Int16Array", 17, kAsmHeap) \ |
47 V(Uint32Array, "Uint32Array", 18, kAsmHeap) \ | 47 V(Uint32Array, "Uint32Array", 18, kAsmHeap) \ |
48 V(Int32Array, "Int32Array", 19, kAsmHeap) \ | 48 V(Int32Array, "Int32Array", 19, kAsmHeap) \ |
49 V(Float32Array, "Float32Array", 20, kAsmHeap) \ | 49 V(Float32Array, "Float32Array", 20, kAsmHeap) \ |
50 V(Float64Array, "Float64Array", 21, kAsmHeap) \ | 50 V(Float64Array, "Float64Array", 21, kAsmHeap) \ |
51 /* Pseudo-types used in representing heap access for fp types.*/ \ | 51 /* Pseudo-types used in representing heap access for fp types.*/ \ |
52 /* DESIGN FLAW: FloatishDoubleQ should be a base type.*/ \ | |
bradn
2016/07/11 17:55:33
Maybe TODO ? More searchable?
John
2016/07/12 21:13:15
Done.
| |
52 V(FloatishDoubleQ, "floatish|double?", 22, kAsmFloatish | kAsmDoubleQ) \ | 53 V(FloatishDoubleQ, "floatish|double?", 22, kAsmFloatish | kAsmDoubleQ) \ |
54 /* DESIGN FLAW: FloatQDoubleQ should be a base type.*/ \ | |
53 V(FloatQDoubleQ, "float?|double?", 23, kAsmFloatQ | kAsmDoubleQ) \ | 55 V(FloatQDoubleQ, "float?|double?", 23, kAsmFloatQ | kAsmDoubleQ) \ |
54 /* None is used to represent errors in the type checker. */ \ | 56 /* None is used to represent errors in the type checker. */ \ |
55 V(None, "<none>", 31, 0) | 57 V(None, "<none>", 31, 0) |
56 | 58 |
57 // List of V(CamelName) | 59 // List of V(CamelName) |
58 #define FOR_EACH_ASM_CALLABLE_TYPE_LIST(V) \ | 60 #define FOR_EACH_ASM_CALLABLE_TYPE_LIST(V) \ |
59 V(FunctionType) \ | 61 V(FunctionType) \ |
60 V(FFIType) \ | 62 V(FFIType) \ |
61 V(OverloadedFunctionType) \ | 63 V(OverloadedFunctionType) \ |
62 V(FunctionTableType) | 64 V(FunctionTableType) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 public: | 127 public: |
126 AsmFunctionType* AsFunctionType() final { return this; } | 128 AsmFunctionType* AsFunctionType() final { return this; } |
127 | 129 |
128 void AddArgument(AsmType* type) { args_.push_back(type); } | 130 void AddArgument(AsmType* type) { args_.push_back(type); } |
129 const ZoneVector<AsmType*> Arguments() const { return args_; } | 131 const ZoneVector<AsmType*> Arguments() const { return args_; } |
130 AsmType* ReturnType() const { return return_type_; } | 132 AsmType* ReturnType() const { return return_type_; } |
131 | 133 |
132 virtual bool IsMinMaxType() const { return false; } | 134 virtual bool IsMinMaxType() const { return false; } |
133 virtual bool IsFroundType() const { return false; } | 135 virtual bool IsFroundType() const { return false; } |
134 | 136 |
137 AsmType* ValidateCall(AsmType* return_type, | |
138 const ZoneVector<AsmType*>& args) override; | |
139 | |
135 protected: | 140 protected: |
136 AsmFunctionType(Zone* zone, AsmType* return_type) | 141 AsmFunctionType(Zone* zone, AsmType* return_type) |
137 : return_type_(return_type), args_(zone) {} | 142 : return_type_(return_type), args_(zone) {} |
138 | 143 |
139 private: | 144 private: |
140 friend AsmType; | 145 friend AsmType; |
141 | 146 |
142 std::string Name() override; | 147 std::string Name() override; |
143 AsmType* ValidateCall(AsmType* return_type, | |
144 const ZoneVector<AsmType*>& args) override; | |
145 | 148 |
146 AsmType* return_type_; | 149 AsmType* return_type_; |
147 ZoneVector<AsmType*> args_; | 150 ZoneVector<AsmType*> args_; |
148 | 151 |
149 DISALLOW_COPY_AND_ASSIGN(AsmFunctionType); | 152 DISALLOW_COPY_AND_ASSIGN(AsmFunctionType); |
150 }; | 153 }; |
151 | 154 |
152 class AsmOverloadedFunctionType final : public AsmCallableType { | 155 class AsmOverloadedFunctionType final : public AsmCallableType { |
153 public: | 156 public: |
154 AsmOverloadedFunctionType* AsOverloadedFunctionType() override { | 157 AsmOverloadedFunctionType* AsOverloadedFunctionType() override { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 class AsmFunctionTableType : public AsmCallableType { | 193 class AsmFunctionTableType : public AsmCallableType { |
191 public: | 194 public: |
192 AsmFunctionTableType* AsFunctionTableType() override { return this; } | 195 AsmFunctionTableType* AsFunctionTableType() override { return this; } |
193 | 196 |
194 std::string Name() override; | 197 std::string Name() override; |
195 | 198 |
196 AsmType* ValidateCall(AsmType* return_type, | 199 AsmType* ValidateCall(AsmType* return_type, |
197 const ZoneVector<AsmType*>& args) override; | 200 const ZoneVector<AsmType*>& args) override; |
198 | 201 |
199 size_t length() const { return length_; } | 202 size_t length() const { return length_; } |
203 AsmType* signature() { return signature_; } | |
200 | 204 |
201 private: | 205 private: |
202 friend class AsmType; | 206 friend class AsmType; |
203 | 207 |
204 AsmFunctionTableType(size_t length, AsmType* signature); | 208 AsmFunctionTableType(size_t length, AsmType* signature); |
205 | 209 |
206 size_t length_; | 210 size_t length_; |
207 AsmType* signature_; | 211 AsmType* signature_; |
208 | 212 |
209 DISALLOW_IMPLICIT_CONSTRUCTORS(AsmFunctionTableType); | 213 DISALLOW_IMPLICIT_CONSTRUCTORS(AsmFunctionTableType); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 // Returns the store type if this is a heap type. AsmType::None is returned if | 339 // Returns the store type if this is a heap type. AsmType::None is returned if |
336 // this is not a heap type. | 340 // this is not a heap type. |
337 AsmType* StoreType(); | 341 AsmType* StoreType(); |
338 }; | 342 }; |
339 | 343 |
340 } // namespace wasm | 344 } // namespace wasm |
341 } // namespace internal | 345 } // namespace internal |
342 } // namespace v8 | 346 } // namespace v8 |
343 | 347 |
344 #endif // SRC_WASM_ASM_TYPES_H_ | 348 #endif // SRC_WASM_ASM_TYPES_H_ |
OLD | NEW |