Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: src/arm/disasm-arm.cc

Issue 173567: ARM native regexps. (Closed)
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // field in the instruction encoding. 112 // field in the instruction encoding.
113 // Types 0 and 1 are combined as they are largely the same except for the way 113 // Types 0 and 1 are combined as they are largely the same except for the way
114 // they interpret the shifter operand. 114 // they interpret the shifter operand.
115 void DecodeType01(Instr* instr); 115 void DecodeType01(Instr* instr);
116 void DecodeType2(Instr* instr); 116 void DecodeType2(Instr* instr);
117 void DecodeType3(Instr* instr); 117 void DecodeType3(Instr* instr);
118 void DecodeType4(Instr* instr); 118 void DecodeType4(Instr* instr);
119 void DecodeType5(Instr* instr); 119 void DecodeType5(Instr* instr);
120 void DecodeType6(Instr* instr); 120 void DecodeType6(Instr* instr);
121 void DecodeType7(Instr* instr); 121 void DecodeType7(Instr* instr);
122 void DecodeUnconditional(Instr* instr);
122 123
123 const disasm::NameConverter& converter_; 124 const disasm::NameConverter& converter_;
124 v8::internal::Vector<char> out_buffer_; 125 v8::internal::Vector<char> out_buffer_;
125 int out_buffer_pos_; 126 int out_buffer_pos_;
126 127
127 DISALLOW_COPY_AND_ASSIGN(Decoder); 128 DISALLOW_COPY_AND_ASSIGN(Decoder);
128 }; 129 };
129 130
130 131
131 // Support for assertions in the Decoder formatting functions. 132 // Support for assertions in the Decoder formatting functions.
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 void Decoder::DecodeType7(Instr* instr) { 768 void Decoder::DecodeType7(Instr* instr) {
768 if (instr->Bit(24) == 1) { 769 if (instr->Bit(24) == 1) {
769 Format(instr, "swi'cond 'swi"); 770 Format(instr, "swi'cond 'swi");
770 } else { 771 } else {
771 // Coprocessor instructions currently not supported. 772 // Coprocessor instructions currently not supported.
772 Unknown(instr); 773 Unknown(instr);
773 } 774 }
774 } 775 }
775 776
776 777
778 void Decoder::DecodeUnconditional(Instr* instr) {
779 if (instr->Bits(7, 4) == 0xB && instr->Bits(27, 25) == 0 && instr->HasL()) {
780 Format(instr, "'memop'h'pu 'rd, ");
781 bool immediate = instr->HasB();
782 switch (instr->PUField()) {
783 case 0: {
784 // Post index, negative.
785 if (instr->HasW()) {
786 Unknown(instr);
787 break;
788 }
789 if (immediate) {
790 Format(instr, "['rn], #-'imm12");
791 } else {
792 Format(instr, "['rn], -'rm");
793 }
794 break;
795 }
796 case 1: {
797 // Post index, positive.
798 if (instr->HasW()) {
799 Unknown(instr);
800 break;
801 }
802 if (immediate) {
803 Format(instr, "['rn], #+'imm12");
804 } else {
805 Format(instr, "['rn], +'rm");
806 }
807 break;
808 }
809 case 2: {
810 // Pre index or offset, negative.
811 if (immediate) {
812 Format(instr, "['rn, #-'imm12]'w");
813 } else {
814 Format(instr, "['rn, -'rm]'w");
815 }
816 break;
817 }
818 case 3: {
819 // Pre index or offset, positive.
820 if (immediate) {
821 Format(instr, "['rn, #+'imm12]'w");
822 } else {
823 Format(instr, "['rn, +'rm]'w");
824 }
825 break;
826 }
827 default: {
828 // The PU field is a 2-bit field.
829 UNREACHABLE();
830 break;
831 }
832 }
833 return;
834 }
835 Format(instr, "break 'msg");
836 }
837
838
777 // Disassemble the instruction at *instr_ptr into the output buffer. 839 // Disassemble the instruction at *instr_ptr into the output buffer.
778 int Decoder::InstructionDecode(byte* instr_ptr) { 840 int Decoder::InstructionDecode(byte* instr_ptr) {
779 Instr* instr = Instr::At(instr_ptr); 841 Instr* instr = Instr::At(instr_ptr);
780 // Print raw instruction bytes. 842 // Print raw instruction bytes.
781 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, 843 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
782 "%08x ", 844 "%08x ",
783 instr->InstructionBits()); 845 instr->InstructionBits());
784 if (instr->ConditionField() == special_condition) { 846 if (instr->ConditionField() == special_condition) {
785 Format(instr, "break 'msg"); 847 DecodeUnconditional(instr);
786 return Instr::kInstrSize; 848 return Instr::kInstrSize;
787 } 849 }
788 switch (instr->TypeField()) { 850 switch (instr->TypeField()) {
789 case 0: 851 case 0:
790 case 1: { 852 case 1: {
791 DecodeType01(instr); 853 DecodeType01(instr);
792 break; 854 break;
793 } 855 }
794 case 2: { 856 case 2: {
795 DecodeType2(instr); 857 DecodeType2(instr);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 buffer[0] = '\0'; 984 buffer[0] = '\0';
923 byte* prev_pc = pc; 985 byte* prev_pc = pc;
924 pc += d.InstructionDecode(buffer, pc); 986 pc += d.InstructionDecode(buffer, pc);
925 fprintf(f, "%p %08x %s\n", 987 fprintf(f, "%p %08x %s\n",
926 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); 988 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start());
927 } 989 }
928 } 990 }
929 991
930 992
931 } // namespace disasm 993 } // namespace disasm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698