OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 V8_MACHINE_TYPE_H_ | 5 #ifndef V8_MACHINE_TYPE_H_ |
6 #define V8_MACHINE_TYPE_H_ | 6 #define V8_MACHINE_TYPE_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
11 #include "src/globals.h" | 11 #include "src/globals.h" |
12 #include "src/signature.h" | 12 #include "src/signature.h" |
13 #include "src/zone.h" | 13 #include "src/zone.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 enum class MachineRepresentation : uint8_t { | 18 enum class MachineRepresentation : uint8_t { |
19 kNone, | 19 kNone, |
20 kBit, | 20 kBit, |
21 kWord8, | 21 kWord8, |
22 kWord16, | 22 kWord16, |
23 kWord32, | 23 kWord32, |
24 kWord64, | 24 kWord64, |
25 kFloat32, | 25 kFloat32, |
26 kFloat64, | 26 kFloat64, |
| 27 kSimd128, |
27 kTagged | 28 kTagged |
28 }; | 29 }; |
29 | 30 |
30 enum class MachineSemantic : uint8_t { | 31 enum class MachineSemantic : uint8_t { |
31 kNone, | 32 kNone, |
32 kBool, | 33 kBool, |
33 kInt32, | 34 kInt32, |
34 kUint32, | 35 kUint32, |
35 kInt64, | 36 kInt64, |
36 kUint64, | 37 kUint64, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return (kPointerSize == 4) ? Int32() : Int64(); | 78 return (kPointerSize == 4) ? Int32() : Int64(); |
78 } | 79 } |
79 static MachineType Float32() { | 80 static MachineType Float32() { |
80 return MachineType(MachineRepresentation::kFloat32, | 81 return MachineType(MachineRepresentation::kFloat32, |
81 MachineSemantic::kNumber); | 82 MachineSemantic::kNumber); |
82 } | 83 } |
83 static MachineType Float64() { | 84 static MachineType Float64() { |
84 return MachineType(MachineRepresentation::kFloat64, | 85 return MachineType(MachineRepresentation::kFloat64, |
85 MachineSemantic::kNumber); | 86 MachineSemantic::kNumber); |
86 } | 87 } |
| 88 static MachineType Simd128() { |
| 89 return MachineType(MachineRepresentation::kSimd128, MachineSemantic::kNone); |
| 90 } |
87 static MachineType Int8() { | 91 static MachineType Int8() { |
88 return MachineType(MachineRepresentation::kWord8, MachineSemantic::kInt32); | 92 return MachineType(MachineRepresentation::kWord8, MachineSemantic::kInt32); |
89 } | 93 } |
90 static MachineType Uint8() { | 94 static MachineType Uint8() { |
91 return MachineType(MachineRepresentation::kWord8, MachineSemantic::kUint32); | 95 return MachineType(MachineRepresentation::kWord8, MachineSemantic::kUint32); |
92 } | 96 } |
93 static MachineType Int16() { | 97 static MachineType Int16() { |
94 return MachineType(MachineRepresentation::kWord16, MachineSemantic::kInt32); | 98 return MachineType(MachineRepresentation::kWord16, MachineSemantic::kInt32); |
95 } | 99 } |
96 static MachineType Uint16() { | 100 static MachineType Uint16() { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 140 } |
137 static MachineType RepWord64() { | 141 static MachineType RepWord64() { |
138 return MachineType(MachineRepresentation::kWord64, MachineSemantic::kNone); | 142 return MachineType(MachineRepresentation::kWord64, MachineSemantic::kNone); |
139 } | 143 } |
140 static MachineType RepFloat32() { | 144 static MachineType RepFloat32() { |
141 return MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone); | 145 return MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone); |
142 } | 146 } |
143 static MachineType RepFloat64() { | 147 static MachineType RepFloat64() { |
144 return MachineType(MachineRepresentation::kFloat64, MachineSemantic::kNone); | 148 return MachineType(MachineRepresentation::kFloat64, MachineSemantic::kNone); |
145 } | 149 } |
| 150 static MachineType RepSimd128() { |
| 151 return MachineType(MachineRepresentation::kSimd128, MachineSemantic::kNone); |
| 152 } |
146 static MachineType RepTagged() { | 153 static MachineType RepTagged() { |
147 return MachineType(MachineRepresentation::kTagged, MachineSemantic::kNone); | 154 return MachineType(MachineRepresentation::kTagged, MachineSemantic::kNone); |
148 } | 155 } |
149 static MachineType RepBit() { | 156 static MachineType RepBit() { |
150 return MachineType(MachineRepresentation::kBit, MachineSemantic::kNone); | 157 return MachineType(MachineRepresentation::kBit, MachineSemantic::kNone); |
151 } | 158 } |
152 | 159 |
153 private: | 160 private: |
154 MachineRepresentation representation_; | 161 MachineRepresentation representation_; |
155 MachineSemantic semantic_; | 162 MachineSemantic semantic_; |
(...skipping 24 matching lines...) Expand all Loading... |
180 case MachineRepresentation::kWord8: | 187 case MachineRepresentation::kWord8: |
181 return 0; | 188 return 0; |
182 case MachineRepresentation::kWord16: | 189 case MachineRepresentation::kWord16: |
183 return 1; | 190 return 1; |
184 case MachineRepresentation::kWord32: | 191 case MachineRepresentation::kWord32: |
185 case MachineRepresentation::kFloat32: | 192 case MachineRepresentation::kFloat32: |
186 return 2; | 193 return 2; |
187 case MachineRepresentation::kWord64: | 194 case MachineRepresentation::kWord64: |
188 case MachineRepresentation::kFloat64: | 195 case MachineRepresentation::kFloat64: |
189 return 3; | 196 return 3; |
| 197 case MachineRepresentation::kSimd128: |
| 198 return 4; |
190 case MachineRepresentation::kTagged: | 199 case MachineRepresentation::kTagged: |
191 return kPointerSizeLog2; | 200 return kPointerSizeLog2; |
192 default: | 201 default: |
193 break; | 202 break; |
194 } | 203 } |
195 UNREACHABLE(); | 204 UNREACHABLE(); |
196 return -1; | 205 return -1; |
197 } | 206 } |
198 | 207 |
199 typedef Signature<MachineType> MachineSignature; | 208 typedef Signature<MachineType> MachineSignature; |
200 | 209 |
201 } // namespace internal | 210 } // namespace internal |
202 } // namespace v8 | 211 } // namespace v8 |
203 | 212 |
204 #endif // V8_MACHINE_TYPE_H_ | 213 #endif // V8_MACHINE_TYPE_H_ |
OLD | NEW |