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

Side by Side Diff: runtime/vm/disassembler.cc

Issue 928833003: Add Function based profile tree (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/il_printer.h"
10 #include "vm/json_stream.h"
11 #include "vm/log.h"
9 #include "vm/os.h" 12 #include "vm/os.h"
10 #include "vm/log.h" 13
11 #include "vm/json_stream.h"
12 14
13 namespace dart { 15 namespace dart {
14 16
15 void DisassembleToStdout::ConsumeInstruction(char* hex_buffer, 17 void DisassembleToStdout::ConsumeInstruction(char* hex_buffer,
16 intptr_t hex_size, 18 intptr_t hex_size,
17 char* human_buffer, 19 char* human_buffer,
18 intptr_t human_size, 20 intptr_t human_size,
19 uword pc) { 21 uword pc) {
20 static const int kHexColumnWidth = 23; 22 static const int kHexColumnWidth = 23;
21 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); 23 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 const intptr_t offset = pc - start; 125 const intptr_t offset = pc - start;
124 const intptr_t old_comment_finger = comment_finger; 126 const intptr_t old_comment_finger = comment_finger;
125 while (comment_finger < comments.Length() && 127 while (comment_finger < comments.Length() &&
126 comments.PCOffsetAt(comment_finger) <= offset) { 128 comments.PCOffsetAt(comment_finger) <= offset) {
127 formatter->Print( 129 formatter->Print(
128 " ;; %s\n", 130 " ;; %s\n",
129 String::Handle(comments.CommentAt(comment_finger)).ToCString()); 131 String::Handle(comments.CommentAt(comment_finger)).ToCString());
130 comment_finger++; 132 comment_finger++;
131 } 133 }
132 if (old_comment_finger != comment_finger) { 134 if (old_comment_finger != comment_finger) {
135 char str[4000];
136 BufferFormatter f(str, sizeof(str));
133 // Comment emitted, emit inlining information. 137 // Comment emitted, emit inlining information.
134 code.GetInlinedFunctionsAt(offset, &inlined_functions); 138 code.GetInlinedFunctionsAt(offset, &inlined_functions);
135 // Skip top scope function printing (last entry in 'inlined_functions'). 139 // Skip top scope function printing (last entry in 'inlined_functions').
136 bool first = true; 140 bool first = true;
137 for (intptr_t i = inlined_functions.length() - 2; i >= 0; i--) { 141 for (intptr_t i = inlined_functions.length() - 2; i >= 0; i--) {
138 const char* name = inlined_functions[i]->ToQualifiedCString(); 142 const char* name = inlined_functions[i]->ToQualifiedCString();
139 if (first) { 143 if (first) {
140 formatter->Print(" ;; Inlined [%s", name); 144 f.Print(" ;; Inlined [%s", name);
141 first = false; 145 first = false;
142 } else { 146 } else {
143 formatter->Print(" -> %s", name); 147 f.Print(" -> %s", name);
144 } 148 }
145 } 149 }
146 if (!first) { 150 if (!first) {
147 formatter->Print("]\n"); 151 f.Print("]\n");
152 formatter->Print(str);
148 } 153 }
149 } 154 }
150 int instruction_length; 155 int instruction_length;
151 DecodeInstruction(hex_buffer, 156 DecodeInstruction(hex_buffer,
152 sizeof(hex_buffer), 157 sizeof(hex_buffer),
153 human_buffer, 158 human_buffer,
154 sizeof(human_buffer), 159 sizeof(human_buffer),
155 &instruction_length, pc); 160 &instruction_length, pc);
156 formatter->ConsumeInstruction(hex_buffer, 161 formatter->ConsumeInstruction(hex_buffer,
157 sizeof(hex_buffer), 162 sizeof(hex_buffer),
158 human_buffer, 163 human_buffer,
159 sizeof(human_buffer), 164 sizeof(human_buffer),
160 pc); 165 pc);
161 pc += instruction_length; 166 pc += instruction_length;
162 } 167 }
163 } 168 }
164 169
165 } // namespace dart 170 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698