| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // A Disassembler object is used to disassemble a block of code instruction by | 5 // A Disassembler object is used to disassemble a block of code instruction by |
| 6 // instruction. The default implementation of the NameConverter object can be | 6 // instruction. The default implementation of the NameConverter object can be |
| 7 // overriden to modify register names or to do symbol lookup on addresses. | 7 // overriden to modify register names or to do symbol lookup on addresses. |
| 8 // | 8 // |
| 9 // The example below will disassemble a block of code and print it to stdout. | 9 // The example below will disassemble a block of code and print it to stdout. |
| 10 // | 10 // |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "src/arm/constants-arm.h" | 33 #include "src/arm/constants-arm.h" |
| 34 #include "src/base/bits.h" | 34 #include "src/base/bits.h" |
| 35 #include "src/base/platform/platform.h" | 35 #include "src/base/platform/platform.h" |
| 36 #include "src/disasm.h" | 36 #include "src/disasm.h" |
| 37 #include "src/macro-assembler.h" | 37 #include "src/macro-assembler.h" |
| 38 | 38 |
| 39 | 39 |
| 40 namespace v8 { | 40 namespace v8 { |
| 41 namespace internal { | 41 namespace internal { |
| 42 | 42 |
| 43 const auto GetRegConfig = RegisterConfiguration::Crankshaft; |
| 43 | 44 |
| 44 //------------------------------------------------------------------------------ | 45 //------------------------------------------------------------------------------ |
| 45 | 46 |
| 46 // Decoder decodes and disassembles instructions into an output buffer. | 47 // Decoder decodes and disassembles instructions into an output buffer. |
| 47 // It uses the converter to convert register names and call destinations into | 48 // It uses the converter to convert register names and call destinations into |
| 48 // more informative description. | 49 // more informative description. |
| 49 class Decoder { | 50 class Decoder { |
| 50 public: | 51 public: |
| 51 Decoder(const disasm::NameConverter& converter, | 52 Decoder(const disasm::NameConverter& converter, |
| 52 Vector<char> out_buffer) | 53 Vector<char> out_buffer) |
| (...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 return tmp_buffer_.start(); | 2053 return tmp_buffer_.start(); |
| 2053 } | 2054 } |
| 2054 | 2055 |
| 2055 | 2056 |
| 2056 const char* NameConverter::NameOfConstant(byte* addr) const { | 2057 const char* NameConverter::NameOfConstant(byte* addr) const { |
| 2057 return NameOfAddress(addr); | 2058 return NameOfAddress(addr); |
| 2058 } | 2059 } |
| 2059 | 2060 |
| 2060 | 2061 |
| 2061 const char* NameConverter::NameOfCPURegister(int reg) const { | 2062 const char* NameConverter::NameOfCPURegister(int reg) const { |
| 2062 return v8::internal::Register::from_code(reg).ToString(); | 2063 return v8::internal::GetRegConfig()->GetGeneralRegisterName(reg); |
| 2063 } | 2064 } |
| 2064 | 2065 |
| 2065 | 2066 |
| 2066 const char* NameConverter::NameOfByteCPURegister(int reg) const { | 2067 const char* NameConverter::NameOfByteCPURegister(int reg) const { |
| 2067 UNREACHABLE(); // ARM does not have the concept of a byte register | 2068 UNREACHABLE(); // ARM does not have the concept of a byte register |
| 2068 return "nobytereg"; | 2069 return "nobytereg"; |
| 2069 } | 2070 } |
| 2070 | 2071 |
| 2071 | 2072 |
| 2072 const char* NameConverter::NameOfXMMRegister(int reg) const { | 2073 const char* NameConverter::NameOfXMMRegister(int reg) const { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2113 pc += d.InstructionDecode(buffer, pc); | 2114 pc += d.InstructionDecode(buffer, pc); |
| 2114 v8::internal::PrintF(f, "%p %08x %s\n", static_cast<void*>(prev_pc), | 2115 v8::internal::PrintF(f, "%p %08x %s\n", static_cast<void*>(prev_pc), |
| 2115 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 2116 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
| 2116 } | 2117 } |
| 2117 } | 2118 } |
| 2118 | 2119 |
| 2119 | 2120 |
| 2120 } // namespace disasm | 2121 } // namespace disasm |
| 2121 | 2122 |
| 2122 #endif // V8_TARGET_ARCH_ARM | 2123 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |