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

Side by Side Diff: src/machine-type.h

Issue 2258073002: [Turbofan]: Use new MachineTypes in access-builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: A bit of refactoring. Created 4 years, 3 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 | « src/compiler/x64/instruction-selector-x64.cc ('k') | 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_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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return MachineType(MachineRepresentation::kWord32, 112 return MachineType(MachineRepresentation::kWord32,
113 MachineSemantic::kUint32); 113 MachineSemantic::kUint32);
114 } 114 }
115 static MachineType Int64() { 115 static MachineType Int64() {
116 return MachineType(MachineRepresentation::kWord64, MachineSemantic::kInt64); 116 return MachineType(MachineRepresentation::kWord64, MachineSemantic::kInt64);
117 } 117 }
118 static MachineType Uint64() { 118 static MachineType Uint64() {
119 return MachineType(MachineRepresentation::kWord64, 119 return MachineType(MachineRepresentation::kWord64,
120 MachineSemantic::kUint64); 120 MachineSemantic::kUint64);
121 } 121 }
122 static MachineType TaggedPointer() {
123 return MachineType(MachineRepresentation::kTaggedPointer,
124 MachineSemantic::kAny);
125 }
126 static MachineType TaggedSigned() {
127 return MachineType(MachineRepresentation::kTaggedSigned,
128 MachineSemantic::kInt32);
129 }
122 static MachineType AnyTagged() { 130 static MachineType AnyTagged() {
123 return MachineType(MachineRepresentation::kTagged, MachineSemantic::kAny); 131 return MachineType(MachineRepresentation::kTagged, MachineSemantic::kAny);
124 } 132 }
125 static MachineType Bool() { 133 static MachineType Bool() {
126 return MachineType(MachineRepresentation::kBit, MachineSemantic::kBool); 134 return MachineType(MachineRepresentation::kBit, MachineSemantic::kBool);
127 } 135 }
128 static MachineType TaggedBool() { 136 static MachineType TaggedBool() {
129 return MachineType(MachineRepresentation::kTagged, MachineSemantic::kBool); 137 return MachineType(MachineRepresentation::kTagged, MachineSemantic::kBool);
130 } 138 }
131 static MachineType None() { 139 static MachineType None() {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 std::ostream& operator<<(std::ostream& os, MachineRepresentation rep); 215 std::ostream& operator<<(std::ostream& os, MachineRepresentation rep);
208 std::ostream& operator<<(std::ostream& os, MachineSemantic type); 216 std::ostream& operator<<(std::ostream& os, MachineSemantic type);
209 std::ostream& operator<<(std::ostream& os, MachineType type); 217 std::ostream& operator<<(std::ostream& os, MachineType type);
210 218
211 inline bool IsFloatingPoint(MachineRepresentation rep) { 219 inline bool IsFloatingPoint(MachineRepresentation rep) {
212 return rep == MachineRepresentation::kFloat32 || 220 return rep == MachineRepresentation::kFloat32 ||
213 rep == MachineRepresentation::kFloat64 || 221 rep == MachineRepresentation::kFloat64 ||
214 rep == MachineRepresentation::kSimd128; 222 rep == MachineRepresentation::kSimd128;
215 } 223 }
216 224
225 inline bool CanBeTaggedPointer(MachineRepresentation rep) {
226 return rep == MachineRepresentation::kTagged ||
227 rep == MachineRepresentation::kTaggedPointer;
228 }
229
230 inline bool IsAnyTagged(MachineRepresentation rep) {
231 return CanBeTaggedPointer(rep) || rep == MachineRepresentation::kTaggedSigned;
232 }
233
217 // Gets the log2 of the element size in bytes of the machine type. 234 // Gets the log2 of the element size in bytes of the machine type.
218 inline int ElementSizeLog2Of(MachineRepresentation rep) { 235 inline int ElementSizeLog2Of(MachineRepresentation rep) {
219 switch (rep) { 236 switch (rep) {
220 case MachineRepresentation::kBit: 237 case MachineRepresentation::kBit:
221 case MachineRepresentation::kWord8: 238 case MachineRepresentation::kWord8:
222 return 0; 239 return 0;
223 case MachineRepresentation::kWord16: 240 case MachineRepresentation::kWord16:
224 return 1; 241 return 1;
225 case MachineRepresentation::kWord32: 242 case MachineRepresentation::kWord32:
226 case MachineRepresentation::kFloat32: 243 case MachineRepresentation::kFloat32:
(...skipping 13 matching lines...) Expand all
240 UNREACHABLE(); 257 UNREACHABLE();
241 return -1; 258 return -1;
242 } 259 }
243 260
244 typedef Signature<MachineType> MachineSignature; 261 typedef Signature<MachineType> MachineSignature;
245 262
246 } // namespace internal 263 } // namespace internal
247 } // namespace v8 264 } // namespace v8
248 265
249 #endif // V8_MACHINE_TYPE_H_ 266 #endif // V8_MACHINE_TYPE_H_
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698