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

Side by Side Diff: runtime/vm/disassembler_ia32.cc

Issue 11027060: Faster 64-bit right-shift for the ia32 compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 8 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 | « runtime/vm/code_generator.h ('k') | runtime/vm/flow_graph_optimizer.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
8 #if defined(TARGET_ARCH_IA32) 8 #if defined(TARGET_ARCH_IA32)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 uint8_t cond = *(data + 1) & 0x0F; 753 uint8_t cond = *(data + 1) & 0x0F;
754 const char* mnem = conditional_move_mnem[cond]; 754 const char* mnem = conditional_move_mnem[cond];
755 int op_size = PrintOperands(mnem, REG_OPER_OP_ORDER, data + 2); 755 int op_size = PrintOperands(mnem, REG_OPER_OP_ORDER, data + 2);
756 return 2 + op_size; // includes 0x0F 756 return 2 + op_size; // includes 0x0F
757 } 757 }
758 758
759 759
760 int X86Decoder::D1D3C1Instruction(uint8_t* data) { 760 int X86Decoder::D1D3C1Instruction(uint8_t* data) {
761 uint8_t op = *data; 761 uint8_t op = *data;
762 ASSERT(op == 0xD1 || op == 0xD3 || op == 0xC1); 762 ASSERT(op == 0xD1 || op == 0xD3 || op == 0xC1);
763 uint8_t modrm = *(data+1);
764 int mod, regop, rm; 763 int mod, regop, rm;
765 GetModRm(modrm, &mod, &regop, &rm); 764 GetModRm(*(data+1), &mod, &regop, &rm);
766 int imm8 = -1; 765 int num_bytes = 1;
767 int num_bytes = 2; 766 const char* mnem = NULL;
768 if (mod == 3) { 767 switch (regop) {
769 const char* mnem = NULL; 768 case 2: mnem = "rcl"; break;
770 if (op == 0xD1) { 769 case 4: mnem = "shl"; break;
771 imm8 = 1; 770 case 5: mnem = "shr"; break;
772 switch (regop) { 771 case 7: mnem = "sar"; break;
773 case edx: mnem = "rcl"; break; 772 default: UNIMPLEMENTED();
774 case edi: mnem = "sar"; break; 773 }
775 case esp: mnem = "shl"; break; 774 ASSERT(mnem != NULL);
776 case ebp: mnem = "shr"; break; 775 Print(mnem);
777 default: UNIMPLEMENTED(); 776 Print(" ");
778 } 777
779 } else if (op == 0xC1) { 778 if (op == 0xD1) {
780 imm8 = *(data+2); 779 num_bytes += PrintRightOperand(data+1);
781 num_bytes = 3; 780 Print(", 1");
782 switch (regop) { 781 } else if (op == 0xC1) {
783 case edx: mnem = "rcl"; break; 782 num_bytes += PrintRightOperand(data+1);
784 case esp: mnem = "shl"; break; 783 Print(", ");
785 case ebp: mnem = "shr"; break; 784 PrintInt(*(data+2));
786 case edi: mnem = "sar"; break; 785 num_bytes++;
787 default: UNIMPLEMENTED();
788 }
789 } else if (op == 0xD3) {
790 switch (regop) {
791 case esp: mnem = "shl"; break;
792 case ebp: mnem = "shr"; break;
793 case edi: mnem = "sar"; break;
794 default: UNIMPLEMENTED();
795 }
796 }
797 ASSERT(mnem != NULL);
798 Print(mnem);
799 Print(" ");
800 PrintCPURegister(rm);
801 Print(",");
802 if (imm8 > 0) {
803 PrintInt(imm8);
804 } else {
805 Print("cl");
806 }
807 } else { 786 } else {
808 UNIMPLEMENTED(); 787 ASSERT(op == 0xD3);
788 num_bytes += PrintRightOperand(data+1);
789 Print(", cl");
809 } 790 }
810 return num_bytes; 791 return num_bytes;
811 } 792 }
812 793
813 794
814 uint8_t* X86Decoder::F3Instruction(uint8_t* data) { 795 uint8_t* X86Decoder::F3Instruction(uint8_t* data) {
815 if (*(data+1) == 0x0F) { 796 if (*(data+1) == 0x0F) {
816 uint8_t b2 = *(data+2); 797 uint8_t b2 = *(data+2);
817 switch (b2) { 798 switch (b2) {
818 case 0x2C: { 799 case 0x2C: {
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 } else { 1310 } else {
1330 UNIMPLEMENTED(); 1311 UNIMPLEMENTED();
1331 } 1312 }
1332 } else { 1313 } else {
1333 data += 2; 1314 data += 2;
1334 if (f0byte == 0xAB || f0byte == 0xA5 || f0byte == 0xAD) { 1315 if (f0byte == 0xAB || f0byte == 0xA5 || f0byte == 0xAD) {
1335 // shrd, shld, bts 1316 // shrd, shld, bts
1336 Print(f0mnem); 1317 Print(f0mnem);
1337 int mod, regop, rm; 1318 int mod, regop, rm;
1338 GetModRm(*data, &mod, &regop, &rm); 1319 GetModRm(*data, &mod, &regop, &rm);
1320 Print(" ");
1339 data += PrintRightOperand(data); 1321 data += PrintRightOperand(data);
1340 if (f0byte == 0xAB) { 1322 if (f0byte == 0xAB) {
1341 Print(","); 1323 Print(",");
1342 PrintCPURegister(regop); 1324 PrintCPURegister(regop);
1343 } else { 1325 } else {
1344 Print(","); 1326 Print(",");
1345 PrintCPURegister(regop); 1327 PrintCPURegister(regop);
1346 Print(",cl"); 1328 Print(",cl");
1347 } 1329 }
1348 } else if (f0byte == 0x28) { 1330 } else if (f0byte == 0x28) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 human_buffer, 1700 human_buffer,
1719 sizeof(human_buffer), 1701 sizeof(human_buffer),
1720 pc); 1702 pc);
1721 pc += instruction_length; 1703 pc += instruction_length;
1722 } 1704 }
1723 } 1705 }
1724 1706
1725 } // namespace dart 1707 } // namespace dart
1726 1708
1727 #endif // defined TARGET_ARCH_IA32 1709 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.h ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698