v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
bytecode-operands.cc
Go to the documentation of this file.
1// Copyright 2016 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
6
7#include <iomanip>
8
9namespace v8 {
10namespace internal {
11namespace interpreter {
12
13namespace {
14
15const char* ImplicitRegisterUseToString(
16 ImplicitRegisterUse implicit_register_use) {
17 switch (implicit_register_use) {
19 return "None";
21 return "ReadAccumulator";
23 return "WriteAccumulator";
25 return "ClobberAccumulator";
27 return "WriteShortStar";
29 return "ReadAndClobberAccumulator";
31 return "ReadWriteAccumulator";
33 return "ReadAccumulatorWriteShortStar";
34 }
36}
37
38const char* OperandTypeToString(OperandType operand_type) {
39 switch (operand_type) {
40#define CASE(Name, _) \
41 case OperandType::k##Name: \
42 return #Name;
44#undef CASE
45 }
47}
48
49const char* OperandScaleToString(OperandScale operand_scale) {
50 switch (operand_scale) {
51#define CASE(Name, _) \
52 case OperandScale::k##Name: \
53 return #Name;
55#undef CASE
56 }
58}
59
60const char* OperandSizeToString(OperandSize operand_size) {
61 switch (operand_size) {
63 return "None";
65 return "Byte";
67 return "Short";
69 return "Quad";
70 }
72}
73
74} // namespace
75
76std::ostream& operator<<(std::ostream& os, const ImplicitRegisterUse& use) {
77 return os << ImplicitRegisterUseToString(use);
78}
79
80std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size) {
81 return os << OperandSizeToString(operand_size);
82}
83
84std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale) {
85 return os << OperandScaleToString(operand_scale);
86}
87
88std::ostream& operator<<(std::ostream& os, const OperandType& operand_type) {
89 return os << OperandTypeToString(operand_type);
90}
91
92} // namespace interpreter
93} // namespace internal
94} // namespace v8
#define OPERAND_TYPE_LIST(V)
#define OPERAND_SCALE_LIST(V)
std::ostream & operator<<(std::ostream &os, PaddingSpace padding)