diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-08-18 16:59:21 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-08-18 16:59:30 -0700 |
commit | 05e6f318c6ecccea73698367010e51812c5b3862 (patch) | |
tree | 965d1c3bcdd518dd7411d8f39dd45189e1526d3d /deps/v8/src/disassembler.cc | |
parent | 63607a0304e99259d3b7a24c44f7d29384b93cb4 (diff) | |
download | android-node-v8-05e6f318c6ecccea73698367010e51812c5b3862.tar.gz android-node-v8-05e6f318c6ecccea73698367010e51812c5b3862.tar.bz2 android-node-v8-05e6f318c6ecccea73698367010e51812c5b3862.zip |
Upgrade V8 to 3.5.6
Diffstat (limited to 'deps/v8/src/disassembler.cc')
-rw-r--r-- | deps/v8/src/disassembler.cc | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/deps/v8/src/disassembler.cc b/deps/v8/src/disassembler.cc index 368c3a89c1..79076d6abc 100644 --- a/deps/v8/src/disassembler.cc +++ b/deps/v8/src/disassembler.cc @@ -97,14 +97,17 @@ const char* V8NameConverter::NameInCode(byte* addr) const { } -static void DumpBuffer(FILE* f, char* buff) { +static void DumpBuffer(FILE* f, StringBuilder* out) { if (f == NULL) { - PrintF("%s", buff); + PrintF("%s\n", out->Finalize()); } else { - fprintf(f, "%s", buff); + fprintf(f, "%s\n", out->Finalize()); } + out->Reset(); } + + static const int kOutBufferSize = 2048 + String::kMaxShortPrintLength; static const int kRelocInfoPosition = 57; @@ -119,6 +122,7 @@ static int DecodeIt(FILE* f, v8::internal::EmbeddedVector<char, 128> decode_buffer; v8::internal::EmbeddedVector<char, kOutBufferSize> out_buffer; + StringBuilder out(out_buffer.start(), out_buffer.length()); byte* pc = begin; disasm::Disassembler d(converter); RelocIterator* it = NULL; @@ -181,17 +185,12 @@ static int DecodeIt(FILE* f, } } - StringBuilder out(out_buffer.start(), out_buffer.length()); - // Comments. for (int i = 0; i < comments.length(); i++) { - out.AddFormatted(" %s\n", comments[i]); + out.AddFormatted(" %s", comments[i]); + DumpBuffer(f, &out); } - // Write out comments, resets outp so that we can format the next line. - DumpBuffer(f, out.Finalize()); - out.Reset(); - // Instruction address and instruction offset. out.AddFormatted("%p %4d ", prev_pc, prev_pc - begin); @@ -209,7 +208,7 @@ static int DecodeIt(FILE* f, out.AddPadding(' ', kRelocInfoPosition - out.position()); } else { // Additional reloc infos are printed on separate lines. - out.AddFormatted("\n"); + DumpBuffer(f, &out); out.AddPadding(' ', kRelocInfoPosition); } @@ -299,9 +298,18 @@ static int DecodeIt(FILE* f, out.AddFormatted(" ;; %s", RelocInfo::RelocModeName(rmode)); } } - out.AddString("\n"); - DumpBuffer(f, out.Finalize()); - out.Reset(); + DumpBuffer(f, &out); + } + + // Emit comments following the last instruction (if any). + if (it != NULL) { + for ( ; !it->done(); it->next()) { + if (RelocInfo::IsComment(it->rinfo()->rmode())) { + out.AddFormatted(" %s", + reinterpret_cast<const char*>(it->rinfo()->data())); + DumpBuffer(f, &out); + } + } } delete it; |