| OLD | NEW | 
|    1 // Copyright 2007-2009 the V8 project authors. All rights reserved. |    1 // Copyright 2007-2009 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   50 #include <assert.h> |   50 #include <assert.h> | 
|   51 #include <stdio.h> |   51 #include <stdio.h> | 
|   52 #include <stdarg.h> |   52 #include <stdarg.h> | 
|   53 #include <string.h> |   53 #include <string.h> | 
|   54 #ifndef WIN32 |   54 #ifndef WIN32 | 
|   55 #include <stdint.h> |   55 #include <stdint.h> | 
|   56 #endif |   56 #endif | 
|   57  |   57  | 
|   58 #include "v8.h" |   58 #include "v8.h" | 
|   59  |   59  | 
 |   60 #include "constants-arm.h" | 
|   60 #include "disasm.h" |   61 #include "disasm.h" | 
|   61 #include "macro-assembler.h" |   62 #include "macro-assembler.h" | 
|   62 #include "platform.h" |   63 #include "platform.h" | 
|   63  |   64  | 
|   64  |   65  | 
|   65 namespace assembler { |   66 namespace assembler { | 
|   66 namespace arm { |   67 namespace arm { | 
|   67  |   68  | 
|   68 namespace v8i = v8::internal; |   69 namespace v8i = v8::internal; | 
|   69  |   70  | 
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  891  |  892  | 
|  892  |  893  | 
|  893  |  894  | 
|  894 //------------------------------------------------------------------------------ |  895 //------------------------------------------------------------------------------ | 
|  895  |  896  | 
|  896 namespace disasm { |  897 namespace disasm { | 
|  897  |  898  | 
|  898 namespace v8i = v8::internal; |  899 namespace v8i = v8::internal; | 
|  899  |  900  | 
|  900  |  901  | 
|  901 static const int kMaxRegisters = 16; |  | 
|  902  |  | 
|  903 // These register names are defined in a way to match the native disassembler |  | 
|  904 // formatting. See for example the command "objdump -d <binary file>". |  | 
|  905 static const char* reg_names[kMaxRegisters] = { |  | 
|  906   "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", |  | 
|  907   "r8", "r9", "r10", "fp", "ip", "sp", "lr", "pc", |  | 
|  908 }; |  | 
|  909  |  | 
|  910  |  | 
|  911 const char* NameConverter::NameOfAddress(byte* addr) const { |  902 const char* NameConverter::NameOfAddress(byte* addr) const { | 
|  912   static v8::internal::EmbeddedVector<char, 32> tmp_buffer; |  903   static v8::internal::EmbeddedVector<char, 32> tmp_buffer; | 
|  913   v8::internal::OS::SNPrintF(tmp_buffer, "%p", addr); |  904   v8::internal::OS::SNPrintF(tmp_buffer, "%p", addr); | 
|  914   return tmp_buffer.start(); |  905   return tmp_buffer.start(); | 
|  915 } |  906 } | 
|  916  |  907  | 
|  917  |  908  | 
|  918 const char* NameConverter::NameOfConstant(byte* addr) const { |  909 const char* NameConverter::NameOfConstant(byte* addr) const { | 
|  919   return NameOfAddress(addr); |  910   return NameOfAddress(addr); | 
|  920 } |  911 } | 
|  921  |  912  | 
|  922  |  913  | 
|  923 const char* NameConverter::NameOfCPURegister(int reg) const { |  914 const char* NameConverter::NameOfCPURegister(int reg) const { | 
|  924   const char* result; |  915   return assembler::arm::Registers::Name(reg); | 
|  925   if ((0 <= reg) && (reg < kMaxRegisters)) { |  | 
|  926     result = reg_names[reg]; |  | 
|  927   } else { |  | 
|  928     result = "noreg"; |  | 
|  929   } |  | 
|  930   return result; |  | 
|  931 } |  916 } | 
|  932  |  917  | 
|  933  |  918  | 
|  934 const char* NameConverter::NameOfByteCPURegister(int reg) const { |  919 const char* NameConverter::NameOfByteCPURegister(int reg) const { | 
|  935   UNREACHABLE();  // ARM does not have the concept of a byte register |  920   UNREACHABLE();  // ARM does not have the concept of a byte register | 
|  936   return "nobytereg"; |  921   return "nobytereg"; | 
|  937 } |  922 } | 
|  938  |  923  | 
|  939  |  924  | 
|  940 const char* NameConverter::NameOfXMMRegister(int reg) const { |  925 const char* NameConverter::NameOfXMMRegister(int reg) const { | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  984     buffer[0] = '\0'; |  969     buffer[0] = '\0'; | 
|  985     byte* prev_pc = pc; |  970     byte* prev_pc = pc; | 
|  986     pc += d.InstructionDecode(buffer, pc); |  971     pc += d.InstructionDecode(buffer, pc); | 
|  987     fprintf(f, "%p    %08x      %s\n", |  972     fprintf(f, "%p    %08x      %s\n", | 
|  988             prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |  973             prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 
|  989   } |  974   } | 
|  990 } |  975 } | 
|  991  |  976  | 
|  992  |  977  | 
|  993 }  // namespace disasm |  978 }  // namespace disasm | 
| OLD | NEW |