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

Commit

Permalink
deps: apply floating irhydra patch to v8
Browse files Browse the repository at this point in the history
Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: nodejs#8476

Port 270e998 to deps/v8ppc
  • Loading branch information
richardlau committed Feb 2, 2015
1 parent 1f4cbb5 commit 9ffbf53
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deps/v8ppc/src/codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,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";
Expand Down
2 changes: 1 addition & 1 deletion deps/v8ppc/src/hydrogen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3500,7 +3500,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());
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion deps/v8ppc/src/objects.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11424,7 +11424,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) {
Expand Down
17 changes: 14 additions & 3 deletions deps/v8ppc/src/ostreams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
15 changes: 14 additions & 1 deletion deps/v8ppc/src/ostreams.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9ffbf53

Please sign in to comment.