149 {
150 if (comments == nullptr) {
151 comments =
code.IsNull() ? &Code::Comments::New(0) : &
code.comments();
152 }
153 ASSERT(formatter !=
nullptr);
154 char hex_buffer[kHexadecimalBufferSize];
155 char human_buffer[kUserReadableBufferSize];
157 intptr_t comment_finger = 0;
158 GrowableArray<const Function*> inlined_functions;
159 GrowableArray<TokenPosition> token_positions;
160 while (pc < end) {
162 const intptr_t old_comment_finger = comment_finger;
163 while (comment_finger < comments->Length() &&
164 comments->PCOffsetAt(comment_finger) <=
offset) {
165 formatter->Print(" ;; %s\n", comments->CommentAt(comment_finger));
166 comment_finger++;
167 }
168 if (FLAG_include_inlining_info_in_disassembly &&
169 old_comment_finger != comment_finger && !
code.IsNull()) {
170 char str[4000];
171 BufferFormatter
f(str,
sizeof(str));
172
173 code.GetInlinedFunctionsAtInstruction(
offset, &inlined_functions,
174 &token_positions);
175
176 bool first = true;
177 for (intptr_t
i = 1;
i < inlined_functions.length();
i++) {
178 const char*
name = inlined_functions[
i]->ToQualifiedCString();
179 if (first) {
180 f.Printf(
" ;; Inlined [%s",
name);
181 first = false;
182 } else {
183 f.Printf(
" -> %s",
name);
184 }
185 }
186 if (!first) {
188 formatter->Print("%s", str);
189 }
190 }
191 int instruction_length;
192 Object* object;
194 sizeof(human_buffer), &instruction_length,
code, &
object,
195 pc);
196 formatter->ConsumeInstruction(hex_buffer, sizeof(hex_buffer), human_buffer,
197 sizeof(human_buffer), object,
198 FLAG_disassemble_relative ?
offset : pc);
199 pc += instruction_length;
200 }
201}
static void DecodeInstruction(char *hex_buffer, intptr_t hex_size, char *human_buffer, intptr_t human_size, int *out_instr_len, const Code &code, Object **object, uword pc)