| 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 11 matching lines...) Expand all Loading... |
| 22 kWord16, | 22 kWord16, |
| 23 kWord32, | 23 kWord32, |
| 24 kWord64, | 24 kWord64, |
| 25 kTaggedSigned, | 25 kTaggedSigned, |
| 26 kTaggedPointer, | 26 kTaggedPointer, |
| 27 kTagged, | 27 kTagged, |
| 28 // FP representations must be last, and in order of increasing size. | 28 // FP representations must be last, and in order of increasing size. |
| 29 kFloat32, | 29 kFloat32, |
| 30 kFloat64, | 30 kFloat64, |
| 31 kSimd128, | 31 kSimd128, |
| 32 kSimd1x4, // SIMD boolean vector types. | |
| 33 kSimd1x8, | |
| 34 kSimd1x16, | |
| 35 kFirstFPRepresentation = kFloat32, | 32 kFirstFPRepresentation = kFloat32, |
| 36 kLastRepresentation = kSimd1x16 | 33 kLastRepresentation = kSimd128 |
| 37 }; | 34 }; |
| 38 | 35 |
| 39 static_assert(static_cast<int>(MachineRepresentation::kLastRepresentation) < | 36 static_assert(static_cast<int>(MachineRepresentation::kLastRepresentation) < |
| 40 kIntSize * kBitsPerByte, | 37 kIntSize * kBitsPerByte, |
| 41 "Bit masks of MachineRepresentation should fit in an int"); | 38 "Bit masks of MachineRepresentation should fit in an int"); |
| 42 | 39 |
| 43 const char* MachineReprToString(MachineRepresentation); | 40 const char* MachineReprToString(MachineRepresentation); |
| 44 | 41 |
| 45 enum class MachineSemantic { | 42 enum class MachineSemantic { |
| 46 kNone, | 43 kNone, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return MachineType(MachineRepresentation::kFloat32, | 120 return MachineType(MachineRepresentation::kFloat32, |
| 124 MachineSemantic::kNumber); | 121 MachineSemantic::kNumber); |
| 125 } | 122 } |
| 126 static MachineType Float64() { | 123 static MachineType Float64() { |
| 127 return MachineType(MachineRepresentation::kFloat64, | 124 return MachineType(MachineRepresentation::kFloat64, |
| 128 MachineSemantic::kNumber); | 125 MachineSemantic::kNumber); |
| 129 } | 126 } |
| 130 static MachineType Simd128() { | 127 static MachineType Simd128() { |
| 131 return MachineType(MachineRepresentation::kSimd128, MachineSemantic::kNone); | 128 return MachineType(MachineRepresentation::kSimd128, MachineSemantic::kNone); |
| 132 } | 129 } |
| 133 static MachineType Simd1x4() { | |
| 134 return MachineType(MachineRepresentation::kSimd1x4, MachineSemantic::kNone); | |
| 135 } | |
| 136 static MachineType Simd1x8() { | |
| 137 return MachineType(MachineRepresentation::kSimd1x8, MachineSemantic::kNone); | |
| 138 } | |
| 139 static MachineType Simd1x16() { | |
| 140 return MachineType(MachineRepresentation::kSimd1x16, | |
| 141 MachineSemantic::kNone); | |
| 142 } | |
| 143 static MachineType Pointer() { | 130 static MachineType Pointer() { |
| 144 return MachineType(PointerRepresentation(), MachineSemantic::kNone); | 131 return MachineType(PointerRepresentation(), MachineSemantic::kNone); |
| 145 } | 132 } |
| 146 static MachineType TaggedPointer() { | 133 static MachineType TaggedPointer() { |
| 147 return MachineType(MachineRepresentation::kTaggedPointer, | 134 return MachineType(MachineRepresentation::kTaggedPointer, |
| 148 MachineSemantic::kAny); | 135 MachineSemantic::kAny); |
| 149 } | 136 } |
| 150 static MachineType TaggedSigned() { | 137 static MachineType TaggedSigned() { |
| 151 return MachineType(MachineRepresentation::kTaggedSigned, | 138 return MachineType(MachineRepresentation::kTaggedSigned, |
| 152 MachineSemantic::kInt32); | 139 MachineSemantic::kInt32); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 179 } | 166 } |
| 180 static MachineType RepFloat32() { | 167 static MachineType RepFloat32() { |
| 181 return MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone); | 168 return MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone); |
| 182 } | 169 } |
| 183 static MachineType RepFloat64() { | 170 static MachineType RepFloat64() { |
| 184 return MachineType(MachineRepresentation::kFloat64, MachineSemantic::kNone); | 171 return MachineType(MachineRepresentation::kFloat64, MachineSemantic::kNone); |
| 185 } | 172 } |
| 186 static MachineType RepSimd128() { | 173 static MachineType RepSimd128() { |
| 187 return MachineType(MachineRepresentation::kSimd128, MachineSemantic::kNone); | 174 return MachineType(MachineRepresentation::kSimd128, MachineSemantic::kNone); |
| 188 } | 175 } |
| 189 static MachineType RepSimd1x4() { | |
| 190 return MachineType(MachineRepresentation::kSimd1x4, MachineSemantic::kNone); | |
| 191 } | |
| 192 static MachineType RepSimd1x8() { | |
| 193 return MachineType(MachineRepresentation::kSimd1x8, MachineSemantic::kNone); | |
| 194 } | |
| 195 static MachineType RepSimd1x16() { | |
| 196 return MachineType(MachineRepresentation::kSimd1x16, | |
| 197 MachineSemantic::kNone); | |
| 198 } | |
| 199 static MachineType RepTagged() { | 176 static MachineType RepTagged() { |
| 200 return MachineType(MachineRepresentation::kTagged, MachineSemantic::kNone); | 177 return MachineType(MachineRepresentation::kTagged, MachineSemantic::kNone); |
| 201 } | 178 } |
| 202 static MachineType RepBit() { | 179 static MachineType RepBit() { |
| 203 return MachineType(MachineRepresentation::kBit, MachineSemantic::kNone); | 180 return MachineType(MachineRepresentation::kBit, MachineSemantic::kNone); |
| 204 } | 181 } |
| 205 | 182 |
| 206 static MachineType TypeForRepresentation(const MachineRepresentation& rep, | 183 static MachineType TypeForRepresentation(const MachineRepresentation& rep, |
| 207 bool isSigned = true) { | 184 bool isSigned = true) { |
| 208 switch (rep) { | 185 switch (rep) { |
| 209 case MachineRepresentation::kNone: | 186 case MachineRepresentation::kNone: |
| 210 return MachineType::None(); | 187 return MachineType::None(); |
| 211 case MachineRepresentation::kBit: | 188 case MachineRepresentation::kBit: |
| 212 return MachineType::Bool(); | 189 return MachineType::Bool(); |
| 213 case MachineRepresentation::kWord8: | 190 case MachineRepresentation::kWord8: |
| 214 return isSigned ? MachineType::Int8() : MachineType::Uint8(); | 191 return isSigned ? MachineType::Int8() : MachineType::Uint8(); |
| 215 case MachineRepresentation::kWord16: | 192 case MachineRepresentation::kWord16: |
| 216 return isSigned ? MachineType::Int16() : MachineType::Uint16(); | 193 return isSigned ? MachineType::Int16() : MachineType::Uint16(); |
| 217 case MachineRepresentation::kWord32: | 194 case MachineRepresentation::kWord32: |
| 218 return isSigned ? MachineType::Int32() : MachineType::Uint32(); | 195 return isSigned ? MachineType::Int32() : MachineType::Uint32(); |
| 219 case MachineRepresentation::kWord64: | 196 case MachineRepresentation::kWord64: |
| 220 return isSigned ? MachineType::Int64() : MachineType::Uint64(); | 197 return isSigned ? MachineType::Int64() : MachineType::Uint64(); |
| 221 case MachineRepresentation::kFloat32: | 198 case MachineRepresentation::kFloat32: |
| 222 return MachineType::Float32(); | 199 return MachineType::Float32(); |
| 223 case MachineRepresentation::kFloat64: | 200 case MachineRepresentation::kFloat64: |
| 224 return MachineType::Float64(); | 201 return MachineType::Float64(); |
| 225 case MachineRepresentation::kSimd128: | 202 case MachineRepresentation::kSimd128: |
| 226 return MachineType::Simd128(); | 203 return MachineType::Simd128(); |
| 227 case MachineRepresentation::kSimd1x4: | |
| 228 return MachineType::Simd1x4(); | |
| 229 case MachineRepresentation::kSimd1x8: | |
| 230 return MachineType::Simd1x8(); | |
| 231 case MachineRepresentation::kSimd1x16: | |
| 232 return MachineType::Simd1x16(); | |
| 233 case MachineRepresentation::kTagged: | 204 case MachineRepresentation::kTagged: |
| 234 return MachineType::AnyTagged(); | 205 return MachineType::AnyTagged(); |
| 235 case MachineRepresentation::kTaggedSigned: | 206 case MachineRepresentation::kTaggedSigned: |
| 236 return MachineType::TaggedSigned(); | 207 return MachineType::TaggedSigned(); |
| 237 case MachineRepresentation::kTaggedPointer: | 208 case MachineRepresentation::kTaggedPointer: |
| 238 return MachineType::TaggedPointer(); | 209 return MachineType::TaggedPointer(); |
| 239 default: | 210 default: |
| 240 UNREACHABLE(); | 211 UNREACHABLE(); |
| 241 } | 212 } |
| 242 } | 213 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 274 } |
| 304 UNREACHABLE(); | 275 UNREACHABLE(); |
| 305 } | 276 } |
| 306 | 277 |
| 307 typedef Signature<MachineType> MachineSignature; | 278 typedef Signature<MachineType> MachineSignature; |
| 308 | 279 |
| 309 } // namespace internal | 280 } // namespace internal |
| 310 } // namespace v8 | 281 } // namespace v8 |
| 311 | 282 |
| 312 #endif // V8_MACHINE_TYPE_H_ | 283 #endif // V8_MACHINE_TYPE_H_ |
| OLD | NEW |