| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include <assert.h> | 5 #include <assert.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <stdarg.h> | 7 #include <stdarg.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "src/v8.h" | 10 #include "src/v8.h" |
| (...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 GetOutput()); | 1727 GetOutput()); |
| 1728 } | 1728 } |
| 1729 | 1729 |
| 1730 } } // namespace v8::internal | 1730 } } // namespace v8::internal |
| 1731 | 1731 |
| 1732 | 1732 |
| 1733 namespace disasm { | 1733 namespace disasm { |
| 1734 | 1734 |
| 1735 | 1735 |
| 1736 const char* NameConverter::NameOfAddress(byte* addr) const { | 1736 const char* NameConverter::NameOfAddress(byte* addr) const { |
| 1737 v8::internal::OS::SNPrintF(tmp_buffer_, "%p", addr); | 1737 v8::internal::SNPrintF(tmp_buffer_, "%p", addr); |
| 1738 return tmp_buffer_.start(); | 1738 return tmp_buffer_.start(); |
| 1739 } | 1739 } |
| 1740 | 1740 |
| 1741 | 1741 |
| 1742 const char* NameConverter::NameOfConstant(byte* addr) const { | 1742 const char* NameConverter::NameOfConstant(byte* addr) const { |
| 1743 return NameOfAddress(addr); | 1743 return NameOfAddress(addr); |
| 1744 } | 1744 } |
| 1745 | 1745 |
| 1746 | 1746 |
| 1747 const char* NameConverter::NameOfCPURegister(int reg) const { | 1747 const char* NameConverter::NameOfCPURegister(int reg) const { |
| 1748 unsigned ureg = reg; // Avoid warnings about signed/unsigned comparisons. | 1748 unsigned ureg = reg; // Avoid warnings about signed/unsigned comparisons. |
| 1749 if (ureg >= v8::internal::kNumberOfRegisters) { | 1749 if (ureg >= v8::internal::kNumberOfRegisters) { |
| 1750 return "noreg"; | 1750 return "noreg"; |
| 1751 } | 1751 } |
| 1752 if (ureg == v8::internal::kZeroRegCode) { | 1752 if (ureg == v8::internal::kZeroRegCode) { |
| 1753 return "xzr"; | 1753 return "xzr"; |
| 1754 } | 1754 } |
| 1755 v8::internal::OS::SNPrintF(tmp_buffer_, "x%u", ureg); | 1755 v8::internal::SNPrintF(tmp_buffer_, "x%u", ureg); |
| 1756 return tmp_buffer_.start(); | 1756 return tmp_buffer_.start(); |
| 1757 } | 1757 } |
| 1758 | 1758 |
| 1759 | 1759 |
| 1760 const char* NameConverter::NameOfByteCPURegister(int reg) const { | 1760 const char* NameConverter::NameOfByteCPURegister(int reg) const { |
| 1761 UNREACHABLE(); // ARM64 does not have the concept of a byte register | 1761 UNREACHABLE(); // ARM64 does not have the concept of a byte register |
| 1762 return "nobytereg"; | 1762 return "nobytereg"; |
| 1763 } | 1763 } |
| 1764 | 1764 |
| 1765 | 1765 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1779 //------------------------------------------------------------------------------ | 1779 //------------------------------------------------------------------------------ |
| 1780 | 1780 |
| 1781 class BufferDisassembler : public v8::internal::Disassembler { | 1781 class BufferDisassembler : public v8::internal::Disassembler { |
| 1782 public: | 1782 public: |
| 1783 explicit BufferDisassembler(v8::internal::Vector<char> out_buffer) | 1783 explicit BufferDisassembler(v8::internal::Vector<char> out_buffer) |
| 1784 : out_buffer_(out_buffer) { } | 1784 : out_buffer_(out_buffer) { } |
| 1785 | 1785 |
| 1786 ~BufferDisassembler() { } | 1786 ~BufferDisassembler() { } |
| 1787 | 1787 |
| 1788 virtual void ProcessOutput(v8::internal::Instruction* instr) { | 1788 virtual void ProcessOutput(v8::internal::Instruction* instr) { |
| 1789 v8::internal::OS::SNPrintF(out_buffer_, "%s", GetOutput()); | 1789 v8::internal::SNPrintF(out_buffer_, "%s", GetOutput()); |
| 1790 } | 1790 } |
| 1791 | 1791 |
| 1792 private: | 1792 private: |
| 1793 v8::internal::Vector<char> out_buffer_; | 1793 v8::internal::Vector<char> out_buffer_; |
| 1794 }; | 1794 }; |
| 1795 | 1795 |
| 1796 Disassembler::Disassembler(const NameConverter& converter) | 1796 Disassembler::Disassembler(const NameConverter& converter) |
| 1797 : converter_(converter) {} | 1797 : converter_(converter) {} |
| 1798 | 1798 |
| 1799 | 1799 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1823 decoder.AppendVisitor(&disasm); | 1823 decoder.AppendVisitor(&disasm); |
| 1824 | 1824 |
| 1825 for (byte* pc = start; pc < end; pc += v8::internal::kInstructionSize) { | 1825 for (byte* pc = start; pc < end; pc += v8::internal::kInstructionSize) { |
| 1826 decoder.Decode(reinterpret_cast<v8::internal::Instruction*>(pc)); | 1826 decoder.Decode(reinterpret_cast<v8::internal::Instruction*>(pc)); |
| 1827 } | 1827 } |
| 1828 } | 1828 } |
| 1829 | 1829 |
| 1830 } // namespace disasm | 1830 } // namespace disasm |
| 1831 | 1831 |
| 1832 #endif // V8_TARGET_ARCH_ARM64 | 1832 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |