Reviewers: Michael Starzinger,

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

[email protected]

Please review this at https://codereview.chromium.org/1147973002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+10, -0 lines):
  M src/compiler/opcodes.h
  M src/compiler/opcodes.cc


Index: src/compiler/opcodes.cc
diff --git a/src/compiler/opcodes.cc b/src/compiler/opcodes.cc
index 1c94c19c780fec8c167a0b4a5bf2277c89bd7d89..2a8e01a26d90e9bfbe4460f015358e13eb2f8be8 100644
--- a/src/compiler/opcodes.cc
+++ b/src/compiler/opcodes.cc
@@ -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: src/compiler/opcodes.h
diff --git a/src/compiler/opcodes.h b/src/compiler/opcodes.h
index 270b73f294926ca9f8585e086086ac59cff9aa71..5ccbe4e1ebb9ef339a4e922beb3258fa433e4119 100644
--- a/src/compiler/opcodes.h
+++ b/src/compiler/opcodes.h
@@ -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


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to