Revision: 8897
Author:   [email protected]
Date:     Thu Aug 11 05:52:37 2011
Log: Removed some arbitrary size restrictions when disassembling generated code.

We output line-by-line now, this avoids hitting StringBuffer ASSERTs when
disassembling huge code objects.
Review URL: http://codereview.chromium.org/7622006
http://code.google.com/p/v8/source/detail?r=8897

Modified:
 /branches/bleeding_edge/src/disassembler.cc

=======================================
--- /branches/bleeding_edge/src/disassembler.cc Wed Apr 27 08:02:59 2011
+++ /branches/bleeding_edge/src/disassembler.cc Thu Aug 11 05:52:37 2011
@@ -97,13 +97,16 @@
 }


-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;
@@ -185,12 +188,9 @@

     // Comments.
     for (int i = 0; i < comments.length(); i++) {
-      out.AddFormatted("                  %s\n", comments[i]);
-    }
-
-    // Write out comments, resets outp so that we can format the next line.
-    DumpBuffer(f, out.Finalize());
-    out.Reset();
+      out.AddFormatted("                  %s", comments[i]);
+      DumpBuffer(f, &out);
+    }

     // Instruction address and instruction offset.
     out.AddFormatted("%p  %4d  ", prev_pc, prev_pc - begin);
@@ -209,7 +209,7 @@
         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 +299,7 @@
         out.AddFormatted("    ;; %s", RelocInfo::RelocModeName(rmode));
       }
     }
-    out.AddString("\n");
-    DumpBuffer(f, out.Finalize());
-    out.Reset();
+    DumpBuffer(f, &out);
   }

   delete it;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to