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
5
#include "
src/codegen/machine-type.h
"
6
#include "
src/utils/ostreams.h
"
7
8
namespace
v8
{
9
namespace
internal
{
10
11
bool
IsSubtype
(
MachineRepresentation
rep1,
MachineRepresentation
rep2) {
12
if
(rep1 == rep2)
return
true
;
13
switch
(rep1) {
14
case
MachineRepresentation::kTaggedSigned
:
// Fall through.
15
case
MachineRepresentation::kTaggedPointer
:
16
return
rep2 ==
MachineRepresentation::kTagged
;
17
case
MachineRepresentation::kCompressedPointer
:
18
return
rep2 ==
MachineRepresentation::kCompressed
;
19
default
:
20
return
false
;
21
}
22
}
23
24
std::ostream&
operator<<
(std::ostream& os,
MachineRepresentation
rep) {
25
return
os <<
MachineReprToString
(rep);
26
}
27
28
const
char
*
MachineReprToString
(
MachineRepresentation
rep) {
29
switch
(rep) {
30
case
MachineRepresentation::kNone
:
31
return
"kMachNone"
;
32
case
MachineRepresentation::kBit
:
33
return
"kRepBit"
;
34
case
MachineRepresentation::kWord8
:
35
return
"kRepWord8"
;
36
case
MachineRepresentation::kWord16
:
37
return
"kRepWord16"
;
38
case
MachineRepresentation::kWord32
:
39
return
"kRepWord32"
;
40
case
MachineRepresentation::kWord64
:
41
return
"kRepWord64"
;
42
case
MachineRepresentation::kFloat16
:
43
return
"kRepFloat16"
;
44
case
MachineRepresentation::kFloat16RawBits
:
45
return
"kRepFloat16RawBits"
;
46
case
MachineRepresentation::kFloat32
:
47
return
"kRepFloat32"
;
48
case
MachineRepresentation::kFloat64
:
49
return
"kRepFloat64"
;
50
case
MachineRepresentation::kSimd128
:
51
return
"kRepSimd128"
;
52
case
MachineRepresentation::kSimd256
:
53
return
"kRepSimd256"
;
54
case
MachineRepresentation::kTaggedSigned
:
55
return
"kRepTaggedSigned"
;
56
case
MachineRepresentation::kTaggedPointer
:
57
return
"kRepTaggedPointer"
;
58
case
MachineRepresentation::kTagged
:
59
return
"kRepTagged"
;
60
case
MachineRepresentation::kCompressedPointer
:
61
return
"kRepCompressedPointer"
;
62
case
MachineRepresentation::kCompressed
:
63
return
"kRepCompressed"
;
64
case
MachineRepresentation::kProtectedPointer
:
65
return
"kRepProtectedPointer"
;
66
case
MachineRepresentation::kIndirectPointer
:
67
return
"kRepIndirectPointer"
;
68
case
MachineRepresentation::kMapWord
:
69
return
"kRepMapWord"
;
70
case
MachineRepresentation::kSandboxedPointer
:
71
return
"kRepSandboxedPointer"
;
72
}
73
UNREACHABLE
();
74
}
75
76
std::ostream&
operator<<
(std::ostream& os,
MachineSemantic
type) {
77
switch
(type) {
78
case
MachineSemantic::kNone
:
79
return
os <<
"kMachNone"
;
80
case
MachineSemantic::kBool
:
81
return
os <<
"kTypeBool"
;
82
case
MachineSemantic::kInt32
:
83
return
os <<
"kTypeInt32"
;
84
case
MachineSemantic::kUint32
:
85
return
os <<
"kTypeUint32"
;
86
case
MachineSemantic::kInt64
:
87
return
os <<
"kTypeInt64"
;
88
case
MachineSemantic::kUint64
:
89
return
os <<
"kTypeUint64"
;
90
case
MachineSemantic::kSignedBigInt64
:
91
return
os <<
"kTypeSignedBigInt64"
;
92
case
MachineSemantic::kUnsignedBigInt64
:
93
return
os <<
"kTypeUnsignedBigInt64"
;
94
case
MachineSemantic::kNumber
:
95
return
os <<
"kTypeNumber"
;
96
case
MachineSemantic::kHoleyFloat64
:
97
return
os <<
"kTypeHoleyFloat64"
;
98
case
MachineSemantic::kAny
:
99
return
os <<
"kTypeAny"
;
100
}
101
UNREACHABLE
();
102
}
103
104
std::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
v8::internal::MachineType
Definition
machine-type.h:109
v8::internal::MachineType::None
static constexpr MachineType None()
Definition
machine-type.h:276
machine-type.h
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8::internal::operator<<
std::ostream & operator<<(std::ostream &os, AtomicMemoryOrder order)
Definition
atomic-memory-order.h:22
v8::internal::MachineReprToString
const char * MachineReprToString(MachineRepresentation rep)
Definition
machine-type.cc:28
v8::internal::IsSubtype
bool IsSubtype(MachineRepresentation rep1, MachineRepresentation rep2)
Definition
machine-type.cc:11
v8::internal::MachineRepresentation
MachineRepresentation
Definition
machine-type.h:19
v8::internal::MachineRepresentation::kSimd256
@ kSimd256
v8::internal::MachineRepresentation::kWord8
@ kWord8
v8::internal::MachineRepresentation::kIndirectPointer
@ kIndirectPointer
v8::internal::MachineRepresentation::kBit
@ kBit
v8::internal::MachineRepresentation::kNone
@ kNone
v8::internal::MachineRepresentation::kProtectedPointer
@ kProtectedPointer
v8::internal::MachineRepresentation::kTagged
@ kTagged
v8::internal::MachineRepresentation::kTaggedSigned
@ kTaggedSigned
v8::internal::MachineRepresentation::kWord16
@ kWord16
v8::internal::MachineRepresentation::kFloat64
@ kFloat64
v8::internal::MachineRepresentation::kFloat16
@ kFloat16
v8::internal::MachineRepresentation::kWord64
@ kWord64
v8::internal::MachineRepresentation::kFloat32
@ kFloat32
v8::internal::MachineRepresentation::kTaggedPointer
@ kTaggedPointer
v8::internal::MachineRepresentation::kSimd128
@ kSimd128
v8::internal::MachineRepresentation::kMapWord
@ kMapWord
v8::internal::MachineRepresentation::kCompressedPointer
@ kCompressedPointer
v8::internal::MachineRepresentation::kSandboxedPointer
@ kSandboxedPointer
v8::internal::MachineRepresentation::kFloat16RawBits
@ kFloat16RawBits
v8::internal::MachineRepresentation::kCompressed
@ kCompressed
v8::internal::MachineRepresentation::kWord32
@ kWord32
v8::internal::UNREACHABLE
UNREACHABLE()
v8::internal::MachineSemantic
MachineSemantic
Definition
machine-type.h:90
v8::internal::MachineSemantic::kInt32
@ kInt32
v8::internal::MachineSemantic::kBool
@ kBool
v8::internal::MachineSemantic::kAny
@ kAny
v8::internal::MachineSemantic::kUnsignedBigInt64
@ kUnsignedBigInt64
v8::internal::MachineSemantic::kInt64
@ kInt64
v8::internal::MachineSemantic::kNone
@ kNone
v8::internal::MachineSemantic::kUint64
@ kUint64
v8::internal::MachineSemantic::kNumber
@ kNumber
v8::internal::MachineSemantic::kSignedBigInt64
@ kSignedBigInt64
v8::internal::MachineSemantic::kHoleyFloat64
@ kHoleyFloat64
v8::internal::MachineSemantic::kUint32
@ kUint32
v8
Definition
api-arguments-inl.h:19
ostreams.h
src
codegen
machine-type.cc
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0