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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool IsNone() { return representation() == MachineRepresentation::kNone; } | 72 bool IsNone() { return representation() == MachineRepresentation::kNone; } |
73 | 73 |
74 bool IsSigned() { | 74 bool IsSigned() { |
75 return semantic() == MachineSemantic::kInt32 || | 75 return semantic() == MachineSemantic::kInt32 || |
76 semantic() == MachineSemantic::kInt64; | 76 semantic() == MachineSemantic::kInt64; |
77 } | 77 } |
78 bool IsUnsigned() { | 78 bool IsUnsigned() { |
79 return semantic() == MachineSemantic::kUint32 || | 79 return semantic() == MachineSemantic::kUint32 || |
80 semantic() == MachineSemantic::kUint64; | 80 semantic() == MachineSemantic::kUint64; |
81 } | 81 } |
82 | |
83 static MachineRepresentation PointerRepresentation() { | 82 static MachineRepresentation PointerRepresentation() { |
84 return (kPointerSize == 4) ? MachineRepresentation::kWord32 | 83 return (kPointerSize == 4) ? MachineRepresentation::kWord32 |
85 : MachineRepresentation::kWord64; | 84 : MachineRepresentation::kWord64; |
86 } | 85 } |
87 static MachineType Pointer() { | 86 static MachineType UintPtr() { |
88 return MachineType(PointerRepresentation(), MachineSemantic::kNone); | 87 return (kPointerSize == 4) ? Uint32() : Uint64(); |
89 } | 88 } |
90 static MachineType IntPtr() { | 89 static MachineType IntPtr() { |
91 return (kPointerSize == 4) ? Int32() : Int64(); | 90 return (kPointerSize == 4) ? Int32() : Int64(); |
92 } | 91 } |
93 static MachineType Float32() { | |
94 return MachineType(MachineRepresentation::kFloat32, | |
95 MachineSemantic::kNumber); | |
96 } | |
97 static MachineType Float64() { | |
98 return MachineType(MachineRepresentation::kFloat64, | |
99 MachineSemantic::kNumber); | |
100 } | |
101 static MachineType Simd128() { | |
102 return MachineType(MachineRepresentation::kSimd128, MachineSemantic::kNone); | |
103 } | |
104 static MachineType Int8() { | 92 static MachineType Int8() { |
105 return MachineType(MachineRepresentation::kWord8, MachineSemantic::kInt32); | 93 return MachineType(MachineRepresentation::kWord8, MachineSemantic::kInt32); |
106 } | 94 } |
107 static MachineType Uint8() { | 95 static MachineType Uint8() { |
108 return MachineType(MachineRepresentation::kWord8, MachineSemantic::kUint32); | 96 return MachineType(MachineRepresentation::kWord8, MachineSemantic::kUint32); |
109 } | 97 } |
110 static MachineType Int16() { | 98 static MachineType Int16() { |
111 return MachineType(MachineRepresentation::kWord16, MachineSemantic::kInt32); | 99 return MachineType(MachineRepresentation::kWord16, MachineSemantic::kInt32); |
112 } | 100 } |
113 static MachineType Uint16() { | 101 static MachineType Uint16() { |
114 return MachineType(MachineRepresentation::kWord16, | 102 return MachineType(MachineRepresentation::kWord16, |
115 MachineSemantic::kUint32); | 103 MachineSemantic::kUint32); |
116 } | 104 } |
117 static MachineType Int32() { | 105 static MachineType Int32() { |
118 return MachineType(MachineRepresentation::kWord32, MachineSemantic::kInt32); | 106 return MachineType(MachineRepresentation::kWord32, MachineSemantic::kInt32); |
119 } | 107 } |
120 static MachineType Uint32() { | 108 static MachineType Uint32() { |
121 return MachineType(MachineRepresentation::kWord32, | 109 return MachineType(MachineRepresentation::kWord32, |
122 MachineSemantic::kUint32); | 110 MachineSemantic::kUint32); |
123 } | 111 } |
124 static MachineType Int64() { | 112 static MachineType Int64() { |
125 return MachineType(MachineRepresentation::kWord64, MachineSemantic::kInt64); | 113 return MachineType(MachineRepresentation::kWord64, MachineSemantic::kInt64); |
126 } | 114 } |
127 static MachineType Uint64() { | 115 static MachineType Uint64() { |
128 return MachineType(MachineRepresentation::kWord64, | 116 return MachineType(MachineRepresentation::kWord64, |
129 MachineSemantic::kUint64); | 117 MachineSemantic::kUint64); |
130 } | 118 } |
| 119 static MachineType Float32() { |
| 120 return MachineType(MachineRepresentation::kFloat32, |
| 121 MachineSemantic::kNumber); |
| 122 } |
| 123 static MachineType Float64() { |
| 124 return MachineType(MachineRepresentation::kFloat64, |
| 125 MachineSemantic::kNumber); |
| 126 } |
| 127 static MachineType Simd128() { |
| 128 return MachineType(MachineRepresentation::kSimd128, MachineSemantic::kNone); |
| 129 } |
| 130 static MachineType Pointer() { |
| 131 return MachineType(PointerRepresentation(), MachineSemantic::kNone); |
| 132 } |
131 static MachineType TaggedPointer() { | 133 static MachineType TaggedPointer() { |
132 return MachineType(MachineRepresentation::kTaggedPointer, | 134 return MachineType(MachineRepresentation::kTaggedPointer, |
133 MachineSemantic::kAny); | 135 MachineSemantic::kAny); |
134 } | 136 } |
135 static MachineType TaggedSigned() { | 137 static MachineType TaggedSigned() { |
136 return MachineType(MachineRepresentation::kTaggedSigned, | 138 return MachineType(MachineRepresentation::kTaggedSigned, |
137 MachineSemantic::kInt32); | 139 MachineSemantic::kInt32); |
138 } | 140 } |
139 static MachineType AnyTagged() { | 141 static MachineType AnyTagged() { |
140 return MachineType(MachineRepresentation::kTagged, MachineSemantic::kAny); | 142 return MachineType(MachineRepresentation::kTagged, MachineSemantic::kAny); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 UNREACHABLE(); | 276 UNREACHABLE(); |
275 return -1; | 277 return -1; |
276 } | 278 } |
277 | 279 |
278 typedef Signature<MachineType> MachineSignature; | 280 typedef Signature<MachineType> MachineSignature; |
279 | 281 |
280 } // namespace internal | 282 } // namespace internal |
281 } // namespace v8 | 283 } // namespace v8 |
282 | 284 |
283 #endif // V8_MACHINE_TYPE_H_ | 285 #endif // V8_MACHINE_TYPE_H_ |
OLD | NEW |