Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 2320210

Browse files
committed
deps: apply floating irhydra patch to v8
Reviewed-By: Fedor Indutny <[email protected]> PR-URL: #8476
1 parent d6249d0 commit 2320210

File tree

5 files changed

+34
-7
lines changed

5 files changed

+34
-7
lines changed

deps/v8/src/codegen.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
190190
function->end_position() - function->start_position() + 1;
191191
for (int i = 0; i < source_len; i++) {
192192
if (stream.HasMore()) {
193-
os << AsUC16(stream.GetNext());
193+
os << AsReversiblyEscapedUC16(stream.GetNext());
194194
}
195195
}
196196
os << "\n\n";

deps/v8/src/hydrogen.cc

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

deps/v8/src/objects.cc

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

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

1143711440
if (kind() == FUNCTION) {

deps/v8/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/v8/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)