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" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 MachineSemantic semantic() const { return semantic_; } | 59 MachineSemantic semantic() const { return semantic_; } |
60 | 60 |
61 bool IsSigned() { | 61 bool IsSigned() { |
62 return semantic() == MachineSemantic::kInt32 || | 62 return semantic() == MachineSemantic::kInt32 || |
63 semantic() == MachineSemantic::kInt64; | 63 semantic() == MachineSemantic::kInt64; |
64 } | 64 } |
65 bool IsUnsigned() { | 65 bool IsUnsigned() { |
66 return semantic() == MachineSemantic::kUint32 || | 66 return semantic() == MachineSemantic::kUint32 || |
67 semantic() == MachineSemantic::kUint64; | 67 semantic() == MachineSemantic::kUint64; |
68 } | 68 } |
| 69 bool IsWidestSize() { |
| 70 switch (representation()) { |
| 71 case MachineRepresentation::kWord64: |
| 72 case MachineRepresentation::kFloat64: |
| 73 case MachineRepresentation::kTagged: |
| 74 return true; |
| 75 case MachineRepresentation::kNone: |
| 76 case MachineRepresentation::kBit: |
| 77 case MachineRepresentation::kWord8: |
| 78 case MachineRepresentation::kWord16: |
| 79 case MachineRepresentation::kWord32: |
| 80 case MachineRepresentation::kFloat32: |
| 81 return false; |
| 82 default: |
| 83 break; |
| 84 } |
| 85 // kSimd128 is not in use yet. |
| 86 UNREACHABLE(); |
| 87 return false; |
| 88 } |
69 | 89 |
70 static MachineRepresentation PointerRepresentation() { | 90 static MachineRepresentation PointerRepresentation() { |
71 return (kPointerSize == 4) ? MachineRepresentation::kWord32 | 91 return (kPointerSize == 4) ? MachineRepresentation::kWord32 |
72 : MachineRepresentation::kWord64; | 92 : MachineRepresentation::kWord64; |
73 } | 93 } |
74 static MachineType Pointer() { | 94 static MachineType Pointer() { |
75 return MachineType(PointerRepresentation(), MachineSemantic::kNone); | 95 return MachineType(PointerRepresentation(), MachineSemantic::kNone); |
76 } | 96 } |
77 static MachineType IntPtr() { | 97 static MachineType IntPtr() { |
78 return (kPointerSize == 4) ? Int32() : Int64(); | 98 return (kPointerSize == 4) ? Int32() : Int64(); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 UNREACHABLE(); | 225 UNREACHABLE(); |
206 return -1; | 226 return -1; |
207 } | 227 } |
208 | 228 |
209 typedef Signature<MachineType> MachineSignature; | 229 typedef Signature<MachineType> MachineSignature; |
210 | 230 |
211 } // namespace internal | 231 } // namespace internal |
212 } // namespace v8 | 232 } // namespace v8 |
213 | 233 |
214 #endif // V8_MACHINE_TYPE_H_ | 234 #endif // V8_MACHINE_TYPE_H_ |
OLD | NEW |