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

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

Issue 1176703002: Make guard_cid and nullable_cid half words. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/intermediate_language_arm.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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 void PrintAddress(uword addr); 340 void PrintAddress(uword addr);
341 341
342 typedef void (X86Decoder::*RegisterNamePrinter)(int reg); 342 typedef void (X86Decoder::*RegisterNamePrinter)(int reg);
343 343
344 int PrintRightOperandHelper(uint8_t* modrmp, 344 int PrintRightOperandHelper(uint8_t* modrmp,
345 RegisterNamePrinter register_printer); 345 RegisterNamePrinter register_printer);
346 int PrintRightOperand(uint8_t* modrmp); 346 int PrintRightOperand(uint8_t* modrmp);
347 int PrintRightXmmOperand(uint8_t* modrmp); 347 int PrintRightXmmOperand(uint8_t* modrmp);
348 int PrintRightByteOperand(uint8_t* modrmp); 348 int PrintRightByteOperand(uint8_t* modrmp);
349 int PrintOperands(const char* mnem, OperandOrder op_order, uint8_t* data); 349 int PrintOperands(const char* mnem, OperandOrder op_order, uint8_t* data);
350 int PrintImmediateOp(uint8_t* data); 350 int PrintImmediateOp(uint8_t* data, bool size_override = false);
351 351
352 // Handle special encodings. 352 // Handle special encodings.
353 int JumpShort(uint8_t* data); 353 int JumpShort(uint8_t* data);
354 int JumpConditional(uint8_t* data, const char* comment); 354 int JumpConditional(uint8_t* data, const char* comment);
355 int JumpConditionalShort(uint8_t* data, const char* comment); 355 int JumpConditionalShort(uint8_t* data, const char* comment);
356 int SetCC(uint8_t* data); 356 int SetCC(uint8_t* data);
357 int CMov(uint8_t* data); 357 int CMov(uint8_t* data);
358 int D1D3C1Instruction(uint8_t* data); 358 int D1D3C1Instruction(uint8_t* data);
359 uint8_t* F3Instruction(uint8_t* data); 359 uint8_t* F3Instruction(uint8_t* data);
360 int F7Instruction(uint8_t* data); 360 int F7Instruction(uint8_t* data);
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 break; 704 break;
705 } 705 }
706 default: 706 default:
707 UNREACHABLE(); 707 UNREACHABLE();
708 break; 708 break;
709 } 709 }
710 return advance; 710 return advance;
711 } 711 }
712 712
713 713
714 int X86Decoder::PrintImmediateOp(uint8_t* data) { 714 int X86Decoder::PrintImmediateOp(uint8_t* data, bool size_override) {
715 bool sign_extension_bit = (*data & 0x02) != 0; 715 bool sign_extension_bit = (*data & 0x02) != 0;
716 uint8_t modrm = *(data+1); 716 uint8_t modrm = *(data+1);
717 int mod, regop, rm; 717 int mod, regop, rm;
718 GetModRm(modrm, &mod, &regop, &rm); 718 GetModRm(modrm, &mod, &regop, &rm);
719 const char* mnem = "Imm???"; 719 const char* mnem = "Imm???";
720 switch (regop) { 720 switch (regop) {
721 case 0: mnem = "add"; break; 721 case 0: mnem = "add"; break;
722 case 1: mnem = "or"; break; 722 case 1: mnem = "or"; break;
723 case 2: mnem = "adc"; break; 723 case 2: mnem = "adc"; break;
724 case 3: mnem = "sbb"; break; 724 case 3: mnem = "sbb"; break;
725 case 4: mnem = "and"; break; 725 case 4: mnem = "and"; break;
726 case 5: mnem = "sub"; break; 726 case 5: mnem = "sub"; break;
727 case 6: mnem = "xor"; break; 727 case 6: mnem = "xor"; break;
728 case 7: mnem = "cmp"; break; 728 case 7: mnem = "cmp"; break;
729 default: UNIMPLEMENTED(); 729 default: UNIMPLEMENTED();
730 } 730 }
731 Print(mnem); 731 Print(mnem);
732 if (size_override) {
733 Print("_w");
734 } else if (sign_extension_bit) {
735 Print("_b");
736 }
732 Print(" "); 737 Print(" ");
733 int count = PrintRightOperand(data+1); 738 int count = PrintRightOperand(data+1);
734 if (sign_extension_bit) { 739 Print(",");
735 Print(","); 740 if (size_override) {
741 PrintHex(*reinterpret_cast<int16_t*>(data + 1 + count));
742 return 1 + count + 2 /*int16_t*/;
743 } else if (sign_extension_bit) {
736 PrintHex(*(data + 1 + count)); 744 PrintHex(*(data + 1 + count));
737 return 1 + count + 1 /*int8*/; 745 return 1 + count + 1 /*int8_t*/;
738 } else { 746 } else {
739 Print(",");
740 PrintHex(*reinterpret_cast<int32_t*>(data + 1 + count)); 747 PrintHex(*reinterpret_cast<int32_t*>(data + 1 + count));
741 return 1 + count + 4 /*int32_t*/; 748 return 1 + count + 4 /*int32_t*/;
742 } 749 }
743 } 750 }
744 751
745 752
746 int X86Decoder::DecodeEnter(uint8_t* data) { 753 int X86Decoder::DecodeEnter(uint8_t* data) {
747 uint16_t size = *reinterpret_cast<uint16_t*>(data + 1); 754 uint16_t size = *reinterpret_cast<uint16_t*>(data + 1);
748 uint8_t level = *reinterpret_cast<uint8_t*>(data + 3); 755 uint8_t level = *reinterpret_cast<uint8_t*>(data + 3);
749 Print("enter "); 756 Print("enter ");
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 Print("shufpd "); 1677 Print("shufpd ");
1671 PrintXmmRegister(regop); 1678 PrintXmmRegister(regop);
1672 Print(","); 1679 Print(",");
1673 data += PrintRightXmmOperand(data); 1680 data += PrintRightXmmOperand(data);
1674 int comparison = *data; 1681 int comparison = *data;
1675 Print(" ["); 1682 Print(" [");
1676 PrintHex(comparison); 1683 PrintHex(comparison);
1677 Print("]"); 1684 Print("]");
1678 data++; 1685 data++;
1679 } else { 1686 } else {
1680 UNIMPLEMENTED(); 1687 UNIMPLEMENTED();
1681 } 1688 }
1689 } else if (*data == 0x3B) {
1690 data++;
1691 Print("cmp_w ");
1692 int mod, regop, rm;
1693 GetModRm(*data, &mod, &regop, &rm);
1694 PrintCPURegister(regop);
1695 Print(",");
1696 data += PrintRightOperand(data);
1697 } else if ((*data == 0x81) || (*data == 0x83)) {
1698 data += PrintImmediateOp(data, true /* size_override */);
1699 } else if (*data == 0xC7) {
1700 data++;
1701 Print("mov_w ");
1702 data += PrintRightOperand(data);
1703 int16_t imm = *reinterpret_cast<int16_t*>(data);
1704 Print(",");
1705 PrintHex(imm);
1706 data += 2;
1682 } else if (*data == 0x90) { 1707 } else if (*data == 0x90) {
1683 data++; 1708 data++;
1684 Print("nop"); 1709 Print("nop");
1685 } else { 1710 } else {
1686 UNIMPLEMENTED(); 1711 UNIMPLEMENTED();
1687 } 1712 }
1688 break; 1713 break;
1689 1714
1690 case 0xFE: 1715 case 0xFE:
1691 { data++; 1716 { data++;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 } 1874 }
1850 hex_buffer[hex_index] = '\0'; 1875 hex_buffer[hex_index] = '\0';
1851 if (out_instr_len) { 1876 if (out_instr_len) {
1852 *out_instr_len = instruction_length; 1877 *out_instr_len = instruction_length;
1853 } 1878 }
1854 } 1879 }
1855 1880
1856 } // namespace dart 1881 } // namespace dart
1857 1882
1858 #endif // defined TARGET_ARCH_IA32 1883 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698