Revision: 23478
Author: svenpa...@chromium.org
Date: Thu Aug 28 07:30:58 2014 UTC
Log: Fix disassembly redirection from stdout into a file.
Pass \n, \r and \t through OStream without escaping.
BUG=
R=svenpa...@chromium.org
Review URL: https://codereview.chromium.org/458533002
Patch from Vyacheslav Egorov <vego...@google.com>.
https://code.google.com/p/v8/source/detail?r=23478
Modified:
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/ostreams.cc
/branches/bleeding_edge/src/ostreams.h
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Tue Aug 26 16:32:51 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Thu Aug 28 07:30:58 2014 UTC
@@ -3500,7 +3500,7 @@
shared->end_position() - shared->start_position() + 1;
for (int i = 0; i < source_len; i++) {
if (stream.HasMore()) {
- os << AsUC16(stream.GetNext());
+ os << AsReversiblyEscapedUC16(stream.GetNext());
}
}
}
=======================================
--- /branches/bleeding_edge/src/objects.cc Tue Aug 26 16:32:51 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Thu Aug 28 07:30:58 2014 UTC
@@ -10923,7 +10923,10 @@
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) {
=======================================
--- /branches/bleeding_edge/src/ostreams.cc Fri Jul 11 12:55:56 2014 UTC
+++ /branches/bleeding_edge/src/ostreams.cc Thu Aug 28 07:30:58 2014 UTC
@@ -161,6 +161,16 @@
if (f_) fflush(f_);
return *this;
}
+
+
+OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c) {
+ char buf[10];
+ const char* format = (0x20 <= c.value && c.value <= 0x7F) && (c.value !=
0x52)
+ ? "%c"
+ : (c.value <= 0xff) ? "\\x%02x" : "\\u%04x";
+ snprintf(buf, sizeof(buf), format, c.value);
+ return os << buf;
+}
OStream& operator<<(OStream& os, const AsUC16& c) {
=======================================
--- /branches/bleeding_edge/src/ostreams.h Mon Jul 7 09:57:29 2014 UTC
+++ /branches/bleeding_edge/src/ostreams.h Thu Aug 28 07:30:58 2014 UTC
@@ -117,13 +117,26 @@
};
-// A wrapper to disambiguate uint16_t and uc16.
+// Wrappers to disambiguate uint16_t and uc16.
struct AsUC16 {
explicit AsUC16(uint16_t v) : value(v) {}
uint16_t value;
};
+struct AsReversiblyEscapedUC16 {
+ explicit AsReversiblyEscapedUC16(uint16_t v) : value(v) {}
+ uint16_t value;
+};
+
+
+// Writes the given character to the output escaping everything outside
+// of printable ASCII range. Additionally escapes '\' making escaping
+// reversible.
+OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c);
+
+// Writes the given character to the output escaping everything outside
+// of printable ASCII range.
OStream& operator<<(OStream& os, const AsUC16& c);
} } // namespace v8::internal
--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.