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

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

Issue 615223005: [turbofan] support all shift operands on x64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | test/cctest/test-disasm-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 return 1 + count; 702 return 1 + count;
703 } else { 703 } else {
704 UnimplementedInstruction(); 704 UnimplementedInstruction();
705 return 2; 705 return 2;
706 } 706 }
707 } 707 }
708 708
709 709
710 int DisassemblerX64::ShiftInstruction(byte* data) { 710 int DisassemblerX64::ShiftInstruction(byte* data) {
711 byte op = *data & (~1); 711 byte op = *data & (~1);
712 int count = 1;
712 if (op != 0xD0 && op != 0xD2 && op != 0xC0) { 713 if (op != 0xD0 && op != 0xD2 && op != 0xC0) {
713 UnimplementedInstruction(); 714 UnimplementedInstruction();
714 return 1; 715 return count;
715 } 716 }
716 byte modrm = *(data + 1); 717 // Print mneumonic.
717 int mod, regop, rm; 718 {
718 get_modrm(modrm, &mod, &regop, &rm); 719 byte modrm = *(data + count);
719 regop &= 0x7; // The REX.R bit does not affect the operation. 720 int mod, regop, rm;
720 int imm8 = -1; 721 get_modrm(modrm, &mod, &regop, &rm);
721 int num_bytes = 2; 722 regop &= 0x7; // The REX.R bit does not affect the operation.
722 if (mod != 3) { 723 const char* mnem = NULL;
723 UnimplementedInstruction(); 724 switch (regop) {
724 return num_bytes; 725 case 0:
726 mnem = "rol";
727 break;
728 case 1:
729 mnem = "ror";
730 break;
731 case 2:
732 mnem = "rcl";
733 break;
734 case 3:
735 mnem = "rcr";
736 break;
737 case 4:
738 mnem = "shl";
739 break;
740 case 5:
741 mnem = "shr";
742 break;
743 case 7:
744 mnem = "sar";
745 break;
746 default:
747 UnimplementedInstruction();
748 return count + 1;
749 }
750 DCHECK_NE(NULL, mnem);
751 AppendToBuffer("%s%c ", mnem, operand_size_code());
725 } 752 }
726 const char* mnem = NULL; 753 count += PrintRightOperand(data + count);
727 switch (regop) { 754 if (op == 0xD2) {
728 case 0: 755 AppendToBuffer(", cl");
729 mnem = "rol"; 756 } else {
730 break; 757 int imm8 = -1;
731 case 1: 758 if (op == 0xD0) {
732 mnem = "ror"; 759 imm8 = 1;
733 break; 760 } else {
734 case 2: 761 DCHECK_EQ(0xC0, op);
735 mnem = "rcl"; 762 imm8 = *(data + count);
736 break; 763 count++;
737 case 3: 764 }
738 mnem = "rcr"; 765 AppendToBuffer(", %d", imm8);
739 break;
740 case 4:
741 mnem = "shl";
742 break;
743 case 5:
744 mnem = "shr";
745 break;
746 case 7:
747 mnem = "sar";
748 break;
749 default:
750 UnimplementedInstruction();
751 return num_bytes;
752 } 766 }
753 DCHECK_NE(NULL, mnem); 767 return count;
754 if (op == 0xD0) {
755 imm8 = 1;
756 } else if (op == 0xC0) {
757 imm8 = *(data + 2);
758 num_bytes = 3;
759 }
760 AppendToBuffer("%s%c %s,",
761 mnem,
762 operand_size_code(),
763 byte_size_operand_ ? NameOfByteCPURegister(rm)
764 : NameOfCPURegister(rm));
765 if (op == 0xD2) {
766 AppendToBuffer("cl");
767 } else {
768 AppendToBuffer("%d", imm8);
769 }
770 return num_bytes;
771 } 768 }
772 769
773 770
774 // Returns number of bytes used, including *data. 771 // Returns number of bytes used, including *data.
775 int DisassemblerX64::JumpShort(byte* data) { 772 int DisassemblerX64::JumpShort(byte* data) {
776 DCHECK_EQ(0xEB, *data); 773 DCHECK_EQ(0xEB, *data);
777 byte b = *(data + 1); 774 byte b = *(data + 1);
778 byte* dest = data + static_cast<int8_t>(b) + 2; 775 byte* dest = data + static_cast<int8_t>(b) + 2;
779 AppendToBuffer("jmp %s", NameOfAddress(dest)); 776 AppendToBuffer("jmp %s", NameOfAddress(dest));
780 return 2; 777 return 2;
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) { 1903 for (int i = 6 - static_cast<int>(pc - prev_pc); i >= 0; i--) {
1907 fprintf(f, " "); 1904 fprintf(f, " ");
1908 } 1905 }
1909 fprintf(f, " %s\n", buffer.start()); 1906 fprintf(f, " %s\n", buffer.start());
1910 } 1907 }
1911 } 1908 }
1912 1909
1913 } // namespace disasm 1910 } // namespace disasm
1914 1911
1915 #endif // V8_TARGET_ARCH_X64 1912 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | test/cctest/test-disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698