OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 // Label L; // unbound label | 680 // Label L; // unbound label |
681 // j(cc, &L); // forward branch to unbound label | 681 // j(cc, &L); // forward branch to unbound label |
682 // bind(&L); // bind label to the current pc | 682 // bind(&L); // bind label to the current pc |
683 // j(cc, &L); // backward branch to bound label | 683 // j(cc, &L); // backward branch to bound label |
684 // bind(&L); // illegal: a label may be bound only once | 684 // bind(&L); // illegal: a label may be bound only once |
685 // | 685 // |
686 // Note: The same Label can be used for forward and backward branches | 686 // Note: The same Label can be used for forward and backward branches |
687 // but it may be bound only once. | 687 // but it may be bound only once. |
688 | 688 |
689 void bind(Label* L); // binds an unbound label L to the current code position | 689 void bind(Label* L); // binds an unbound label L to the current code position |
| 690 void bind(NearLabel* L); |
690 | 691 |
691 // Calls | 692 // Calls |
692 void call(Label* L); | 693 void call(Label* L); |
693 void call(byte* entry, RelocInfo::Mode rmode); | 694 void call(byte* entry, RelocInfo::Mode rmode); |
694 void call(const Operand& adr); | 695 void call(const Operand& adr); |
695 void call(const ExternalReference& target); | 696 void call(const ExternalReference& target); |
696 void call(Handle<Code> code, RelocInfo::Mode rmode); | 697 void call(Handle<Code> code, RelocInfo::Mode rmode); |
697 | 698 |
698 // Jumps | 699 // Jumps |
699 void jmp(Label* L); // unconditional jump to L | 700 void jmp(Label* L); // unconditional jump to L |
700 void jmp(byte* entry, RelocInfo::Mode rmode); | 701 void jmp(byte* entry, RelocInfo::Mode rmode); |
701 void jmp(const Operand& adr); | 702 void jmp(const Operand& adr); |
702 void jmp(Handle<Code> code, RelocInfo::Mode rmode); | 703 void jmp(Handle<Code> code, RelocInfo::Mode rmode); |
703 | 704 |
| 705 // Short jump |
| 706 void jmp(NearLabel* L); |
| 707 |
704 // Conditional jumps | 708 // Conditional jumps |
705 void j(Condition cc, Label* L, Hint hint = no_hint); | 709 void j(Condition cc, Label* L, Hint hint = no_hint); |
706 void j(Condition cc, byte* entry, RelocInfo::Mode rmode, Hint hint = no_hint); | 710 void j(Condition cc, byte* entry, RelocInfo::Mode rmode, Hint hint = no_hint); |
707 void j(Condition cc, Handle<Code> code, Hint hint = no_hint); | 711 void j(Condition cc, Handle<Code> code, Hint hint = no_hint); |
708 | 712 |
| 713 // Conditional short jump |
| 714 void j(Condition cc, NearLabel* L, Hint hint = no_hint); |
| 715 |
709 // Floating-point operations | 716 // Floating-point operations |
710 void fld(int i); | 717 void fld(int i); |
711 void fstp(int i); | 718 void fstp(int i); |
712 | 719 |
713 void fld1(); | 720 void fld1(); |
714 void fldz(); | 721 void fldz(); |
715 void fldpi(); | 722 void fldpi(); |
716 | 723 |
717 void fld_s(const Operand& adr); | 724 void fld_s(const Operand& adr); |
718 void fld_d(const Operand& adr); | 725 void fld_d(const Operand& adr); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 void movsd(XMMRegister dst, const Operand& src); | 868 void movsd(XMMRegister dst, const Operand& src); |
862 void movsd(const Operand& dst, XMMRegister src); | 869 void movsd(const Operand& dst, XMMRegister src); |
863 | 870 |
864 void emit_sse_operand(XMMRegister reg, const Operand& adr); | 871 void emit_sse_operand(XMMRegister reg, const Operand& adr); |
865 void emit_sse_operand(XMMRegister dst, XMMRegister src); | 872 void emit_sse_operand(XMMRegister dst, XMMRegister src); |
866 void emit_sse_operand(Register dst, XMMRegister src); | 873 void emit_sse_operand(Register dst, XMMRegister src); |
867 | 874 |
868 private: | 875 private: |
869 byte* addr_at(int pos) { return buffer_ + pos; } | 876 byte* addr_at(int pos) { return buffer_ + pos; } |
870 byte byte_at(int pos) { return buffer_[pos]; } | 877 byte byte_at(int pos) { return buffer_[pos]; } |
| 878 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } |
871 uint32_t long_at(int pos) { | 879 uint32_t long_at(int pos) { |
872 return *reinterpret_cast<uint32_t*>(addr_at(pos)); | 880 return *reinterpret_cast<uint32_t*>(addr_at(pos)); |
873 } | 881 } |
874 void long_at_put(int pos, uint32_t x) { | 882 void long_at_put(int pos, uint32_t x) { |
875 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; | 883 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; |
876 } | 884 } |
877 | 885 |
878 // code emission | 886 // code emission |
879 void GrowBuffer(); | 887 void GrowBuffer(); |
880 inline void emit(uint32_t x); | 888 inline void emit(uint32_t x); |
(...skipping 14 matching lines...) Expand all Loading... |
895 // sel specifies the /n in the modrm byte (see the Intel PRM). | 903 // sel specifies the /n in the modrm byte (see the Intel PRM). |
896 void emit_arith(int sel, Operand dst, const Immediate& x); | 904 void emit_arith(int sel, Operand dst, const Immediate& x); |
897 | 905 |
898 void emit_operand(Register reg, const Operand& adr); | 906 void emit_operand(Register reg, const Operand& adr); |
899 | 907 |
900 void emit_farith(int b1, int b2, int i); | 908 void emit_farith(int b1, int b2, int i); |
901 | 909 |
902 // labels | 910 // labels |
903 void print(Label* L); | 911 void print(Label* L); |
904 void bind_to(Label* L, int pos); | 912 void bind_to(Label* L, int pos); |
905 void link_to(Label* L, Label* appendix); | |
906 | 913 |
907 // displacements | 914 // displacements |
908 inline Displacement disp_at(Label* L); | 915 inline Displacement disp_at(Label* L); |
909 inline void disp_at_put(Label* L, Displacement disp); | 916 inline void disp_at_put(Label* L, Displacement disp); |
910 inline void emit_disp(Label* L, Displacement::Type type); | 917 inline void emit_disp(Label* L, Displacement::Type type); |
911 | 918 |
912 // record reloc info for current pc_ | 919 // record reloc info for current pc_ |
913 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); | 920 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
914 | 921 |
915 friend class CodePatcher; | 922 friend class CodePatcher; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 private: | 969 private: |
963 Assembler* assembler_; | 970 Assembler* assembler_; |
964 #ifdef DEBUG | 971 #ifdef DEBUG |
965 int space_before_; | 972 int space_before_; |
966 #endif | 973 #endif |
967 }; | 974 }; |
968 | 975 |
969 } } // namespace v8::internal | 976 } } // namespace v8::internal |
970 | 977 |
971 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 978 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |