Changeset 39342 in webkit for trunk/JavaScriptCore/assembler/X86Assembler.h
- Timestamp:
- Dec 16, 2008, 4:03:34 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/assembler/X86Assembler.h
r39319 r39342 111 111 OP_GROUP1A_Ev = 0x8F, 112 112 OP_CDQ = 0x99, 113 OP_MOV_EAXOv = 0xA1, 114 OP_MOV_OvEAX = 0xA3, 115 OP_MOV_EAXIv = 0xB8, 113 116 OP_GROUP2_EvIb = 0xC1, 114 117 OP_RET = 0xC3, … … 499 502 } 500 503 501 #if !PLATFORM(X86_64) 504 #if PLATFORM(X86_64) 505 void cmpq_rr(RegisterID src, RegisterID dst) 506 { 507 m_formatter.oneByteOp64(OP_CMP_EvGv, src, dst); 508 } 509 510 void cmpq_rm(RegisterID src, int offset, RegisterID base) 511 { 512 m_formatter.oneByteOp64(OP_CMP_EvGv, src, base, offset); 513 } 514 515 void cmpq_im(int imm, int offset, RegisterID base) 516 { 517 if (CAN_SIGN_EXTEND_8_32(imm)) { 518 m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, offset); 519 m_formatter.immediate8(imm); 520 } else { 521 m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, offset); 522 m_formatter.immediate32(imm); 523 } 524 } 525 526 void cmpq_im(int imm, int offset, RegisterID base, RegisterID index, int scale) 527 { 528 if (CAN_SIGN_EXTEND_8_32(imm)) { 529 m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_CMP, base, index, scale, offset); 530 m_formatter.immediate8(imm); 531 } else { 532 m_formatter.oneByteOp64(OP_GROUP1_EvIz, GROUP1_OP_CMP, base, index, scale, offset); 533 m_formatter.immediate32(imm); 534 } 535 } 536 #else 502 537 void cmpl_im(int imm, void* addr) 503 538 { … … 552 587 m_formatter.immediate32(imm); 553 588 } 589 590 void testq_i32m(int imm, int offset, RegisterID base) 591 { 592 m_formatter.oneByteOp64(OP_GROUP3_EvIz, GROUP3_OP_TEST, base, offset); 593 m_formatter.immediate32(imm); 594 } 595 596 void testq_i32m(int imm, int offset, RegisterID base, RegisterID index, int scale) 597 { 598 m_formatter.oneByteOp64(OP_GROUP3_EvIz, GROUP3_OP_TEST, base, index, scale, offset); 599 m_formatter.immediate32(imm); 600 } 554 601 #endif 555 602 … … 614 661 } 615 662 663 void movl_mEAX(void* addr) 664 { 665 m_formatter.oneByteOp(OP_MOV_EAXOv); 666 #if PLATFORM(X86_64) 667 m_formatter.immediate64(reinterpret_cast<int64_t>(addr)); 668 #else 669 m_formatter.immediate32(reinterpret_cast<int>(addr)); 670 #endif 671 } 672 616 673 void movl_mr(int offset, RegisterID base, RegisterID dst) 617 674 { … … 626 683 void movl_i32r(int imm, RegisterID dst) 627 684 { 628 m_formatter.oneByteOp(OP_ GROUP11_EvIz, GROUP11_MOV, dst);685 m_formatter.oneByteOp(OP_MOV_EAXIv, dst); 629 686 m_formatter.immediate32(imm); 630 687 } … … 636 693 } 637 694 695 void movl_EAXm(void* addr) 696 { 697 m_formatter.oneByteOp(OP_MOV_OvEAX); 698 #if PLATFORM(X86_64) 699 m_formatter.immediate64(reinterpret_cast<int64_t>(addr)); 700 #else 701 m_formatter.immediate32(reinterpret_cast<int>(addr)); 702 #endif 703 } 704 638 705 #if PLATFORM(X86_64) 639 706 void movq_rr(RegisterID src, RegisterID dst) … … 647 714 } 648 715 716 void movq_rm(RegisterID src, int offset, RegisterID base, RegisterID index, int scale) 717 { 718 m_formatter.oneByteOp64(OP_MOV_EvGv, src, base, index, scale, offset); 719 } 720 721 void movq_mEAX(void* addr) 722 { 723 m_formatter.oneByteOp64(OP_MOV_EAXOv); 724 m_formatter.immediate64(reinterpret_cast<int64_t>(addr)); 725 } 726 649 727 void movq_mr(int offset, RegisterID base, RegisterID dst) 650 728 { 651 729 m_formatter.oneByteOp64(OP_MOV_GvEv, dst, base, offset); 730 } 731 732 void movq_mr(int offset, RegisterID base, RegisterID index, int scale, RegisterID dst) 733 { 734 m_formatter.oneByteOp64(OP_MOV_GvEv, dst, base, index, scale, offset); 735 } 736 737 void movq_i64r(int64_t imm, RegisterID dst) 738 { 739 m_formatter.oneByteOp64(OP_MOV_EAXIv, dst); 740 m_formatter.immediate64(imm); 652 741 } 653 742 #else 654 743 void movl_mr(void* addr, RegisterID dst) 655 744 { 656 m_formatter.oneByteOp(OP_MOV_GvEv, dst, addr); 745 if (dst == X86::eax) 746 movl_mEAX(addr); 747 else 748 m_formatter.oneByteOp(OP_MOV_GvEv, dst, addr); 657 749 } 658 750 … … 1103 1195 // When planting d64 or f64 instructions, not requiring a REX.w prefix, 1104 1196 // the normal (non-'64'-postfixed) formatters should be used. 1197 1198 void oneByteOp64(OneByteOpcodeID opcode) 1199 { 1200 m_buffer.ensureSpace(maxInstructionSize); 1201 emitRexW(0, 0, 0); 1202 m_buffer.putByteUnchecked(opcode); 1203 } 1204 1205 void oneByteOp64(OneByteOpcodeID opcode, RegisterID reg) 1206 { 1207 m_buffer.ensureSpace(maxInstructionSize); 1208 emitRexW(reg, 0, 0); 1209 m_buffer.putByteUnchecked(opcode + reg); 1210 } 1105 1211 1106 1212 void oneByteOp64(OneByteOpcodeID opcode, int reg, RegisterID rm) … … 1195 1301 } 1196 1302 1303 void immediate64(int64_t imm) 1304 { 1305 m_buffer.putInt64Unchecked(imm); 1306 } 1307 1197 1308 JmpSrc immediateRel32() 1198 1309 {
Note:
See TracChangeset
for help on using the changeset viewer.