Commit d3c1a7fb authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Add streaming operator for opcodes to ease debugging.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/1147973002

Cr-Commit-Position: refs/heads/master@{#28505}
parent ba0b7f06
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "src/compiler/opcodes.h" #include "src/compiler/opcodes.h"
#include <algorithm> #include <algorithm>
#include <ostream>
#include "src/base/macros.h" #include "src/base/macros.h"
...@@ -29,6 +30,11 @@ char const* IrOpcode::Mnemonic(Value value) { ...@@ -29,6 +30,11 @@ char const* IrOpcode::Mnemonic(Value value) {
return kMnemonics[n]; return kMnemonics[n];
} }
std::ostream& operator<<(std::ostream& os, IrOpcode::Value opcode) {
return os << IrOpcode::Mnemonic(opcode);
}
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef V8_COMPILER_OPCODES_H_ #ifndef V8_COMPILER_OPCODES_H_
#define V8_COMPILER_OPCODES_H_ #define V8_COMPILER_OPCODES_H_
#include <iosfwd>
// Opcodes for control operators. // Opcodes for control operators.
#define CONTROL_OP_LIST(V) \ #define CONTROL_OP_LIST(V) \
V(Start) \ V(Start) \
...@@ -348,6 +350,8 @@ class IrOpcode { ...@@ -348,6 +350,8 @@ class IrOpcode {
} }
}; };
std::ostream& operator<<(std::ostream&, IrOpcode::Value);
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment