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 : }
28 :
29 0 : const char* OperandTypeToString(OperandType operand_type) {
30 0 : switch (operand_type) {
31 : #define CASE(Name, _) \
32 : case OperandType::k##Name: \
33 : return #Name;
34 0 : OPERAND_TYPE_LIST(CASE)
35 : #undef CASE
36 : }
37 0 : UNREACHABLE();
38 : }
39 :
40 1014 : const char* OperandScaleToString(OperandScale operand_scale) {
41 1014 : switch (operand_scale) {
42 : #define CASE(Name, _) \
43 : case OperandScale::k##Name: \
44 : return #Name;
45 327 : OPERAND_SCALE_LIST(CASE)
46 : #undef CASE
47 : }
48 0 : UNREACHABLE();
49 : }
50 :
51 0 : const char* OperandSizeToString(OperandSize operand_size) {
52 0 : switch (operand_size) {
53 : case OperandSize::kNone:
54 : return "None";
55 : case OperandSize::kByte:
56 0 : return "Byte";
57 : case OperandSize::kShort:
58 0 : return "Short";
59 : case OperandSize::kQuad:
60 0 : return "Quad";
61 : }
62 0 : UNREACHABLE();
63 : }
64 :
65 : } // namespace
66 :
67 0 : std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use) {
68 0 : return os << AccumulatorUseToString(use);
69 : }
70 :
71 0 : std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size) {
72 0 : return os << OperandSizeToString(operand_size);
73 : }
74 :
75 1014 : std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale) {
76 1014 : return os << OperandScaleToString(operand_scale);
77 : }
78 :
79 0 : std::ostream& operator<<(std::ostream& os, const OperandType& operand_type) {
80 0 : return os << OperandTypeToString(operand_type);
81 : }
82 :
83 : } // namespace interpreter
84 : } // namespace internal
85 121998 : } // namespace v8
|