| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 | 848 |
| 849 namespace disasm { | 849 namespace disasm { |
| 850 | 850 |
| 851 static const char* reg_names[16] = { | 851 static const char* reg_names[16] = { |
| 852 "r0", "r1", "r2" , "r3" , "r4" , "r5" , "r6" , "r7" , | 852 "r0", "r1", "r2" , "r3" , "r4" , "r5" , "r6" , "r7" , |
| 853 "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc", | 853 "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc", |
| 854 }; | 854 }; |
| 855 | 855 |
| 856 | 856 |
| 857 const char* NameConverter::NameOfAddress(byte* addr) const { | 857 const char* NameConverter::NameOfAddress(byte* addr) const { |
| 858 static char tmp_buffer[32]; | 858 static v8::internal::EmbeddedVector<char, 32> tmp_buffer; |
| 859 #ifdef WIN32 | 859 v8::internal::OS::SNPrintF(tmp_buffer, "%p", addr); |
| 860 _snprintf(tmp_buffer, sizeof tmp_buffer, "%p", addr); | 860 return tmp_buffer.start(); |
| 861 #else | |
| 862 snprintf(tmp_buffer, sizeof tmp_buffer, "%p", addr); | |
| 863 #endif | |
| 864 return tmp_buffer; | |
| 865 } | 861 } |
| 866 | 862 |
| 867 | 863 |
| 868 const char* NameConverter::NameOfConstant(byte* addr) const { | 864 const char* NameConverter::NameOfConstant(byte* addr) const { |
| 869 return NameOfAddress(addr); | 865 return NameOfAddress(addr); |
| 870 } | 866 } |
| 871 | 867 |
| 872 | 868 |
| 873 const char* NameConverter::NameOfCPURegister(int reg) const { | 869 const char* NameConverter::NameOfCPURegister(int reg) const { |
| 874 const char* result; | 870 const char* result; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 buffer[0] = '\0'; | 928 buffer[0] = '\0'; |
| 933 byte* prev_pc = pc; | 929 byte* prev_pc = pc; |
| 934 pc += d.InstructionDecode(buffer, pc); | 930 pc += d.InstructionDecode(buffer, pc); |
| 935 fprintf(f, "%p %08x %s\n", | 931 fprintf(f, "%p %08x %s\n", |
| 936 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 932 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
| 937 } | 933 } |
| 938 } | 934 } |
| 939 | 935 |
| 940 | 936 |
| 941 } // namespace disasm | 937 } // namespace disasm |
| OLD | NEW |