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