Reviewers: Sven Panne,
Description:
[turbofan] Mark MachineType as uint16_t.
This fixes a few funky implicit conversions for the enum (that are
inconsistent across compilers) and also helps to save space, i.e. for
the representations_ vector in the InstructionSequence.
[email protected]
Please review this at https://codereview.chromium.org/1182303003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+21, -17 lines):
M src/compiler/machine-type.h
Index: src/compiler/machine-type.h
diff --git a/src/compiler/machine-type.h b/src/compiler/machine-type.h
index
02719f270f01d7aeba5bf2f2c65818f4ff924b06..f152611a14bb7413edb65ec91452ff02260e6349
100644
--- a/src/compiler/machine-type.h
+++ b/src/compiler/machine-type.h
@@ -18,28 +18,28 @@ namespace compiler {
// Machine-level types and representations.
// TODO(titzer): Use the real type system instead of MachineType.
-enum MachineType {
+enum MachineType : uint16_t {
// Representations.
- kRepBit = 1 << 0,
- kRepWord8 = 1 << 1,
- kRepWord16 = 1 << 2,
- kRepWord32 = 1 << 3,
- kRepWord64 = 1 << 4,
- kRepFloat32 = 1 << 5,
- kRepFloat64 = 1 << 6,
- kRepTagged = 1 << 7,
+ kRepBit = 1u << 0,
+ kRepWord8 = 1u << 1,
+ kRepWord16 = 1u << 2,
+ kRepWord32 = 1u << 3,
+ kRepWord64 = 1u << 4,
+ kRepFloat32 = 1u << 5,
+ kRepFloat64 = 1u << 6,
+ kRepTagged = 1u << 7,
// Types.
- kTypeBool = 1 << 8,
- kTypeInt32 = 1 << 9,
- kTypeUint32 = 1 << 10,
- kTypeInt64 = 1 << 11,
- kTypeUint64 = 1 << 12,
- kTypeNumber = 1 << 13,
- kTypeAny = 1 << 14,
+ kTypeBool = 1u << 8,
+ kTypeInt32 = 1u << 9,
+ kTypeUint32 = 1u << 10,
+ kTypeInt64 = 1u << 11,
+ kTypeUint64 = 1u << 12,
+ kTypeNumber = 1u << 13,
+ kTypeAny = 1u << 14,
// Machine types.
- kMachNone = 0,
+ kMachNone = 0u,
kMachBool = kRepBit | kTypeBool,
kMachFloat32 = kRepFloat32 | kTypeNumber,
kMachFloat64 = kRepFloat64 | kTypeNumber,
@@ -57,6 +57,10 @@ enum MachineType {
kMachAnyTagged = kRepTagged | kTypeAny
};
+V8_INLINE size_t hash_value(MachineType type) {
+ return static_cast<size_t>(type);
+}
+
std::ostream& operator<<(std::ostream& os, const MachineType& type);
typedef uint16_t MachineTypeUnion;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.