Skip to content
This repository was archived by the owner on Oct 16, 2021. It is now read-only.

Commit 95d5ce3

Browse files
committed
deps: apply floating irhydra patch to v8
Reviewed-By: Fedor Indutny <[email protected]> PR-URL: nodejs#8476 Port 270e998 to deps/v8ppc
1 parent 1adf354 commit 95d5ce3

File tree

5 files changed

+34
-7
lines changed

5 files changed

+34
-7
lines changed

deps/v8ppc/src/codegen.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
204204
function->end_position() - function->start_position() + 1;
205205
for (int i = 0; i < source_len; i++) {
206206
if (stream.HasMore()) {
207-
os << AsUC16(stream.GetNext());
207+
os << AsReversiblyEscapedUC16(stream.GetNext());
208208
}
209209
}
210210
os << "\n\n";

deps/v8ppc/src/hydrogen.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3500,7 +3500,7 @@ int HGraph::TraceInlinedFunction(
35003500
shared->end_position() - shared->start_position() + 1;
35013501
for (int i = 0; i < source_len; i++) {
35023502
if (stream.HasMore()) {
3503-
os << AsUC16(stream.GetNext());
3503+
os << AsReversiblyEscapedUC16(stream.GetNext());
35043504
}
35053505
}
35063506
}

deps/v8ppc/src/objects.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11424,7 +11424,10 @@ void Code::Disassemble(const char* name, OStream& os) { // NOLINT
1142411424

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

1143011433
if (kind() == FUNCTION) {

deps/v8ppc/src/ostreams.cc

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// found in the LICENSE file.
44

55
#include <algorithm>
6+
#include <cctype>
67
#include <cmath>
78

89
#include "src/base/platform/platform.h" // For isinf/isnan with MSVC
@@ -163,11 +164,21 @@ OFStream& OFStream::flush() {
163164
}
164165

165166

167+
OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c) {
168+
char buf[10];
169+
const char* format =
170+
(std::isprint(c.value) || std::isspace(c.value)) && c.value != '\\'
171+
? "%c"
172+
: (c.value <= 0xff) ? "\\x%02x" : "\\u%04x";
173+
snprintf(buf, sizeof(buf), format, c.value);
174+
return os << buf;
175+
}
176+
177+
166178
OStream& operator<<(OStream& os, const AsUC16& c) {
167179
char buf[10];
168-
const char* format = (0x20 <= c.value && c.value <= 0x7F)
169-
? "%c"
170-
: (c.value <= 0xff) ? "\\x%02x" : "\\u%04x";
180+
const char* format =
181+
std::isprint(c.value) ? "%c" : (c.value <= 0xff) ? "\\x%02x" : "\\u%04x";
171182
snprintf(buf, sizeof(buf), format, c.value);
172183
return os << buf;
173184
}

deps/v8ppc/src/ostreams.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,26 @@ class OFStream: public OStream {
117117
};
118118

119119

120-
// A wrapper to disambiguate uint16_t and uc16.
120+
// Wrappers to disambiguate uint16_t and uc16.
121121
struct AsUC16 {
122122
explicit AsUC16(uint16_t v) : value(v) {}
123123
uint16_t value;
124124
};
125125

126126

127+
struct AsReversiblyEscapedUC16 {
128+
explicit AsReversiblyEscapedUC16(uint16_t v) : value(v) {}
129+
uint16_t value;
130+
};
131+
132+
133+
// Writes the given character to the output escaping everything outside of
134+
// printable/space ASCII range. Additionally escapes '\' making escaping
135+
// reversible.
136+
OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c);
137+
138+
// Writes the given character to the output escaping everything outside
139+
// of printable ASCII range.
127140
OStream& operator<<(OStream& os, const AsUC16& c);
128141
} } // namespace v8::internal
129142

0 commit comments

Comments
 (0)