[turbofan] Add streaming operator for opcodes to ease debugging.
authorbmeurer <bmeurer@chromium.org>
Wed, 20 May 2015 10:13:02 +0000 (03:13 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 20 May 2015 10:12:46 +0000 (10:12 +0000)
R=mstarzinger@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28505}

src/compiler/opcodes.cc
src/compiler/opcodes.h

index 1c94c19..2a8e01a 100644 (file)
@@ -5,6 +5,7 @@
 #include "src/compiler/opcodes.h"
 
 #include <algorithm>
+#include <ostream>
 
 #include "src/base/macros.h"
 
@@ -29,6 +30,11 @@ char const* IrOpcode::Mnemonic(Value value) {
   return kMnemonics[n];
 }
 
+
+std::ostream& operator<<(std::ostream& os, IrOpcode::Value opcode) {
+  return os << IrOpcode::Mnemonic(opcode);
+}
+
 }  // namespace compiler
 }  // namespace internal
 }  // namespace v8
index 270b73f..5ccbe4e 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef V8_COMPILER_OPCODES_H_
 #define V8_COMPILER_OPCODES_H_
 
+#include <iosfwd>
+
 // Opcodes for control operators.
 #define CONTROL_OP_LIST(V) \
   V(Start)                 \
@@ -348,6 +350,8 @@ class IrOpcode {
   }
 };
 
+std::ostream& operator<<(std::ostream&, IrOpcode::Value);
+
 }  // namespace compiler
 }  // namespace internal
 }  // namespace v8