Changeset 84399 in webkit for trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
- Timestamp:
- Apr 20, 2011, 11:44:35 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
r84182 r84399 42 42 typedef X86Assembler::FPRegisterID FPRegisterID; 43 43 44 enum Condition {44 enum RelationalCondition { 45 45 Equal = X86Assembler::ConditionE, 46 46 NotEqual = X86Assembler::ConditionNE, … … 52 52 GreaterThanOrEqual = X86Assembler::ConditionGE, 53 53 LessThan = X86Assembler::ConditionL, 54 LessThanOrEqual = X86Assembler::ConditionLE, 54 LessThanOrEqual = X86Assembler::ConditionLE 55 }; 56 57 enum ResultCondition { 55 58 Overflow = X86Assembler::ConditionO, 56 59 Signed = X86Assembler::ConditionS, … … 795 798 796 799 public: 797 Jump branch8( Condition cond, Address left, TrustedImm32 right)800 Jump branch8(RelationalCondition cond, Address left, TrustedImm32 right) 798 801 { 799 802 m_assembler.cmpb_im(right.m_value, left.offset, left.base); … … 801 804 } 802 805 803 Jump branch32( Condition cond, RegisterID left, RegisterID right)806 Jump branch32(RelationalCondition cond, RegisterID left, RegisterID right) 804 807 { 805 808 m_assembler.cmpl_rr(right, left); … … 807 810 } 808 811 809 Jump branch32( Condition cond, RegisterID left, TrustedImm32 right)812 Jump branch32(RelationalCondition cond, RegisterID left, TrustedImm32 right) 810 813 { 811 814 if (((cond == Equal) || (cond == NotEqual)) && !right.m_value) … … 816 819 } 817 820 818 Jump branch32( Condition cond, RegisterID left, Address right)821 Jump branch32(RelationalCondition cond, RegisterID left, Address right) 819 822 { 820 823 m_assembler.cmpl_mr(right.offset, right.base, left); … … 822 825 } 823 826 824 Jump branch32( Condition cond, Address left, RegisterID right)827 Jump branch32(RelationalCondition cond, Address left, RegisterID right) 825 828 { 826 829 m_assembler.cmpl_rm(right, left.offset, left.base); … … 828 831 } 829 832 830 Jump branch32( Condition cond, Address left, TrustedImm32 right)833 Jump branch32(RelationalCondition cond, Address left, TrustedImm32 right) 831 834 { 832 835 m_assembler.cmpl_im(right.m_value, left.offset, left.base); … … 834 837 } 835 838 836 Jump branch32( Condition cond, BaseIndex left, TrustedImm32 right)839 Jump branch32(RelationalCondition cond, BaseIndex left, TrustedImm32 right) 837 840 { 838 841 m_assembler.cmpl_im(right.m_value, left.offset, left.base, left.index, left.scale); … … 840 843 } 841 844 842 Jump branch32WithUnalignedHalfWords( Condition cond, BaseIndex left, TrustedImm32 right)845 Jump branch32WithUnalignedHalfWords(RelationalCondition cond, BaseIndex left, TrustedImm32 right) 843 846 { 844 847 return branch32(cond, left, right); 845 848 } 846 849 847 Jump branch16( Condition cond, BaseIndex left, RegisterID right)850 Jump branch16(RelationalCondition cond, BaseIndex left, RegisterID right) 848 851 { 849 852 m_assembler.cmpw_rm(right, left.offset, left.base, left.index, left.scale); … … 851 854 } 852 855 853 Jump branch16( Condition cond, BaseIndex left, TrustedImm32 right)856 Jump branch16(RelationalCondition cond, BaseIndex left, TrustedImm32 right) 854 857 { 855 858 ASSERT(!(right.m_value & 0xFFFF0000)); … … 859 862 } 860 863 861 Jump branchTest32(Condition cond, RegisterID reg, RegisterID mask) 862 { 863 ASSERT((cond == Zero) || (cond == NonZero) || (cond == Signed)); 864 Jump branchTest32(ResultCondition cond, RegisterID reg, RegisterID mask) 865 { 864 866 m_assembler.testl_rr(reg, mask); 865 867 return Jump(m_assembler.jCC(x86Condition(cond))); 866 868 } 867 869 868 Jump branchTest32(Condition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1)) 869 { 870 ASSERT((cond == Zero) || (cond == NonZero) || (cond == Signed)); 870 Jump branchTest32(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1)) 871 { 871 872 // if we are only interested in the low seven bits, this can be tested with a testb 872 873 if (mask.m_value == -1) … … 879 880 } 880 881 881 Jump branchTest32(Condition cond, Address address, TrustedImm32 mask = TrustedImm32(-1)) 882 { 883 ASSERT((cond == Zero) || (cond == NonZero) || (cond == Signed)); 882 Jump branchTest32(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1)) 883 { 884 884 if (mask.m_value == -1) 885 885 m_assembler.cmpl_im(0, address.offset, address.base); … … 889 889 } 890 890 891 Jump branchTest32(Condition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1)) 892 { 893 ASSERT((cond == Zero) || (cond == NonZero) || (cond == Signed)); 891 Jump branchTest32(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1)) 892 { 894 893 if (mask.m_value == -1) 895 894 m_assembler.cmpl_im(0, address.offset, address.base, address.index, address.scale); … … 899 898 } 900 899 901 Jump branchTest8( Condition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1))900 Jump branchTest8(ResultCondition cond, RegisterID reg, TrustedImm32 mask = TrustedImm32(-1)) 902 901 { 903 902 // Byte in TrustedImm32 is not well defined, so be a little permisive here, but don't accept nonsense values. 904 903 ASSERT(mask.m_value >= -128 && mask.m_value <= 255); 905 ASSERT((cond == Zero) || (cond == NonZero) || (cond == Signed));906 904 if (mask.m_value == -1) 907 905 m_assembler.testb_rr(reg, reg); … … 911 909 } 912 910 913 Jump branchTest8( Condition cond, Address address, TrustedImm32 mask = TrustedImm32(-1))911 Jump branchTest8(ResultCondition cond, Address address, TrustedImm32 mask = TrustedImm32(-1)) 914 912 { 915 913 // Byte in TrustedImm32 is not well defined, so be a little permisive here, but don't accept nonsense values. 916 914 ASSERT(mask.m_value >= -128 && mask.m_value <= 255); 917 ASSERT((cond == Zero) || (cond == NonZero) || (cond == Signed));918 915 if (mask.m_value == -1) 919 916 m_assembler.cmpb_im(0, address.offset, address.base); … … 923 920 } 924 921 925 Jump branchTest8( Condition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1))922 Jump branchTest8(ResultCondition cond, BaseIndex address, TrustedImm32 mask = TrustedImm32(-1)) 926 923 { 927 924 // Byte in TrustedImm32 is not well defined, so be a little permisive here, but don't accept nonsense values. 928 925 ASSERT(mask.m_value >= -128 && mask.m_value <= 255); 929 ASSERT((cond == Zero) || (cond == NonZero) || (cond == Signed));930 926 if (mask.m_value == -1) 931 927 m_assembler.cmpb_im(0, address.offset, address.base, address.index, address.scale); … … 962 958 // operation caused an overflow to occur. 963 959 964 Jump branchAdd32(Condition cond, RegisterID src, RegisterID dest) 965 { 966 ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); 960 Jump branchAdd32(ResultCondition cond, RegisterID src, RegisterID dest) 961 { 967 962 add32(src, dest); 968 963 return Jump(m_assembler.jCC(x86Condition(cond))); 969 964 } 970 965 971 Jump branchAdd32(Condition cond, TrustedImm32 imm, RegisterID dest) 972 { 973 ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); 966 Jump branchAdd32(ResultCondition cond, TrustedImm32 imm, RegisterID dest) 967 { 974 968 add32(imm, dest); 975 969 return Jump(m_assembler.jCC(x86Condition(cond))); 976 970 } 977 971 978 Jump branchAdd32(Condition cond, TrustedImm32 src, Address dest) 979 { 980 ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); 972 Jump branchAdd32(ResultCondition cond, TrustedImm32 src, Address dest) 973 { 981 974 add32(src, dest); 982 975 return Jump(m_assembler.jCC(x86Condition(cond))); 983 976 } 984 977 985 Jump branchAdd32(Condition cond, RegisterID src, Address dest) 986 { 987 ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); 978 Jump branchAdd32(ResultCondition cond, RegisterID src, Address dest) 979 { 988 980 add32(src, dest); 989 981 return Jump(m_assembler.jCC(x86Condition(cond))); 990 982 } 991 983 992 Jump branchAdd32(Condition cond, Address src, RegisterID dest) 993 { 994 ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); 984 Jump branchAdd32(ResultCondition cond, Address src, RegisterID dest) 985 { 995 986 add32(src, dest); 996 987 return Jump(m_assembler.jCC(x86Condition(cond))); 997 988 } 998 989 999 Jump branchAdd32( Condition cond, RegisterID src1, RegisterID src2, RegisterID dest)990 Jump branchAdd32(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest) 1000 991 { 1001 992 if (src1 == dest) … … 1005 996 } 1006 997 1007 Jump branchAdd32( Condition cond, RegisterID src, TrustedImm32 imm, RegisterID dest)998 Jump branchAdd32(ResultCondition cond, RegisterID src, TrustedImm32 imm, RegisterID dest) 1008 999 { 1009 1000 move(src, dest); … … 1011 1002 } 1012 1003 1013 Jump branchMul32(Condition cond, RegisterID src, RegisterID dest) 1014 { 1015 ASSERT(cond == Overflow); 1004 Jump branchMul32(ResultCondition cond, RegisterID src, RegisterID dest) 1005 { 1016 1006 mul32(src, dest); 1017 return Jump(m_assembler.jCC(x86Condition(cond))); 1018 } 1019 1020 Jump branchMul32(Condition cond, Address src, RegisterID dest) 1021 { 1022 ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); 1007 if (cond != Overflow) 1008 m_assembler.testl_rr(dest, dest); 1009 return Jump(m_assembler.jCC(x86Condition(cond))); 1010 } 1011 1012 Jump branchMul32(ResultCondition cond, Address src, RegisterID dest) 1013 { 1023 1014 mul32(src, dest); 1024 return Jump(m_assembler.jCC(x86Condition(cond))); 1025 } 1026 1027 Jump branchMul32(Condition cond, TrustedImm32 imm, RegisterID src, RegisterID dest) 1028 { 1029 ASSERT(cond == Overflow); 1015 if (cond != Overflow) 1016 m_assembler.testl_rr(dest, dest); 1017 return Jump(m_assembler.jCC(x86Condition(cond))); 1018 } 1019 1020 Jump branchMul32(ResultCondition cond, TrustedImm32 imm, RegisterID src, RegisterID dest) 1021 { 1030 1022 mul32(imm, src, dest); 1031 return Jump(m_assembler.jCC(x86Condition(cond))); 1032 } 1033 1034 Jump branchMul32(Condition cond, RegisterID src1, RegisterID src2, RegisterID dest) 1023 if (cond != Overflow) 1024 m_assembler.testl_rr(dest, dest); 1025 return Jump(m_assembler.jCC(x86Condition(cond))); 1026 } 1027 1028 Jump branchMul32(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest) 1035 1029 { 1036 1030 if (src1 == dest) … … 1040 1034 } 1041 1035 1042 Jump branchSub32(Condition cond, RegisterID src, RegisterID dest) 1043 { 1044 ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); 1036 Jump branchSub32(ResultCondition cond, RegisterID src, RegisterID dest) 1037 { 1045 1038 sub32(src, dest); 1046 1039 return Jump(m_assembler.jCC(x86Condition(cond))); 1047 1040 } 1048 1041 1049 Jump branchSub32(Condition cond, TrustedImm32 imm, RegisterID dest) 1050 { 1051 ASSERT((cond == Overflow) || (cond == Signed) || (cond == Zero) || (cond == NonZero)); 1042 Jump branchSub32(ResultCondition cond, TrustedImm32 imm, RegisterID dest) 1043 { 1052 1044 sub32(imm, dest); 1053 1045 return Jump(m_assembler.jCC(x86Condition(cond))); 1054 1046 } 1055 1047 1056 Jump branchSub32(Condition cond, TrustedImm32 imm, Address dest) 1057 { 1058 ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); 1048 Jump branchSub32(ResultCondition cond, TrustedImm32 imm, Address dest) 1049 { 1059 1050 sub32(imm, dest); 1060 1051 return Jump(m_assembler.jCC(x86Condition(cond))); 1061 1052 } 1062 1053 1063 Jump branchSub32(Condition cond, RegisterID src, Address dest) 1064 { 1065 ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); 1054 Jump branchSub32(ResultCondition cond, RegisterID src, Address dest) 1055 { 1066 1056 sub32(src, dest); 1067 1057 return Jump(m_assembler.jCC(x86Condition(cond))); 1068 1058 } 1069 1059 1070 Jump branchSub32(Condition cond, Address src, RegisterID dest) 1071 { 1072 ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); 1060 Jump branchSub32(ResultCondition cond, Address src, RegisterID dest) 1061 { 1073 1062 sub32(src, dest); 1074 1063 return Jump(m_assembler.jCC(x86Condition(cond))); 1075 1064 } 1076 1065 1077 Jump branchSub32( Condition cond, RegisterID src1, RegisterID src2, RegisterID dest)1066 Jump branchSub32(ResultCondition cond, RegisterID src1, RegisterID src2, RegisterID dest) 1078 1067 { 1079 1068 // B := A - B is invalid. … … 1084 1073 } 1085 1074 1086 Jump branchSub32( Condition cond, RegisterID src1, TrustedImm32 src2, RegisterID dest)1075 Jump branchSub32(ResultCondition cond, RegisterID src1, TrustedImm32 src2, RegisterID dest) 1087 1076 { 1088 1077 move(src1, dest); … … 1090 1079 } 1091 1080 1092 Jump branchNeg32(Condition cond, RegisterID srcDest) 1093 { 1094 ASSERT((cond == Overflow) || (cond == Zero) || (cond == NonZero)); 1081 Jump branchNeg32(ResultCondition cond, RegisterID srcDest) 1082 { 1095 1083 neg32(srcDest); 1096 1084 return Jump(m_assembler.jCC(x86Condition(cond))); 1097 1085 } 1098 1086 1099 Jump branchOr32(Condition cond, RegisterID src, RegisterID dest) 1100 { 1101 ASSERT((cond == Signed) || (cond == Zero) || (cond == NonZero)); 1087 Jump branchOr32(ResultCondition cond, RegisterID src, RegisterID dest) 1088 { 1102 1089 or32(src, dest); 1103 1090 return Jump(m_assembler.jCC(x86Condition(cond))); … … 1132 1119 } 1133 1120 1134 void set8Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest) 1135 { 1136 m_assembler.cmpl_rr(right, left); 1137 m_assembler.setCC_r(x86Condition(cond), dest); 1138 } 1139 1140 void set8Compare32(Condition cond, Address left, RegisterID right, RegisterID dest) 1141 { 1142 m_assembler.cmpl_mr(left.offset, left.base, right); 1143 m_assembler.setCC_r(x86Condition(cond), dest); 1144 } 1145 1146 void set8Compare32(Condition cond, RegisterID left, TrustedImm32 right, RegisterID dest) 1147 { 1148 if (((cond == Equal) || (cond == NotEqual)) && !right.m_value) 1149 m_assembler.testl_rr(left, left); 1150 else 1151 m_assembler.cmpl_ir(right.m_value, left); 1152 m_assembler.setCC_r(x86Condition(cond), dest); 1153 } 1154 1155 void set32Compare32(Condition cond, RegisterID left, RegisterID right, RegisterID dest) 1121 void compare32(RelationalCondition cond, RegisterID left, RegisterID right, RegisterID dest) 1156 1122 { 1157 1123 m_assembler.cmpl_rr(right, left); … … 1160 1126 } 1161 1127 1162 void set32Compare32(Condition cond, RegisterID left, TrustedImm32 right, RegisterID dest)1128 void compare32(RelationalCondition cond, RegisterID left, TrustedImm32 right, RegisterID dest) 1163 1129 { 1164 1130 if (((cond == Equal) || (cond == NotEqual)) && !right.m_value) … … 1175 1141 // asm ops like test, or pseudo ops like pop(). 1176 1142 1177 void set32Test8(Condition cond, Address address, TrustedImm32 mask, RegisterID dest)1143 void test8(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest) 1178 1144 { 1179 1145 if (mask.m_value == -1) … … 1185 1151 } 1186 1152 1187 void set32Test32(Condition cond, Address address, TrustedImm32 mask, RegisterID dest)1153 void test32(ResultCondition cond, Address address, TrustedImm32 mask, RegisterID dest) 1188 1154 { 1189 1155 if (mask.m_value == -1) … … 1196 1162 1197 1163 protected: 1198 X86Assembler::Condition x86Condition(Condition cond) 1164 X86Assembler::Condition x86Condition(RelationalCondition cond) 1165 { 1166 return static_cast<X86Assembler::Condition>(cond); 1167 } 1168 1169 X86Assembler::Condition x86Condition(ResultCondition cond) 1199 1170 { 1200 1171 return static_cast<X86Assembler::Condition>(cond);
Note:
See TracChangeset
for help on using the changeset viewer.