Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Unified Diff: runtime/vm/disassembler_x64.cc

Issue 10407019: Extend assembler with ability to produce comments for the generated code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/disassembler_x64.cc
diff --git a/runtime/vm/disassembler_x64.cc b/runtime/vm/disassembler_x64.cc
index ba3fd2df8366b45eeb38aa9c17ae5bc8027343d8..25144ee2fc7eafb51ca6ffd2f08116d17cf04025 100644
--- a/runtime/vm/disassembler_x64.cc
+++ b/runtime/vm/disassembler_x64.cc
@@ -19,7 +19,8 @@ namespace dart {
void Disassembler::Disassemble(uword start,
uword end,
- DisassemblyFormatter* formatter) {
+ DisassemblyFormatter* formatter,
+ CodeComments comments) {
srdjan 2012/05/17 17:22:08 const CodeComments&
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done.
// First print the actual addresses so that we know where in memory this is
// being disassembled from.
formatter->Print("start: %p end: %p\n", start, end);
@@ -82,8 +83,24 @@ void Disassembler::Disassemble(uword start,
formatter->Print("%s", header_pos + strlen(header));
}
}
+
+
+ int comment_finger = 0;
while (fgets(line, sizeof(line), output) != NULL) {
- formatter->Print("%s", line);
+ char* tab = strchr(line, '\t');
+ if (tab != NULL) {
+ *tab = '\0';
+ intptr_t offset = 0;
+ sscanf(line, "%p", reinterpret_cast<void**>(&offset)); // NOLINT
+ while (comment_finger < comments.Length() &&
+ comments.PCAt(comment_finger) <= offset) {
+ formatter->Print(" ;; %s\n",
+ comments.CommentAt(comment_finger).ToCString());
+ comment_finger++;
+ }
+
+ formatter->Print("%016p %08x %s", start + offset, offset, tab + 1);
+ }
}
pclose(output);

Powered by Google App Engine
This is Rietveld 408576698