| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_IA32. | 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 8 #if defined(TARGET_ARCH_X64) | 8 #if defined(TARGET_ARCH_X64) |
| 9 #include "platform/utils.h" | 9 #include "platform/utils.h" |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| (...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 | 1858 |
| 1859 ASSERT(buffer_[buffer_pos_] == '\0'); | 1859 ASSERT(buffer_[buffer_pos_] == '\0'); |
| 1860 | 1860 |
| 1861 int instr_len = data - reinterpret_cast<uint8_t*>(pc); | 1861 int instr_len = data - reinterpret_cast<uint8_t*>(pc); |
| 1862 ASSERT(instr_len > 0); // Ensure progress. | 1862 ASSERT(instr_len > 0); // Ensure progress. |
| 1863 | 1863 |
| 1864 return instr_len; | 1864 return instr_len; |
| 1865 } | 1865 } |
| 1866 | 1866 |
| 1867 | 1867 |
| 1868 int Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size, | 1868 bool Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size, |
| 1869 char* human_buffer, intptr_t human_size, | 1869 char* human_buffer, intptr_t human_size, |
| 1870 int* out_instr_len, uword pc) { | 1870 int* out_instr_len, uword pc) { |
| 1871 ASSERT(hex_size > 0); | 1871 ASSERT(hex_size > 0); |
| 1872 ASSERT(human_size > 0); | 1872 ASSERT(human_size > 0); |
| 1873 DisassemblerX64 decoder(human_buffer, human_size); | 1873 DisassemblerX64 decoder(human_buffer, human_size); |
| 1874 int instruction_length = decoder.InstructionDecode(pc); | 1874 int instruction_length = decoder.InstructionDecode(pc); |
| 1875 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); | 1875 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); |
| 1876 int hex_index = 0; | 1876 int hex_index = 0; |
| 1877 int remaining_size = hex_size - hex_index; | 1877 int remaining_size = hex_size - hex_index; |
| 1878 for (int i = 0; (i < instruction_length) && (remaining_size > 2); ++i) { | 1878 for (int i = 0; (i < instruction_length) && (remaining_size > 2); ++i) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 pc); | 1919 pc); |
| 1920 pc += instruction_length; | 1920 pc += instruction_length; |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 return true; | 1923 return true; |
| 1924 } | 1924 } |
| 1925 | 1925 |
| 1926 } // namespace dart | 1926 } // namespace dart |
| 1927 | 1927 |
| 1928 #endif // defined TARGET_ARCH_X64 | 1928 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |