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_X64 | 9 #if V8_TARGET_ARCH_X64 |
10 | 10 |
(...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 }; | 2432 }; |
2433 | 2433 |
2434 | 2434 |
2435 static const char* const xmm_regs[16] = { | 2435 static const char* const xmm_regs[16] = { |
2436 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", | 2436 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", |
2437 "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" | 2437 "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" |
2438 }; | 2438 }; |
2439 | 2439 |
2440 | 2440 |
2441 const char* NameConverter::NameOfAddress(byte* addr) const { | 2441 const char* NameConverter::NameOfAddress(byte* addr) const { |
2442 v8::internal::SNPrintF(tmp_buffer_, "%p", addr); | 2442 v8::internal::SNPrintF(tmp_buffer_, "%p", static_cast<void*>(addr)); |
2443 return tmp_buffer_.start(); | 2443 return tmp_buffer_.start(); |
2444 } | 2444 } |
2445 | 2445 |
2446 | 2446 |
2447 const char* NameConverter::NameOfConstant(byte* addr) const { | 2447 const char* NameConverter::NameOfConstant(byte* addr) const { |
2448 return NameOfAddress(addr); | 2448 return NameOfAddress(addr); |
2449 } | 2449 } |
2450 | 2450 |
2451 | 2451 |
2452 const char* NameConverter::NameOfCPURegister(int reg) const { | 2452 const char* NameConverter::NameOfCPURegister(int reg) const { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2499 | 2499 |
2500 | 2500 |
2501 void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { | 2501 void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { |
2502 NameConverter converter; | 2502 NameConverter converter; |
2503 Disassembler d(converter); | 2503 Disassembler d(converter); |
2504 for (byte* pc = begin; pc < end;) { | 2504 for (byte* pc = begin; pc < end;) { |
2505 v8::internal::EmbeddedVector<char, 128> buffer; | 2505 v8::internal::EmbeddedVector<char, 128> buffer; |
2506 buffer[0] = '\0'; | 2506 buffer[0] = '\0'; |
2507 byte* prev_pc = pc; | 2507 byte* prev_pc = pc; |
2508 pc += d.InstructionDecode(buffer, pc); | 2508 pc += d.InstructionDecode(buffer, pc); |
2509 fprintf(f, "%p", prev_pc); | 2509 fprintf(f, "%p", static_cast<void*>(prev_pc)); |
2510 fprintf(f, " "); | 2510 fprintf(f, " "); |
2511 | 2511 |
2512 for (byte* bp = prev_pc; bp < pc; bp++) { | 2512 for (byte* bp = prev_pc; bp < pc; bp++) { |
2513 fprintf(f, "%02x", *bp); | 2513 fprintf(f, "%02x", *bp); |
2514 } | 2514 } |
2515 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { | 2515 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { |
2516 fprintf(f, " "); | 2516 fprintf(f, " "); |
2517 } | 2517 } |
2518 fprintf(f, " %s\n", buffer.start()); | 2518 fprintf(f, " %s\n", buffer.start()); |
2519 } | 2519 } |
2520 } | 2520 } |
2521 | 2521 |
2522 } // namespace disasm | 2522 } // namespace disasm |
2523 | 2523 |
2524 #endif // V8_TARGET_ARCH_X64 | 2524 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |