OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/globals.h" // Needed here to get TARGET_ARCH_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
7 | 7 |
8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 | 890 |
891 void Intrinsifier::Bigint_setDigits(Assembler* assembler) { | 891 void Intrinsifier::Bigint_setDigits(Assembler* assembler) { |
892 __ lw(T0, Address(SP, 0 * kWordSize)); | 892 __ lw(T0, Address(SP, 0 * kWordSize)); |
893 __ lw(T1, Address(SP, 1 * kWordSize)); | 893 __ lw(T1, Address(SP, 1 * kWordSize)); |
894 __ StoreIntoObject(T1, FieldAddress(T1, Bigint::digits_offset()), T0, false); | 894 __ StoreIntoObject(T1, FieldAddress(T1, Bigint::digits_offset()), T0, false); |
895 __ Ret(); | 895 __ Ret(); |
896 } | 896 } |
897 | 897 |
898 | 898 |
899 void Intrinsifier::Bigint_absAdd(Assembler* assembler) { | 899 void Intrinsifier::Bigint_absAdd(Assembler* assembler) { |
900 // TODO(regis): Implement. | 900 // static void _absAdd(Uint32List digits, int used, |
| 901 // Uint32List a_digits, int a_used, |
| 902 // Uint32List r_digits) |
| 903 |
| 904 // T2 = used, T3 = digits |
| 905 __ lw(T2, Address(SP, 3 * kWordSize)); |
| 906 __ lw(T3, Address(SP, 4 * kWordSize)); |
| 907 // T3 = &digits[0] |
| 908 __ addiu(T3, T3, Immediate(TypedData::data_offset() - kHeapObjectTag)); |
| 909 |
| 910 // T4 = a_used, T5 = a_digits |
| 911 __ lw(T4, Address(SP, 1 * kWordSize)); |
| 912 __ lw(T5, Address(SP, 2 * kWordSize)); |
| 913 // T5 = &a_digits[0] |
| 914 __ addiu(T5, T5, Immediate(TypedData::data_offset() - kHeapObjectTag)); |
| 915 |
| 916 // T6 = r_digits |
| 917 __ lw(T6, Address(SP, 0 * kWordSize)); |
| 918 // T6 = &r_digits[0] |
| 919 __ addiu(T6, T6, Immediate(TypedData::data_offset() - kHeapObjectTag)); |
| 920 |
| 921 // V0 = &digits[a_used >> 1], a_used is Smi. |
| 922 __ sll(V0, T4, 1); |
| 923 __ addu(V0, V0, T3); |
| 924 |
| 925 // V1 = &digits[used >> 1], used is Smi. |
| 926 __ sll(V1, T2, 1); |
| 927 __ addu(V1, V1, T3); |
| 928 |
| 929 // T2 = carry in = 0. |
| 930 __ mov(T2, ZR); |
| 931 Label add_loop; |
| 932 __ Bind(&add_loop); |
| 933 // Loop a_used times, a_used > 0. |
| 934 __ lw(T0, Address(T3, 0)); // T0 = x. |
| 935 __ addiu(T3, T3, Immediate(Bigint::kBytesPerDigit)); |
| 936 __ lw(T1, Address(T5, 0)); // T1 = y. |
| 937 __ addiu(T5, T5, Immediate(Bigint::kBytesPerDigit)); |
| 938 __ addu(T1, T0, T1); // T1 = x + y. |
| 939 __ sltu(T4, T1, T0); // T4 = carry out of x + y. |
| 940 __ addu(T0, T1, T2); // T0 = x + y + carry in. |
| 941 __ sltu(T2, T0, T1); // T2 = carry out of (x + y) + carry in. |
| 942 __ or_(T2, T2, T4); // T2 = carry out of x + y + carry in. |
| 943 __ sw(T0, Address(T6, 0)); |
| 944 __ bne(T3, V0, &add_loop); |
| 945 __ delay_slot()->addiu(T6, T6, Immediate(Bigint::kBytesPerDigit)); |
| 946 |
| 947 Label last_carry; |
| 948 __ beq(T3, V1, &last_carry); |
| 949 |
| 950 Label carry_loop; |
| 951 __ Bind(&carry_loop); |
| 952 // Loop used - a_used times, used - a_used > 0. |
| 953 __ lw(T0, Address(T3, 0)); // T0 = x. |
| 954 __ addiu(T3, T3, Immediate(Bigint::kBytesPerDigit)); |
| 955 __ addu(T1, T0, T2); // T1 = x + carry in. |
| 956 __ sltu(T2, T1, T0); // T2 = carry out of x + carry in. |
| 957 __ sw(T1, Address(T6, 0)); |
| 958 __ bne(T3, V1, &carry_loop); |
| 959 __ delay_slot()->addiu(T6, T6, Immediate(Bigint::kBytesPerDigit)); |
| 960 |
| 961 __ Bind(&last_carry); |
| 962 __ sw(T2, Address(T6, 0)); |
| 963 |
| 964 // Returning Object::null() is not required, since this method is private. |
| 965 __ Ret(); |
901 } | 966 } |
902 | 967 |
903 | 968 |
904 void Intrinsifier::Bigint_absSub(Assembler* assembler) { | 969 void Intrinsifier::Bigint_absSub(Assembler* assembler) { |
905 // TODO(regis): Implement. | 970 // static void _absSub(Uint32List digits, int used, |
| 971 // Uint32List a_digits, int a_used, |
| 972 // Uint32List r_digits) |
| 973 |
| 974 // T2 = used, T3 = digits |
| 975 __ lw(T2, Address(SP, 3 * kWordSize)); |
| 976 __ lw(T3, Address(SP, 4 * kWordSize)); |
| 977 // T3 = &digits[0] |
| 978 __ addiu(T3, T3, Immediate(TypedData::data_offset() - kHeapObjectTag)); |
| 979 |
| 980 // T4 = a_used, T5 = a_digits |
| 981 __ lw(T4, Address(SP, 1 * kWordSize)); |
| 982 __ lw(T5, Address(SP, 2 * kWordSize)); |
| 983 // T5 = &a_digits[0] |
| 984 __ addiu(T5, T5, Immediate(TypedData::data_offset() - kHeapObjectTag)); |
| 985 |
| 986 // T6 = r_digits |
| 987 __ lw(T6, Address(SP, 0 * kWordSize)); |
| 988 // T6 = &r_digits[0] |
| 989 __ addiu(T6, T6, Immediate(TypedData::data_offset() - kHeapObjectTag)); |
| 990 |
| 991 // V0 = &digits[a_used >> 1], a_used is Smi. |
| 992 __ sll(V0, T4, 1); |
| 993 __ addu(V0, V0, T3); |
| 994 |
| 995 // V1 = &digits[used >> 1], used is Smi. |
| 996 __ sll(V1, T2, 1); |
| 997 __ addu(V1, V1, T3); |
| 998 |
| 999 // T2 = borrow in = 0. |
| 1000 __ mov(T2, ZR); |
| 1001 Label sub_loop; |
| 1002 __ Bind(&sub_loop); |
| 1003 // Loop a_used times, a_used > 0. |
| 1004 __ lw(T0, Address(T3, 0)); // T0 = x. |
| 1005 __ addiu(T3, T3, Immediate(Bigint::kBytesPerDigit)); |
| 1006 __ lw(T1, Address(T5, 0)); // T1 = y. |
| 1007 __ addiu(T5, T5, Immediate(Bigint::kBytesPerDigit)); |
| 1008 __ subu(T1, T0, T1); // T1 = x - y. |
| 1009 __ sltu(T4, T0, T1); // T4 = borrow out of x - y. |
| 1010 __ subu(T0, T1, T2); // T0 = x - y - borrow in. |
| 1011 __ sltu(T2, T1, T0); // T2 = borrow out of (x - y) - borrow in. |
| 1012 __ or_(T2, T2, T4); // T2 = borrow out of x - y - borrow in. |
| 1013 __ sw(T0, Address(T6, 0)); |
| 1014 __ bne(T3, V0, &sub_loop); |
| 1015 __ delay_slot()->addiu(T6, T6, Immediate(Bigint::kBytesPerDigit)); |
| 1016 |
| 1017 Label done; |
| 1018 __ beq(T3, V1, &done); |
| 1019 |
| 1020 Label borrow_loop; |
| 1021 __ Bind(&borrow_loop); |
| 1022 // Loop used - a_used times, used - a_used > 0. |
| 1023 __ lw(T0, Address(T3, 0)); // T0 = x. |
| 1024 __ addiu(T3, T3, Immediate(Bigint::kBytesPerDigit)); |
| 1025 __ subu(T1, T0, T2); // T1 = x - borrow in. |
| 1026 __ sltu(T2, T0, T1); // T2 = borrow out of x - borrow in. |
| 1027 __ sw(T1, Address(T6, 0)); |
| 1028 __ bne(T3, V1, &borrow_loop); |
| 1029 __ delay_slot()->addiu(T6, T6, Immediate(Bigint::kBytesPerDigit)); |
| 1030 |
| 1031 __ Bind(&done); |
| 1032 // Returning Object::null() is not required, since this method is private. |
| 1033 __ Ret(); |
906 } | 1034 } |
907 | 1035 |
908 | 1036 |
909 void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { | 1037 void Intrinsifier::Bigint_mulAdd(Assembler* assembler) { |
910 // TODO(regis): Implement. | 1038 // Pseudo code: |
| 1039 // static void _mulAdd(Uint32List x_digits, int xi, |
| 1040 // Uint32List m_digits, int i, |
| 1041 // Uint32List a_digits, int j, int n) { |
| 1042 // uint32_t x = x_digits[xi >> 1]; // xi is Smi. |
| 1043 // if (x == 0 || n == 0) { |
| 1044 // return; |
| 1045 // } |
| 1046 // uint32_t* mip = &m_digits[i >> 1]; // i is Smi. |
| 1047 // uint32_t* ajp = &a_digits[j >> 1]; // j is Smi. |
| 1048 // uint32_t c = 0; |
| 1049 // SmiUntag(n); |
| 1050 // do { |
| 1051 // uint32_t mi = *mip++; |
| 1052 // uint32_t aj = *ajp; |
| 1053 // uint64_t t = x*mi + aj + c; // 32-bit * 32-bit -> 64-bit. |
| 1054 // *ajp++ = low32(t); |
| 1055 // c = high32(t); |
| 1056 // } while (--n > 0); |
| 1057 // while (c != 0) { |
| 1058 // uint64_t t = *ajp + c; |
| 1059 // *ajp++ = low32(t); |
| 1060 // c = high32(t); // c == 0 or 1. |
| 1061 // } |
| 1062 // } |
| 1063 |
| 1064 Label done; |
| 1065 // T3 = x, no_op if x == 0 |
| 1066 __ lw(T0, Address(SP, 5 * kWordSize)); // T0 = xi as Smi. |
| 1067 __ lw(T1, Address(SP, 6 * kWordSize)); // T1 = x_digits. |
| 1068 __ sll(T0, T0, 1); |
| 1069 __ addu(T1, T0, T1); |
| 1070 __ lw(T3, FieldAddress(T1, TypedData::data_offset())); |
| 1071 __ beq(T3, ZR, &done); |
| 1072 |
| 1073 // T6 = SmiUntag(n), no_op if n == 0 |
| 1074 __ lw(T6, Address(SP, 0 * kWordSize)); |
| 1075 __ SmiUntag(T6); |
| 1076 __ beq(T6, ZR, &done); |
| 1077 __ delay_slot()->addiu(T6, T6, Immediate(-1)); // ... while (n-- > 0). |
| 1078 |
| 1079 // T4 = mip = &m_digits[i >> 1] |
| 1080 __ lw(T0, Address(SP, 3 * kWordSize)); // T0 = i as Smi. |
| 1081 __ lw(T1, Address(SP, 4 * kWordSize)); // T1 = m_digits. |
| 1082 __ sll(T0, T0, 1); |
| 1083 __ addu(T1, T0, T1); |
| 1084 __ addiu(T4, T1, Immediate(TypedData::data_offset() - kHeapObjectTag)); |
| 1085 |
| 1086 // T5 = ajp = &a_digits[j >> 1] |
| 1087 __ lw(T0, Address(SP, 1 * kWordSize)); // T0 = j as Smi. |
| 1088 __ lw(T1, Address(SP, 2 * kWordSize)); // T1 = a_digits. |
| 1089 __ sll(T0, T0, 1); |
| 1090 __ addu(T1, T0, T1); |
| 1091 __ addiu(T5, T1, Immediate(TypedData::data_offset() - kHeapObjectTag)); |
| 1092 |
| 1093 // T1 = c = 0 |
| 1094 __ mov(T1, ZR); |
| 1095 |
| 1096 Label muladd_loop; |
| 1097 __ Bind(&muladd_loop); |
| 1098 // x: T3 |
| 1099 // mip: T4 |
| 1100 // ajp: T5 |
| 1101 // c: T1 |
| 1102 // n-1: T6 |
| 1103 |
| 1104 // uint32_t mi = *mip++ |
| 1105 __ lw(T2, Address(T4, 0)); |
| 1106 |
| 1107 // uint32_t aj = *ajp |
| 1108 __ lw(T0, Address(T5, 0)); |
| 1109 |
| 1110 // uint64_t t = x*mi + aj + c |
| 1111 __ multu(T2, T3); // HI:LO = x*mi. |
| 1112 __ addiu(T4, T4, Immediate(Bigint::kBytesPerDigit)); |
| 1113 __ mflo(V0); |
| 1114 __ mfhi(V1); |
| 1115 __ addu(V0, V0, T0); // V0 = low32(x*mi) + aj. |
| 1116 __ sltu(T7, V0, T0); // T7 = carry out of low32(x*mi) + aj. |
| 1117 __ addu(V1, V1, T7); // V1:V0 = x*mi + aj. |
| 1118 __ addu(T0, V0, T1); // T0 = low32(x*mi + aj) + c. |
| 1119 __ sltu(T7, T0, T1); // T7 = carry out of low32(x*mi + aj) + c. |
| 1120 __ addu(T1, V1, T7); // T1 = c = high32(x*mi + aj + c). |
| 1121 |
| 1122 // *ajp++ = low32(t) = T0 |
| 1123 __ sw(T0, Address(T5, 0)); |
| 1124 __ addiu(T5, T5, Immediate(Bigint::kBytesPerDigit)); |
| 1125 |
| 1126 // while (n-- > 0) |
| 1127 __ bgtz(T6, &muladd_loop); |
| 1128 __ delay_slot()->addiu(T6, T6, Immediate(-1)); // --n |
| 1129 |
| 1130 __ beq(T1, ZR, &done); |
| 1131 |
| 1132 // *ajp++ += c |
| 1133 __ lw(T0, Address(T5, 0)); |
| 1134 __ addu(T0, T0, T1); |
| 1135 __ sltu(T1, T0, T1); |
| 1136 __ sw(T0, Address(T5, 0)); |
| 1137 __ beq(T1, ZR, &done); |
| 1138 __ delay_slot()->addiu(T5, T5, Immediate(Bigint::kBytesPerDigit)); |
| 1139 |
| 1140 Label propagate_carry_loop; |
| 1141 __ Bind(&propagate_carry_loop); |
| 1142 __ lw(T0, Address(T5, 0)); |
| 1143 __ addiu(T0, T0, Immediate(1)); |
| 1144 __ sw(T0, Address(T5, 0)); |
| 1145 __ beq(T0, ZR, &propagate_carry_loop); |
| 1146 __ delay_slot()->addiu(T5, T5, Immediate(Bigint::kBytesPerDigit)); |
| 1147 |
| 1148 __ Bind(&done); |
| 1149 // Returning Object::null() is not required, since this method is private. |
| 1150 __ Ret(); |
911 } | 1151 } |
912 | 1152 |
913 | 1153 |
914 void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { | 1154 void Intrinsifier::Bigint_sqrAdd(Assembler* assembler) { |
915 // TODO(regis): Implement. | 1155 // Pseudo code: |
| 1156 // static void _sqrAdd(Uint32List x_digits, int i, |
| 1157 // Uint32List a_digits, int used) { |
| 1158 // uint32_t* xip = &x_digits[i >> 1]; // i is Smi. |
| 1159 // uint32_t x = *xip++; |
| 1160 // if (x == 0) return; |
| 1161 // uint32_t* ajp = &a_digits[i]; // j == 2*i, i is Smi. |
| 1162 // uint32_t aj = *ajp; |
| 1163 // uint64_t t = x*x + aj; |
| 1164 // *ajp++ = low32(t); |
| 1165 // uint64_t c = high32(t); |
| 1166 // int n = ((used - i) >> 1) - 1; // used and i are Smi. |
| 1167 // while (--n >= 0) { |
| 1168 // uint32_t xi = *xip++; |
| 1169 // uint32_t aj = *ajp; |
| 1170 // uint96_t t = 2*x*xi + aj + c; // 2-bit * 32-bit * 32-bit -> 65-bit. |
| 1171 // *ajp++ = low32(t); |
| 1172 // c = high64(t); // 33-bit. |
| 1173 // } |
| 1174 // uint32_t aj = *ajp; |
| 1175 // uint64_t t = aj + c; // 32-bit + 33-bit -> 34-bit. |
| 1176 // *ajp++ = low32(t); |
| 1177 // *ajp = high32(t); |
| 1178 // } |
| 1179 |
| 1180 // T4 = xip = &x_digits[i >> 1] |
| 1181 __ lw(T2, Address(SP, 2 * kWordSize)); // T2 = i as Smi. |
| 1182 __ lw(T3, Address(SP, 3 * kWordSize)); // T3 = x_digits. |
| 1183 __ sll(T0, T2, 1); |
| 1184 __ addu(T3, T0, T3); |
| 1185 __ addiu(T4, T3, Immediate(TypedData::data_offset() - kHeapObjectTag)); |
| 1186 |
| 1187 // T3 = x = *xip++, return if x == 0 |
| 1188 Label x_zero; |
| 1189 __ lw(T3, Address(T4, 0)); |
| 1190 __ beq(T3, ZR, &x_zero); |
| 1191 __ delay_slot()->addiu(T4, T4, Immediate(Bigint::kBytesPerDigit)); |
| 1192 |
| 1193 // T5 = ajp = &a_digits[i] |
| 1194 __ lw(T1, Address(SP, 1 * kWordSize)); // a_digits |
| 1195 __ sll(T0, T2, 2); // j == 2*i, i is Smi. |
| 1196 __ addu(T1, T0, T1); |
| 1197 __ addiu(T5, T1, Immediate(TypedData::data_offset() - kHeapObjectTag)); |
| 1198 |
| 1199 // T6:T0 = t = x*x + *ajp |
| 1200 __ lw(T0, Address(T5, 0)); // *ajp. |
| 1201 __ mthi(ZR); |
| 1202 __ mtlo(T0); |
| 1203 __ maddu(T3, T3); // HI:LO = T3*T3 + *ajp. |
| 1204 __ mfhi(T6); |
| 1205 __ mflo(T0); |
| 1206 |
| 1207 // *ajp++ = low32(t) = R0 |
| 1208 __ sw(T0, Address(T5, 0)); |
| 1209 __ addiu(T5, T5, Immediate(Bigint::kBytesPerDigit)); |
| 1210 |
| 1211 // T6 = low32(c) = high32(t) |
| 1212 // T7 = high32(c) = 0 |
| 1213 __ mov(T7, ZR); |
| 1214 |
| 1215 // int n = used - i - 1; while (--n >= 0) ... |
| 1216 __ lw(T0, Address(SP, 0 * kWordSize)); // used is Smi |
| 1217 __ subu(V0, T0, T2); |
| 1218 __ SmiUntag(V0); // V0 = used - i |
| 1219 // int n = used - i - 2; if (n >= 0) ... while (n-- > 0) |
| 1220 __ addiu(V0, V0, Immediate(-2)); |
| 1221 |
| 1222 Label loop, done; |
| 1223 __ bltz(V0, &done); |
| 1224 |
| 1225 __ Bind(&loop); |
| 1226 // x: T3 |
| 1227 // xip: T4 |
| 1228 // ajp: T5 |
| 1229 // c: T7:T6 |
| 1230 // t: A2:A1:A0 (not live at loop entry) |
| 1231 // n: V0 |
| 1232 |
| 1233 // uint32_t xi = *xip++ |
| 1234 __ lw(T2, Address(T4, 0)); |
| 1235 __ addiu(T4, T4, Immediate(Bigint::kBytesPerDigit)); |
| 1236 |
| 1237 // uint32_t aj = *ajp |
| 1238 __ lw(T0, Address(T5, 0)); |
| 1239 |
| 1240 // uint96_t t = T7:T6:T0 = 2*x*xi + aj + c |
| 1241 __ multu(T2, T3); |
| 1242 __ mfhi(A1); |
| 1243 __ mflo(A0); // A1:A0 = x*xi. |
| 1244 __ srl(A2, A1, 31); |
| 1245 __ sll(A1, A1, 1); |
| 1246 __ srl(T1, A0, 31); |
| 1247 __ or_(A1, A1, T1); |
| 1248 __ sll(A0, A0, 1); // A2:A1:A0 = 2*x*xi. |
| 1249 __ addu(A0, A0, T0); |
| 1250 __ sltu(T1, A0, T0); |
| 1251 __ addu(A1, A1, T1); // No carry out possible; A2:A1:A0 = 2*x*xi + aj. |
| 1252 __ addu(T0, A0, T6); |
| 1253 __ sltu(T1, T0, T6); |
| 1254 __ addu(T6, A1, T1); // No carry out; A2:T6:T0 = 2*x*xi + aj + low32(c). |
| 1255 __ addu(T6, T6, T7); // No carry out; A2:T6:T0 = 2*x*xi + aj + c. |
| 1256 __ mov(T7, A2); // T7:T6:T0 = 2*x*xi + aj + c. |
| 1257 |
| 1258 // *ajp++ = low32(t) = T0 |
| 1259 __ sw(T0, Address(T5, 0)); |
| 1260 __ addiu(T5, T5, Immediate(Bigint::kBytesPerDigit)); |
| 1261 |
| 1262 // while (n-- > 0) |
| 1263 __ bgtz(V0, &loop); |
| 1264 __ delay_slot()->addiu(V0, V0, Immediate(-1)); // --n |
| 1265 |
| 1266 __ Bind(&done); |
| 1267 // uint32_t aj = *ajp |
| 1268 __ lw(T0, Address(T5, 0)); |
| 1269 |
| 1270 // uint64_t t = aj + c |
| 1271 __ addu(T6, T6, T0); |
| 1272 __ sltu(T1, T6, T0); |
| 1273 __ addu(T7, T7, T1); |
| 1274 |
| 1275 // *ajp = low32(t) = T6 |
| 1276 // *(ajp + 1) = high32(t) = T7 |
| 1277 __ sw(T6, Address(T5, 0)); |
| 1278 __ sw(T7, Address(T5, Bigint::kBytesPerDigit)); |
| 1279 |
| 1280 __ Bind(&x_zero); |
| 1281 // Returning Object::null() is not required, since this method is private. |
| 1282 __ Ret(); |
916 } | 1283 } |
917 | 1284 |
918 | 1285 |
919 void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { | 1286 void Intrinsifier::Bigint_estQuotientDigit(Assembler* assembler) { |
920 // TODO(regis): Implement. | 1287 // No unsigned 64-bit / 32-bit divide instruction. |
921 } | 1288 } |
922 | 1289 |
923 | 1290 |
924 void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { | 1291 void Intrinsifier::Montgomery_mulMod(Assembler* assembler) { |
925 // TODO(regis): Implement. | 1292 // Pseudo code: |
926 } | 1293 // static void _mulMod(Uint32List args, Uint32List digits, int i) { |
927 | 1294 // uint32_t rho = args[_RHO]; // _RHO == 0. |
928 | 1295 // uint32_t d = digits[i >> 1]; // i is Smi. |
| 1296 // uint64_t t = rho*d; |
| 1297 // args[_MU] = t mod DIGIT_BASE; // _MU == 1. |
| 1298 // } |
| 1299 |
| 1300 // T4 = args |
| 1301 __ lw(T4, Address(SP, 2 * kWordSize)); // args |
| 1302 |
| 1303 // T3 = rho = args[0] |
| 1304 __ lw(T3, FieldAddress(T4, TypedData::data_offset())); |
| 1305 |
| 1306 // T2 = d = digits[i >> 1] |
| 1307 __ lw(T0, Address(SP, 0 * kWordSize)); // T0 = i as Smi. |
| 1308 __ lw(T1, Address(SP, 1 * kWordSize)); // T1 = digits. |
| 1309 __ sll(T0, T0, 1); |
| 1310 __ addu(T1, T0, T1); |
| 1311 __ lw(T2, FieldAddress(T1, TypedData::data_offset())); |
| 1312 |
| 1313 // HI:LO = t = rho*d |
| 1314 __ multu(T2, T3); |
| 1315 |
| 1316 // args[1] = t mod DIGIT_BASE = low32(t) |
| 1317 __ mflo(T0); |
| 1318 __ sw(T0, |
| 1319 FieldAddress(T4, TypedData::data_offset() + Bigint::kBytesPerDigit)); |
| 1320 |
| 1321 // Returning Object::null() is not required, since this method is private. |
| 1322 __ Ret(); |
| 1323 } |
| 1324 |
| 1325 |
929 // Check if the last argument is a double, jump to label 'is_smi' if smi | 1326 // Check if the last argument is a double, jump to label 'is_smi' if smi |
930 // (easy to convert to double), otherwise jump to label 'not_double_smi', | 1327 // (easy to convert to double), otherwise jump to label 'not_double_smi', |
931 // Returns the last argument in T0. | 1328 // Returns the last argument in T0. |
932 static void TestLastArgumentIsDouble(Assembler* assembler, | 1329 static void TestLastArgumentIsDouble(Assembler* assembler, |
933 Label* is_smi, | 1330 Label* is_smi, |
934 Label* not_double_smi) { | 1331 Label* not_double_smi) { |
935 __ lw(T0, Address(SP, 0 * kWordSize)); | 1332 __ lw(T0, Address(SP, 0 * kWordSize)); |
936 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); | 1333 __ andi(CMPRES1, T0, Immediate(kSmiTagMask)); |
937 __ beq(CMPRES1, ZR, is_smi); | 1334 __ beq(CMPRES1, ZR, is_smi); |
938 __ LoadClassId(CMPRES1, T0); | 1335 __ LoadClassId(CMPRES1, T0); |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 Isolate* isolate = Isolate::Current(); | 2101 Isolate* isolate = Isolate::Current(); |
1705 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); | 2102 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); |
1706 // Set return value. | 2103 // Set return value. |
1707 __ Ret(); | 2104 __ Ret(); |
1708 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 2105 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
1709 } | 2106 } |
1710 | 2107 |
1711 } // namespace dart | 2108 } // namespace dart |
1712 | 2109 |
1713 #endif // defined TARGET_ARCH_MIPS | 2110 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |