| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/globals.h" // Needed here to get TARGET_ARCH_MIPS. | 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 8 #if defined(TARGET_ARCH_MIPS) | 8 #if defined(TARGET_ARCH_MIPS) |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/instructions.h" |
| 10 | 11 |
| 11 namespace dart { | 12 namespace dart { |
| 12 | 13 |
| 13 #ifndef PRODUCT | 14 #ifndef PRODUCT |
| 14 | 15 |
| 15 class MIPSDecoder : public ValueObject { | 16 class MIPSDecoder : public ValueObject { |
| 16 public: | 17 public: |
| 17 MIPSDecoder(char* buffer, size_t buffer_size) | 18 MIPSDecoder(char* buffer, size_t buffer_size) |
| 18 : buffer_(buffer), | 19 : buffer_(buffer), |
| 19 buffer_size_(buffer_size), | 20 buffer_size_(buffer_size), |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 default: { | 772 default: { |
| 772 Unknown(instr); | 773 Unknown(instr); |
| 773 break; | 774 break; |
| 774 } | 775 } |
| 775 } | 776 } |
| 776 } | 777 } |
| 777 | 778 |
| 778 | 779 |
| 779 void Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size, | 780 void Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size, |
| 780 char* human_buffer, intptr_t human_size, | 781 char* human_buffer, intptr_t human_size, |
| 781 int* out_instr_len, uword pc) { | 782 int* out_instr_len, const Code& code, |
| 783 Object** object, uword pc) { |
| 782 MIPSDecoder decoder(human_buffer, human_size); | 784 MIPSDecoder decoder(human_buffer, human_size); |
| 783 Instr* instr = Instr::At(pc); | 785 Instr* instr = Instr::At(pc); |
| 784 decoder.InstructionDecode(instr); | 786 decoder.InstructionDecode(instr); |
| 785 OS::SNPrint(hex_buffer, hex_size, "%08x", instr->InstructionBits()); | 787 OS::SNPrint(hex_buffer, hex_size, "%08x", instr->InstructionBits()); |
| 786 if (out_instr_len) { | 788 if (out_instr_len) { |
| 787 *out_instr_len = Instr::kInstrSize; | 789 *out_instr_len = Instr::kInstrSize; |
| 788 } | 790 } |
| 791 |
| 792 *object = NULL; |
| 793 if (!code.IsNull()) { |
| 794 *object = &Object::Handle(); |
| 795 if (!DecodeLoadObjectFromPoolOrThread(pc, code, *object)) { |
| 796 *object = NULL; |
| 797 } |
| 798 } |
| 789 } | 799 } |
| 790 | 800 |
| 791 #endif // !PRODUCT | 801 #endif // !PRODUCT |
| 792 | 802 |
| 793 } // namespace dart | 803 } // namespace dart |
| 794 | 804 |
| 795 #endif // defined TARGET_ARCH_MIPS | 805 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |