| 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 #include <assert.h> | 5 #include <assert.h> |
| 6 #include <stdarg.h> | 6 #include <stdarg.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_X87 | 9 #if V8_TARGET_ARCH_X87 |
| 10 | 10 |
| 11 #include "src/base/compiler-specific.h" | |
| 12 #include "src/disasm.h" | 11 #include "src/disasm.h" |
| 13 | 12 |
| 14 namespace disasm { | 13 namespace disasm { |
| 15 | 14 |
| 16 enum OperandOrder { | 15 enum OperandOrder { |
| 17 UNSET_OP_ORDER = 0, | 16 UNSET_OP_ORDER = 0, |
| 18 REG_OPER_OP_ORDER, | 17 REG_OPER_OP_ORDER, |
| 19 OPER_REG_OP_ORDER | 18 OPER_REG_OP_ORDER |
| 20 }; | 19 }; |
| 21 | 20 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 int F7Instruction(byte* data); | 318 int F7Instruction(byte* data); |
| 320 int D1D3C1Instruction(byte* data); | 319 int D1D3C1Instruction(byte* data); |
| 321 int JumpShort(byte* data); | 320 int JumpShort(byte* data); |
| 322 int JumpConditional(byte* data, const char* comment); | 321 int JumpConditional(byte* data, const char* comment); |
| 323 int JumpConditionalShort(byte* data, const char* comment); | 322 int JumpConditionalShort(byte* data, const char* comment); |
| 324 int SetCC(byte* data); | 323 int SetCC(byte* data); |
| 325 int CMov(byte* data); | 324 int CMov(byte* data); |
| 326 int FPUInstruction(byte* data); | 325 int FPUInstruction(byte* data); |
| 327 int MemoryFPUInstruction(int escape_opcode, int regop, byte* modrm_start); | 326 int MemoryFPUInstruction(int escape_opcode, int regop, byte* modrm_start); |
| 328 int RegisterFPUInstruction(int escape_opcode, byte modrm_byte); | 327 int RegisterFPUInstruction(int escape_opcode, byte modrm_byte); |
| 329 PRINTF_FORMAT(2, 3) void AppendToBuffer(const char* format, ...); | 328 void AppendToBuffer(const char* format, ...); |
| 329 |
| 330 | 330 |
| 331 void UnimplementedInstruction() { | 331 void UnimplementedInstruction() { |
| 332 if (abort_on_unimplemented_) { | 332 if (abort_on_unimplemented_) { |
| 333 UNIMPLEMENTED(); | 333 UNIMPLEMENTED(); |
| 334 } else { | 334 } else { |
| 335 AppendToBuffer("'Unimplemented Instruction'"); | 335 AppendToBuffer("'Unimplemented Instruction'"); |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 }; | 338 }; |
| 339 | 339 |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 data++; | 941 data++; |
| 942 } else if (*data == 0x2E /*cs*/) { | 942 } else if (*data == 0x2E /*cs*/) { |
| 943 branch_hint = "predicted not taken"; | 943 branch_hint = "predicted not taken"; |
| 944 data++; | 944 data++; |
| 945 } | 945 } |
| 946 bool processed = true; // Will be set to false if the current instruction | 946 bool processed = true; // Will be set to false if the current instruction |
| 947 // is not in 'instructions' table. | 947 // is not in 'instructions' table. |
| 948 const InstructionDesc& idesc = instruction_table_->Get(*data); | 948 const InstructionDesc& idesc = instruction_table_->Get(*data); |
| 949 switch (idesc.type) { | 949 switch (idesc.type) { |
| 950 case ZERO_OPERANDS_INSTR: | 950 case ZERO_OPERANDS_INSTR: |
| 951 AppendToBuffer("%s", idesc.mnem); | 951 AppendToBuffer(idesc.mnem); |
| 952 data++; | 952 data++; |
| 953 break; | 953 break; |
| 954 | 954 |
| 955 case TWO_OPERANDS_INSTR: | 955 case TWO_OPERANDS_INSTR: |
| 956 data++; | 956 data++; |
| 957 data += PrintOperands(idesc.mnem, idesc.op_order_, data); | 957 data += PrintOperands(idesc.mnem, idesc.op_order_, data); |
| 958 break; | 958 break; |
| 959 | 959 |
| 960 case JUMP_CONDITIONAL_SHORT_INSTR: | 960 case JUMP_CONDITIONAL_SHORT_INSTR: |
| 961 data += JumpConditionalShort(data, branch_hint); | 961 data += JumpConditionalShort(data, branch_hint); |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 fprintf(f, " "); | 1817 fprintf(f, " "); |
| 1818 } | 1818 } |
| 1819 fprintf(f, " %s\n", buffer.start()); | 1819 fprintf(f, " %s\n", buffer.start()); |
| 1820 } | 1820 } |
| 1821 } | 1821 } |
| 1822 | 1822 |
| 1823 | 1823 |
| 1824 } // namespace disasm | 1824 } // namespace disasm |
| 1825 | 1825 |
| 1826 #endif // V8_TARGET_ARCH_X87 | 1826 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |