v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
machine-type.cc
Go to the documentation of this file.
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
3// found in the LICENSE file.
4
7
8namespace v8 {
9namespace internal {
10
12 if (rep1 == rep2) return true;
13 switch (rep1) {
14 case MachineRepresentation::kTaggedSigned: // Fall through.
16 return rep2 == MachineRepresentation::kTagged;
19 default:
20 return false;
21 }
22}
23
24std::ostream& operator<<(std::ostream& os, MachineRepresentation rep) {
25 return os << MachineReprToString(rep);
26}
27
29 switch (rep) {
31 return "kMachNone";
33 return "kRepBit";
35 return "kRepWord8";
37 return "kRepWord16";
39 return "kRepWord32";
41 return "kRepWord64";
43 return "kRepFloat16";
45 return "kRepFloat16RawBits";
47 return "kRepFloat32";
49 return "kRepFloat64";
51 return "kRepSimd128";
53 return "kRepSimd256";
55 return "kRepTaggedSigned";
57 return "kRepTaggedPointer";
59 return "kRepTagged";
61 return "kRepCompressedPointer";
63 return "kRepCompressed";
65 return "kRepProtectedPointer";
67 return "kRepIndirectPointer";
69 return "kRepMapWord";
71 return "kRepSandboxedPointer";
72 }
74}
75
76std::ostream& operator<<(std::ostream& os, MachineSemantic type) {
77 switch (type) {
79 return os << "kMachNone";
81 return os << "kTypeBool";
83 return os << "kTypeInt32";
85 return os << "kTypeUint32";
87 return os << "kTypeInt64";
89 return os << "kTypeUint64";
91 return os << "kTypeSignedBigInt64";
93 return os << "kTypeUnsignedBigInt64";
95 return os << "kTypeNumber";
97 return os << "kTypeHoleyFloat64";
99 return os << "kTypeAny";
100 }
101 UNREACHABLE();
102}
103
104std::ostream& operator<<(std::ostream& os, MachineType type) {
105 if (type == MachineType::None()) {
106 return os;
107 } else if (type.representation() == MachineRepresentation::kNone) {
108 return os << type.semantic();
109 } else if (type.semantic() == MachineSemantic::kNone) {
110 return os << type.representation();
111 } else {
112 return os << type.representation() << "|" << type.semantic();
113 }
114}
115
116} // namespace internal
117} // namespace v8
static constexpr MachineType None()
std::ostream & operator<<(std::ostream &os, AtomicMemoryOrder order)
const char * MachineReprToString(MachineRepresentation rep)
bool IsSubtype(MachineRepresentation rep1, MachineRepresentation rep2)