Index: src/interpreter/bytecodes.cc |
diff --git a/src/interpreter/bytecodes.cc b/src/interpreter/bytecodes.cc |
index 5cb2ddfbb2b1f241a0696007dc6d9858bdcc9f5a..8232b657e78e0d1de05c86db3754b287779a1ee9 100644 |
--- a/src/interpreter/bytecodes.cc |
+++ b/src/interpreter/bytecodes.cc |
@@ -4,6 +4,8 @@ |
#include "src/interpreter/bytecodes.h" |
+#include "src/interpreter/bytecode-array-builder.h" |
+ |
namespace v8 { |
namespace internal { |
namespace interpreter { |
@@ -38,6 +40,20 @@ const char* Bytecodes::ToString(Bytecode bytecode) { |
// static |
+const char* Bytecodes::OperandTypeToString(OperandType operand_type) { |
+ switch (operand_type) { |
+#define CASE(Name) \ |
+ case OperandType::k##Name: \ |
+ return #Name; |
+ OPERAND_TYPE_LIST(CASE) |
+#undef CASE |
+ } |
+ UNREACHABLE(); |
+ return ""; |
+} |
+ |
+ |
+// static |
uint8_t Bytecodes::ToByte(Bytecode bytecode) { |
return static_cast<uint8_t>(bytecode); |
} |
@@ -114,7 +130,7 @@ std::ostream& Bytecodes::Decode(std::ostream& os, |
os << "#" << static_cast<int>(operand); |
break; |
case interpreter::OperandType::kReg: |
- os << "r" << static_cast<int>(operand); |
+ os << "r" << Register::FromOperand(operand).index(); |
break; |
case interpreter::OperandType::kNone: |
UNREACHABLE(); |
@@ -132,6 +148,11 @@ std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode) { |
return os << Bytecodes::ToString(bytecode); |
} |
+ |
+std::ostream& operator<<(std::ostream& os, const OperandType& operand_type) { |
+ return os << Bytecodes::OperandTypeToString(operand_type); |
+} |
+ |
} // namespace interpreter |
} // namespace internal |
} // namespace v8 |