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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_COMPILER_MACHINE_TYPE_H_ 5 #ifndef V8_COMPILER_MACHINE_TYPE_H_
6 #define V8_COMPILER_MACHINE_TYPE_H_ 6 #define V8_COMPILER_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.h" 13 #include "src/zone.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 namespace compiler { 17 namespace compiler {
18 18
19 // Machine-level types and representations. 19 // Machine-level types and representations.
20 // TODO(titzer): Use the real type system instead of MachineType. 20 // TODO(titzer): Use the real type system instead of MachineType.
21 enum MachineType { 21 enum MachineType : uint16_t {
22 // Representations. 22 // Representations.
23 kRepBit = 1 << 0, 23 kRepBit = 1u << 0,
24 kRepWord8 = 1 << 1, 24 kRepWord8 = 1u << 1,
25 kRepWord16 = 1 << 2, 25 kRepWord16 = 1u << 2,
26 kRepWord32 = 1 << 3, 26 kRepWord32 = 1u << 3,
27 kRepWord64 = 1 << 4, 27 kRepWord64 = 1u << 4,
28 kRepFloat32 = 1 << 5, 28 kRepFloat32 = 1u << 5,
29 kRepFloat64 = 1 << 6, 29 kRepFloat64 = 1u << 6,
30 kRepTagged = 1 << 7, 30 kRepTagged = 1u << 7,
31 31
32 // Types. 32 // Types.
33 kTypeBool = 1 << 8, 33 kTypeBool = 1u << 8,
34 kTypeInt32 = 1 << 9, 34 kTypeInt32 = 1u << 9,
35 kTypeUint32 = 1 << 10, 35 kTypeUint32 = 1u << 10,
36 kTypeInt64 = 1 << 11, 36 kTypeInt64 = 1u << 11,
37 kTypeUint64 = 1 << 12, 37 kTypeUint64 = 1u << 12,
38 kTypeNumber = 1 << 13, 38 kTypeNumber = 1u << 13,
39 kTypeAny = 1 << 14, 39 kTypeAny = 1u << 14,
40 40
41 // Machine types. 41 // Machine types.
42 kMachNone = 0, 42 kMachNone = 0u,
43 kMachBool = kRepBit | kTypeBool, 43 kMachBool = kRepBit | kTypeBool,
44 kMachFloat32 = kRepFloat32 | kTypeNumber, 44 kMachFloat32 = kRepFloat32 | kTypeNumber,
45 kMachFloat64 = kRepFloat64 | kTypeNumber, 45 kMachFloat64 = kRepFloat64 | kTypeNumber,
46 kMachInt8 = kRepWord8 | kTypeInt32, 46 kMachInt8 = kRepWord8 | kTypeInt32,
47 kMachUint8 = kRepWord8 | kTypeUint32, 47 kMachUint8 = kRepWord8 | kTypeUint32,
48 kMachInt16 = kRepWord16 | kTypeInt32, 48 kMachInt16 = kRepWord16 | kTypeInt32,
49 kMachUint16 = kRepWord16 | kTypeUint32, 49 kMachUint16 = kRepWord16 | kTypeUint32,
50 kMachInt32 = kRepWord32 | kTypeInt32, 50 kMachInt32 = kRepWord32 | kTypeInt32,
51 kMachUint32 = kRepWord32 | kTypeUint32, 51 kMachUint32 = kRepWord32 | kTypeUint32,
52 kMachInt64 = kRepWord64 | kTypeInt64, 52 kMachInt64 = kRepWord64 | kTypeInt64,
53 kMachUint64 = kRepWord64 | kTypeUint64, 53 kMachUint64 = kRepWord64 | kTypeUint64,
54 kMachIntPtr = (kPointerSize == 4) ? kMachInt32 : kMachInt64, 54 kMachIntPtr = (kPointerSize == 4) ? kMachInt32 : kMachInt64,
55 kMachUintPtr = (kPointerSize == 4) ? kMachUint32 : kMachUint64, 55 kMachUintPtr = (kPointerSize == 4) ? kMachUint32 : kMachUint64,
56 kMachPtr = (kPointerSize == 4) ? kRepWord32 : kRepWord64, 56 kMachPtr = (kPointerSize == 4) ? kRepWord32 : kRepWord64,
57 kMachAnyTagged = kRepTagged | kTypeAny 57 kMachAnyTagged = kRepTagged | kTypeAny
58 }; 58 };
59 59
60 V8_INLINE size_t hash_value(MachineType type) {
61 return static_cast<size_t>(type);
62 }
63
60 std::ostream& operator<<(std::ostream& os, const MachineType& type); 64 std::ostream& operator<<(std::ostream& os, const MachineType& type);
61 65
62 typedef uint16_t MachineTypeUnion; 66 typedef uint16_t MachineTypeUnion;
63 67
64 // Globally useful machine types and constants. 68 // Globally useful machine types and constants.
65 const MachineTypeUnion kRepMask = kRepBit | kRepWord8 | kRepWord16 | 69 const MachineTypeUnion kRepMask = kRepBit | kRepWord8 | kRepWord16 |
66 kRepWord32 | kRepWord64 | kRepFloat32 | 70 kRepWord32 | kRepWord64 | kRepFloat32 |
67 kRepFloat64 | kRepTagged; 71 kRepFloat64 | kRepTagged;
68 const MachineTypeUnion kTypeMask = kTypeBool | kTypeInt32 | kTypeUint32 | 72 const MachineTypeUnion kTypeMask = kTypeBool | kTypeInt32 | kTypeUint32 |
69 kTypeInt64 | kTypeUint64 | kTypeNumber | 73 kTypeInt64 | kTypeUint64 | kTypeNumber |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return 1 << shift; 116 return 1 << shift;
113 } 117 }
114 118
115 typedef Signature<MachineType> MachineSignature; 119 typedef Signature<MachineType> MachineSignature;
116 120
117 } // namespace compiler 121 } // namespace compiler
118 } // namespace internal 122 } // namespace internal
119 } // namespace v8 123 } // namespace v8
120 124
121 #endif // V8_COMPILER_MACHINE_TYPE_H_ 125 #endif // V8_COMPILER_MACHINE_TYPE_H_
OLDNEW
« 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