Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: src/compiler/machine-type.h

Issue 1182303003: [turbofan] Mark MachineType as uint16_t. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698