Chromium Code Reviews| 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. | |
|
Mircea Trofin
2016/09/30 21:52:10
consider adding a marker here (kFirstFloat) and th
bbudge
2016/10/03 21:37:18
kFirstFPRepresentation
Done.
| |
| 29 kFloat32, | |
| 30 kFloat64, | |
| 31 kSimd128 | |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 const char* MachineReprToString(MachineRepresentation); | 34 const char* MachineReprToString(MachineRepresentation); |
| 34 | 35 |
| 35 enum class MachineSemantic : uint8_t { | 36 enum class MachineSemantic : uint8_t { |
| 36 kNone, | 37 kNone, |
| 37 kBool, | 38 kBool, |
| 38 kInt32, | 39 kInt32, |
| 39 kUint32, | 40 kUint32, |
| 40 kInt64, | 41 kInt64, |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 return static_cast<size_t>(type.representation()) + | 218 return static_cast<size_t>(type.representation()) + |
| 218 static_cast<size_t>(type.semantic()) * 16; | 219 static_cast<size_t>(type.semantic()) * 16; |
| 219 } | 220 } |
| 220 | 221 |
| 221 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 222 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
| 222 MachineRepresentation rep); | 223 MachineRepresentation rep); |
| 223 std::ostream& operator<<(std::ostream& os, MachineSemantic type); | 224 std::ostream& operator<<(std::ostream& os, MachineSemantic type); |
| 224 std::ostream& operator<<(std::ostream& os, MachineType type); | 225 std::ostream& operator<<(std::ostream& os, MachineType type); |
| 225 | 226 |
| 226 inline bool IsFloatingPoint(MachineRepresentation rep) { | 227 inline bool IsFloatingPoint(MachineRepresentation rep) { |
| 227 return rep == MachineRepresentation::kFloat32 || | 228 return rep >= MachineRepresentation::kFloat32; |
| 228 rep == MachineRepresentation::kFloat64 || | |
| 229 rep == MachineRepresentation::kSimd128; | |
| 230 } | 229 } |
| 231 | 230 |
| 232 inline bool CanBeTaggedPointer(MachineRepresentation rep) { | 231 inline bool CanBeTaggedPointer(MachineRepresentation rep) { |
| 233 return rep == MachineRepresentation::kTagged || | 232 return rep == MachineRepresentation::kTagged || |
| 234 rep == MachineRepresentation::kTaggedPointer; | 233 rep == MachineRepresentation::kTaggedPointer; |
| 235 } | 234 } |
| 236 | 235 |
| 237 inline bool IsAnyTagged(MachineRepresentation rep) { | 236 inline bool IsAnyTagged(MachineRepresentation rep) { |
| 238 return CanBeTaggedPointer(rep) || rep == MachineRepresentation::kTaggedSigned; | 237 return CanBeTaggedPointer(rep) || rep == MachineRepresentation::kTaggedSigned; |
| 239 } | 238 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 264 UNREACHABLE(); | 263 UNREACHABLE(); |
| 265 return -1; | 264 return -1; |
| 266 } | 265 } |
| 267 | 266 |
| 268 typedef Signature<MachineType> MachineSignature; | 267 typedef Signature<MachineType> MachineSignature; |
| 269 | 268 |
| 270 } // namespace internal | 269 } // namespace internal |
| 271 } // namespace v8 | 270 } // namespace v8 |
| 272 | 271 |
| 273 #endif // V8_MACHINE_TYPE_H_ | 272 #endif // V8_MACHINE_TYPE_H_ |
| OLD | NEW |