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/zone.h" | 13 #include "src/zone/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, | |
26 kFloat64, // must follow kFloat32 | |
27 kSimd128, // must follow kFloat64 | |
28 kTaggedSigned, | 25 kTaggedSigned, |
29 kTaggedPointer, | 26 kTaggedPointer, |
30 kTagged | 27 kTagged, |
| 28 // FP representations must be last, and in order of increasing size. |
| 29 kFloat32, |
| 30 kFloat64, |
| 31 kSimd128, |
| 32 kFirstFPRepresentation = kFloat32 |
31 }; | 33 }; |
32 | 34 |
33 const char* MachineReprToString(MachineRepresentation); | 35 const char* MachineReprToString(MachineRepresentation); |
34 | 36 |
35 enum class MachineSemantic : uint8_t { | 37 enum class MachineSemantic : uint8_t { |
36 kNone, | 38 kNone, |
37 kBool, | 39 kBool, |
38 kInt32, | 40 kInt32, |
39 kUint32, | 41 kUint32, |
40 kInt64, | 42 kInt64, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return static_cast<size_t>(type.representation()) + | 219 return static_cast<size_t>(type.representation()) + |
218 static_cast<size_t>(type.semantic()) * 16; | 220 static_cast<size_t>(type.semantic()) * 16; |
219 } | 221 } |
220 | 222 |
221 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 223 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
222 MachineRepresentation rep); | 224 MachineRepresentation rep); |
223 std::ostream& operator<<(std::ostream& os, MachineSemantic type); | 225 std::ostream& operator<<(std::ostream& os, MachineSemantic type); |
224 std::ostream& operator<<(std::ostream& os, MachineType type); | 226 std::ostream& operator<<(std::ostream& os, MachineType type); |
225 | 227 |
226 inline bool IsFloatingPoint(MachineRepresentation rep) { | 228 inline bool IsFloatingPoint(MachineRepresentation rep) { |
227 return rep == MachineRepresentation::kFloat32 || | 229 return rep >= MachineRepresentation::kFirstFPRepresentation; |
228 rep == MachineRepresentation::kFloat64 || | |
229 rep == MachineRepresentation::kSimd128; | |
230 } | 230 } |
231 | 231 |
232 inline bool CanBeTaggedPointer(MachineRepresentation rep) { | 232 inline bool CanBeTaggedPointer(MachineRepresentation rep) { |
233 return rep == MachineRepresentation::kTagged || | 233 return rep == MachineRepresentation::kTagged || |
234 rep == MachineRepresentation::kTaggedPointer; | 234 rep == MachineRepresentation::kTaggedPointer; |
235 } | 235 } |
236 | 236 |
237 inline bool IsAnyTagged(MachineRepresentation rep) { | 237 inline bool IsAnyTagged(MachineRepresentation rep) { |
238 return CanBeTaggedPointer(rep) || rep == MachineRepresentation::kTaggedSigned; | 238 return CanBeTaggedPointer(rep) || rep == MachineRepresentation::kTaggedSigned; |
239 } | 239 } |
(...skipping 24 matching lines...) Expand all Loading... |
264 UNREACHABLE(); | 264 UNREACHABLE(); |
265 return -1; | 265 return -1; |
266 } | 266 } |
267 | 267 |
268 typedef Signature<MachineType> MachineSignature; | 268 typedef Signature<MachineType> MachineSignature; |
269 | 269 |
270 } // namespace internal | 270 } // namespace internal |
271 } // namespace v8 | 271 } // namespace v8 |
272 | 272 |
273 #endif // V8_MACHINE_TYPE_H_ | 273 #endif // V8_MACHINE_TYPE_H_ |
OLD | NEW |