summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2015-02-10 17:17:55 -0700
committerJulien Gilli <julien.gilli@joyent.com>2015-04-29 14:25:48 -0700
commitbeff91c44e7ba13035d1dbd05cf2bef7a7d65f82 (patch)
tree35d7db04c89afcba0a9f9a145041efb2ff03bb55
parent32166a90cf126e4738b3ac81496ba1a46a23281d (diff)
downloadnode-new-beff91c44e7ba13035d1dbd05cf2bef7a7d65f82.tar.gz
deps: apply floating irhydra patch to v8
Reviewed-By: Trevor Norris <trev.norris@gmail.com> PR-URL: https://github.com/joyent/node/pull/18206
-rw-r--r--deps/v8/src/codegen.cc2
-rw-r--r--deps/v8/src/hydrogen.cc2
-rw-r--r--deps/v8/src/objects.cc5
-rw-r--r--deps/v8/src/ostreams.cc17
-rw-r--r--deps/v8/src/ostreams.h15
5 files changed, 34 insertions, 7 deletions
diff --git a/deps/v8/src/codegen.cc b/deps/v8/src/codegen.cc
index 6b12d64563..a24220d9d0 100644
--- a/deps/v8/src/codegen.cc
+++ b/deps/v8/src/codegen.cc
@@ -190,7 +190,7 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
function->end_position() - function->start_position() + 1;
for (int i = 0; i < source_len; i++) {
if (stream.HasMore()) {
- os << AsUC16(stream.GetNext());
+ os << AsReversiblyEscapedUC16(stream.GetNext());
}
}
os << "\n\n";
diff --git a/deps/v8/src/hydrogen.cc b/deps/v8/src/hydrogen.cc
index 9f3945f275..8800ed6b95 100644
--- a/deps/v8/src/hydrogen.cc
+++ b/deps/v8/src/hydrogen.cc
@@ -3498,7 +3498,7 @@ int HGraph::TraceInlinedFunction(
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());
}
}
}
diff --git a/deps/v8/src/objects.cc b/deps/v8/src/objects.cc
index a994718bd0..d3ad92d199 100644
--- a/deps/v8/src/objects.cc
+++ b/deps/v8/src/objects.cc
@@ -11431,7 +11431,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) {
diff --git a/deps/v8/src/ostreams.cc b/deps/v8/src/ostreams.cc
index 0f5bec41d2..62304eb908 100644
--- a/deps/v8/src/ostreams.cc
+++ b/deps/v8/src/ostreams.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <algorithm>
+#include <cctype>
#include <cmath>
#include "src/base/platform/platform.h" // For isinf/isnan with MSVC
@@ -163,11 +164,21 @@ OFStream& OFStream::flush() {
}
+OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c) {
+ char buf[10];
+ const char* format =
+ (std::isprint(c.value) || std::isspace(c.value)) && c.value != '\\'
+ ? "%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) {
char buf[10];
- const char* format = (0x20 <= c.value && c.value <= 0x7F)
- ? "%c"
- : (c.value <= 0xff) ? "\\x%02x" : "\\u%04x";
+ const char* format =
+ std::isprint(c.value) ? "%c" : (c.value <= 0xff) ? "\\x%02x" : "\\u%04x";
snprintf(buf, sizeof(buf), format, c.value);
return os << buf;
}
diff --git a/deps/v8/src/ostreams.h b/deps/v8/src/ostreams.h
index f70b6de230..08f53c52ac 100644
--- a/deps/v8/src/ostreams.h
+++ b/deps/v8/src/ostreams.h
@@ -117,13 +117,26 @@ class OFStream: public OStream {
};
-// 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/space 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