OLD | NEW |
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/deopt_instructions.h" | 8 #include "vm/deopt_instructions.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/il_printer.h" | 10 #include "vm/il_printer.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 hex_buffer, | 177 hex_buffer, |
178 sizeof(hex_buffer), | 178 sizeof(hex_buffer), |
179 human_buffer, | 179 human_buffer, |
180 sizeof(human_buffer), | 180 sizeof(human_buffer), |
181 pc); | 181 pc); |
182 pc += instruction_length; | 182 pc += instruction_length; |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 void Disassembler::DisassembleCode(const Function& function, bool optimized) { | 187 void Disassembler::DisassembleCodeHelper( |
188 const char* function_fullname = function.ToFullyQualifiedCString(); | 188 const char* function_fullname, const Code& code, bool optimized) { |
189 THR_Print("Code for %sfunction '%s' {\n", | 189 THR_Print("Code for %sfunction '%s' {\n", |
190 optimized ? "optimized " : "", | 190 optimized ? "optimized " : "", |
191 function_fullname); | 191 function_fullname); |
192 const Code& code = Code::Handle(function.CurrentCode()); | |
193 code.Disassemble(); | 192 code.Disassemble(); |
194 THR_Print("}\n"); | 193 THR_Print("}\n"); |
195 | 194 |
196 #if defined(TARGET_ARCH_IA32) | 195 #if defined(TARGET_ARCH_IA32) |
197 THR_Print("Pointer offsets for function: {\n"); | 196 THR_Print("Pointer offsets for function: {\n"); |
198 // Pointer offsets are stored in descending order. | 197 // Pointer offsets are stored in descending order. |
199 Object& obj = Object::Handle(); | 198 Object& obj = Object::Handle(); |
200 for (intptr_t i = code.pointer_offsets_length() - 1; i >= 0; i--) { | 199 for (intptr_t i = code.pointer_offsets_length() - 1; i >= 0; i--) { |
201 const uword addr = code.GetPointerOffsetAt(i) + code.EntryPoint(); | 200 const uword addr = code.GetPointerOffsetAt(i) + code.EntryPoint(); |
202 obj = *reinterpret_cast<RawObject**>(addr); | 201 obj = *reinterpret_cast<RawObject**>(addr); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 code.raw()); | 320 code.raw()); |
322 } | 321 } |
323 } | 322 } |
324 THR_Print("}\n"); | 323 THR_Print("}\n"); |
325 } | 324 } |
326 if (optimized && FLAG_trace_inlining_intervals) { | 325 if (optimized && FLAG_trace_inlining_intervals) { |
327 code.DumpInlinedIntervals(); | 326 code.DumpInlinedIntervals(); |
328 } | 327 } |
329 } | 328 } |
330 | 329 |
| 330 |
| 331 void Disassembler::DisassembleCode(const Function& function, bool optimized) { |
| 332 const char* function_fullname = function.ToFullyQualifiedCString(); |
| 333 const Code& code = Code::Handle(function.CurrentCode()); |
| 334 DisassembleCodeHelper(function_fullname, code, optimized); |
| 335 } |
| 336 |
| 337 void Disassembler::DisassembleCodeUnoptimized( |
| 338 const Function& function, bool optimized) { |
| 339 const char* function_fullname = function.ToFullyQualifiedCString(); |
| 340 const Code& code = Code::Handle(function.unoptimized_code()); |
| 341 DisassembleCodeHelper(function_fullname, code, optimized); |
| 342 } |
| 343 |
331 #endif // !PRODUCT | 344 #endif // !PRODUCT |
332 | 345 |
333 } // namespace dart | 346 } // namespace dart |
OLD | NEW |