OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 | 1066 |
1067 #undef VERIFIY | 1067 #undef VERIFIY |
1068 | 1068 |
1069 // Disassemble the instruction at *instr_ptr into the output buffer. | 1069 // Disassemble the instruction at *instr_ptr into the output buffer. |
1070 int Decoder::InstructionDecode(byte* instr_ptr) { | 1070 int Decoder::InstructionDecode(byte* instr_ptr) { |
1071 Instruction* instr = Instruction::At(instr_ptr); | 1071 Instruction* instr = Instruction::At(instr_ptr); |
1072 // Print raw instruction bytes. | 1072 // Print raw instruction bytes. |
1073 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%08x ", | 1073 out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%08x ", |
1074 instr->InstructionBits()); | 1074 instr->InstructionBits()); |
1075 | 1075 |
1076 #if ABI_USES_FUNCTION_DESCRIPTORS | 1076 if (ABI_USES_FUNCTION_DESCRIPTORS && instr->InstructionBits() == 0) { |
1077 // The first field will be identified as a jump table entry. We emit the rest | 1077 // The first field will be identified as a jump table entry. We |
1078 // of the structure as zero, so just skip past them. | 1078 // emit the rest of the structure as zero, so just skip past them. |
1079 if (instr->InstructionBits() == 0) { | |
1080 Format(instr, "constant"); | 1079 Format(instr, "constant"); |
1081 return Instruction::kInstrSize; | 1080 return Instruction::kInstrSize; |
1082 } | 1081 } |
1083 #endif | |
1084 | 1082 |
1085 switch (instr->OpcodeValue() << 26) { | 1083 switch (instr->OpcodeValue() << 26) { |
1086 case TWI: { | 1084 case TWI: { |
1087 PrintSoftwareInterrupt(instr->SvcValue()); | 1085 PrintSoftwareInterrupt(instr->SvcValue()); |
1088 break; | 1086 break; |
1089 } | 1087 } |
1090 case MULLI: { | 1088 case MULLI: { |
1091 UnknownFormat(instr, "mulli"); | 1089 UnknownFormat(instr, "mulli"); |
1092 break; | 1090 break; |
1093 } | 1091 } |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 pc += d.InstructionDecode(buffer, pc); | 1455 pc += d.InstructionDecode(buffer, pc); |
1458 v8::internal::PrintF(f, "%p %08x %s\n", prev_pc, | 1456 v8::internal::PrintF(f, "%p %08x %s\n", prev_pc, |
1459 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1457 *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
1460 } | 1458 } |
1461 } | 1459 } |
1462 | 1460 |
1463 | 1461 |
1464 } // namespace disasm | 1462 } // namespace disasm |
1465 | 1463 |
1466 #endif // V8_TARGET_ARCH_PPC | 1464 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |