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_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
10 | 10 |
(...skipping 2217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2228 "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" | 2228 "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" |
2229 }; | 2229 }; |
2230 | 2230 |
2231 | 2231 |
2232 static const char* const xmm_regs[8] = { | 2232 static const char* const xmm_regs[8] = { |
2233 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" | 2233 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" |
2234 }; | 2234 }; |
2235 | 2235 |
2236 | 2236 |
2237 const char* NameConverter::NameOfAddress(byte* addr) const { | 2237 const char* NameConverter::NameOfAddress(byte* addr) const { |
2238 v8::internal::SNPrintF(tmp_buffer_, "%p", addr); | 2238 v8::internal::SNPrintF(tmp_buffer_, "%p", static_cast<void*>(addr)); |
2239 return tmp_buffer_.start(); | 2239 return tmp_buffer_.start(); |
2240 } | 2240 } |
2241 | 2241 |
2242 | 2242 |
2243 const char* NameConverter::NameOfConstant(byte* addr) const { | 2243 const char* NameConverter::NameOfConstant(byte* addr) const { |
2244 return NameOfAddress(addr); | 2244 return NameOfAddress(addr); |
2245 } | 2245 } |
2246 | 2246 |
2247 | 2247 |
2248 const char* NameConverter::NameOfCPURegister(int reg) const { | 2248 const char* NameConverter::NameOfCPURegister(int reg) const { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2291 | 2291 |
2292 | 2292 |
2293 /*static*/ void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { | 2293 /*static*/ void Disassembler::Disassemble(FILE* f, byte* begin, byte* end) { |
2294 NameConverter converter; | 2294 NameConverter converter; |
2295 Disassembler d(converter); | 2295 Disassembler d(converter); |
2296 for (byte* pc = begin; pc < end;) { | 2296 for (byte* pc = begin; pc < end;) { |
2297 v8::internal::EmbeddedVector<char, 128> buffer; | 2297 v8::internal::EmbeddedVector<char, 128> buffer; |
2298 buffer[0] = '\0'; | 2298 buffer[0] = '\0'; |
2299 byte* prev_pc = pc; | 2299 byte* prev_pc = pc; |
2300 pc += d.InstructionDecode(buffer, pc); | 2300 pc += d.InstructionDecode(buffer, pc); |
2301 fprintf(f, "%p", prev_pc); | 2301 fprintf(f, "%p", static_cast<void*>(prev_pc)); |
2302 fprintf(f, " "); | 2302 fprintf(f, " "); |
2303 | 2303 |
2304 for (byte* bp = prev_pc; bp < pc; bp++) { | 2304 for (byte* bp = prev_pc; bp < pc; bp++) { |
2305 fprintf(f, "%02x", *bp); | 2305 fprintf(f, "%02x", *bp); |
2306 } | 2306 } |
2307 for (int i = 6 - (pc - prev_pc); i >= 0; i--) { | 2307 for (int i = 6 - (pc - prev_pc); i >= 0; i--) { |
2308 fprintf(f, " "); | 2308 fprintf(f, " "); |
2309 } | 2309 } |
2310 fprintf(f, " %s\n", buffer.start()); | 2310 fprintf(f, " %s\n", buffer.start()); |
2311 } | 2311 } |
2312 } | 2312 } |
2313 | 2313 |
2314 | 2314 |
2315 } // namespace disasm | 2315 } // namespace disasm |
2316 | 2316 |
2317 #endif // V8_TARGET_ARCH_IA32 | 2317 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |