Reviewers: Sven Panne,

Message:
Sven, could please take a look?

Description:
Fix disassembly redirection from stdout into a file.

Pass \n, \r and \t through OStream without escaping.

BUG=

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+7, -2 lines):
  M src/objects.cc
  M src/ostreams.cc


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 645bb4a74e39f81272c0c9e3c4c4d913976224fc..eb41c48a2963776f207763afd076a6cd78dc4fbd 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11388,7 +11388,10 @@ void Code::Disassemble(const char* name, OStream& os) { // NOLINT

   os << "Instructions (size = " << instruction_size() << ")\n";
   // TODO(svenpanne) The Disassembler should use streams, too!
-  Disassembler::Decode(stdout, this);
+  {
+    CodeTracer::Scope trace_scope(GetIsolate()->GetCodeTracer());
+    Disassembler::Decode(trace_scope.file(), this);
+  }
   os << "\n";

   if (kind() == FUNCTION) {
Index: src/ostreams.cc
diff --git a/src/ostreams.cc b/src/ostreams.cc
index 0f5bec41d2b8b2a48685ddf7425ab6ceeb884df0..47c477f89289c8810499133488ebf75a18d6b019 100644
--- a/src/ostreams.cc
+++ b/src/ostreams.cc
@@ -165,7 +165,9 @@ OFStream& OFStream::flush() {

 OStream& operator<<(OStream& os, const AsUC16& c) {
   char buf[10];
-  const char* format = (0x20 <= c.value && c.value <= 0x7F)
+  const char* format = (c.value == '\n') || (c.value == '\t') ||
+                               (c.value == '\r') ||
+                               (0x20 <= c.value && c.value <= 0x7F)
                            ? "%c"
                            : (c.value <= 0xff) ? "\\x%02x" : "\\u%04x";
   snprintf(buf, sizeof(buf), format, c.value);


--
--
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