Line data Source code
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 :
5 : #include "src/interpreter/bytecode-operands.h"
6 :
7 : #include <iomanip>
8 :
9 : namespace v8 {
10 : namespace internal {
11 : namespace interpreter {
12 :
13 : namespace {
14 :
15 0 : const char* AccumulatorUseToString(AccumulatorUse accumulator_use) {
16 0 : switch (accumulator_use) {
17 : case AccumulatorUse::kNone:
18 : return "None";
19 : case AccumulatorUse::kRead:
20 0 : return "Read";
21 : case AccumulatorUse::kWrite:
22 0 : return "Write";
23 : case AccumulatorUse::kReadWrite:
24 0 : return "ReadWrite";
25 : }
26 0 : UNREACHABLE();
27 : return "";
28 : }
29 :
30 0 : const char* OperandTypeToString(OperandType operand_type) {
31 0 : switch (operand_type) {
32 : #define CASE(Name, _) \
33 : case OperandType::k##Name: \
34 : return #Name;
35 0 : OPERAND_TYPE_LIST(CASE)
36 : #undef CASE
37 : }
38 0 : UNREACHABLE();
39 : return "";
40 : }
41 :
42 495 : const char* OperandScaleToString(OperandScale operand_scale) {
43 495 : switch (operand_scale) {
44 : #define CASE(Name, _) \
45 : case OperandScale::k##Name: \
46 : return #Name;
47 165 : OPERAND_SCALE_LIST(CASE)
48 : #undef CASE
49 : }
50 0 : UNREACHABLE();
51 : return "";
52 : }
53 :
54 0 : const char* OperandSizeToString(OperandSize operand_size) {
55 0 : switch (operand_size) {
56 : case OperandSize::kNone:
57 : return "None";
58 : case OperandSize::kByte:
59 0 : return "Byte";
60 : case OperandSize::kShort:
61 0 : return "Short";
62 : case OperandSize::kQuad:
63 0 : return "Quad";
64 : }
65 0 : UNREACHABLE();
66 : return "";
67 : }
68 :
69 : } // namespace
70 :
71 0 : std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use) {
72 0 : return os << AccumulatorUseToString(use);
73 : }
74 :
75 0 : std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size) {
76 0 : return os << OperandSizeToString(operand_size);
77 : }
78 :
79 495 : std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale) {
80 495 : return os << OperandScaleToString(operand_scale);
81 : }
82 :
83 0 : std::ostream& operator<<(std::ostream& os, const OperandType& operand_type) {
84 0 : return os << OperandTypeToString(operand_type);
85 : }
86 :
87 : } // namespace interpreter
88 : } // namespace internal
89 : } // namespace v8
|