OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 if (IsMipsArchVariant(kMips32r6) && sa <= 4) { | 1179 if (IsMipsArchVariant(kMips32r6) && sa <= 4) { |
1180 lsa(rd, rt, rs, sa - 1); | 1180 lsa(rd, rt, rs, sa - 1); |
1181 } else { | 1181 } else { |
1182 Register tmp = rd.is(rt) ? scratch : rd; | 1182 Register tmp = rd.is(rt) ? scratch : rd; |
1183 DCHECK(!tmp.is(rt)); | 1183 DCHECK(!tmp.is(rt)); |
1184 sll(tmp, rs, sa); | 1184 sll(tmp, rs, sa); |
1185 Addu(rd, rt, tmp); | 1185 Addu(rd, rt, tmp); |
1186 } | 1186 } |
1187 } | 1187 } |
1188 | 1188 |
| 1189 void MacroAssembler::Bovc(Register rs, Register rt, Label* L) { |
| 1190 if (is_trampoline_emitted()) { |
| 1191 Label skip; |
| 1192 bnvc(rs, rt, &skip); |
| 1193 BranchLong(L, PROTECT); |
| 1194 bind(&skip); |
| 1195 } else { |
| 1196 bovc(rs, rt, L); |
| 1197 } |
| 1198 } |
| 1199 |
| 1200 void MacroAssembler::Bnvc(Register rs, Register rt, Label* L) { |
| 1201 if (is_trampoline_emitted()) { |
| 1202 Label skip; |
| 1203 bovc(rs, rt, &skip); |
| 1204 BranchLong(L, PROTECT); |
| 1205 bind(&skip); |
| 1206 } else { |
| 1207 bnvc(rs, rt, L); |
| 1208 } |
| 1209 } |
1189 | 1210 |
1190 // ------------Pseudo-instructions------------- | 1211 // ------------Pseudo-instructions------------- |
1191 | 1212 |
1192 // Word Swap Byte | 1213 // Word Swap Byte |
1193 void MacroAssembler::ByteSwapSigned(Register reg, int operand_size) { | 1214 void MacroAssembler::ByteSwapSigned(Register reg, int operand_size) { |
1194 DCHECK(operand_size == 1 || operand_size == 2 || operand_size == 4); | 1215 DCHECK(operand_size == 1 || operand_size == 2 || operand_size == 4); |
1195 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { | 1216 if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) { |
1196 if (operand_size == 2) { | 1217 if (operand_size == 2) { |
1197 seh(reg, reg); | 1218 seh(reg, reg); |
1198 } else if (operand_size == 1) { | 1219 } else if (operand_size == 1) { |
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3330 nop(); | 3351 nop(); |
3331 | 3352 |
3332 return true; | 3353 return true; |
3333 } | 3354 } |
3334 | 3355 |
3335 | 3356 |
3336 bool MacroAssembler::BranchShortCheck(int32_t offset, Label* L, Condition cond, | 3357 bool MacroAssembler::BranchShortCheck(int32_t offset, Label* L, Condition cond, |
3337 Register rs, const Operand& rt, | 3358 Register rs, const Operand& rt, |
3338 BranchDelaySlot bdslot) { | 3359 BranchDelaySlot bdslot) { |
3339 BRANCH_ARGS_CHECK(cond, rs, rt); | 3360 BRANCH_ARGS_CHECK(cond, rs, rt); |
3340 | |
3341 if (!L) { | 3361 if (!L) { |
3342 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT) { | 3362 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT) { |
3343 DCHECK(is_int26(offset)); | 3363 DCHECK(is_int26(offset)); |
3344 return BranchShortHelperR6(offset, nullptr, cond, rs, rt); | 3364 return BranchShortHelperR6(offset, nullptr, cond, rs, rt); |
3345 } else { | 3365 } else { |
3346 DCHECK(is_int16(offset)); | 3366 DCHECK(is_int16(offset)); |
3347 return BranchShortHelper(offset, nullptr, cond, rs, rt, bdslot); | 3367 return BranchShortHelper(offset, nullptr, cond, rs, rt, bdslot); |
3348 } | 3368 } |
3349 } else { | 3369 } else { |
3350 DCHECK(offset == 0); | 3370 DCHECK(offset == 0); |
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5387 if (!overflow_label) { | 5407 if (!overflow_label) { |
5388 DCHECK(no_overflow_label); | 5408 DCHECK(no_overflow_label); |
5389 DCHECK(!dst.is(scratch)); | 5409 DCHECK(!dst.is(scratch)); |
5390 Register left_reg = left.is(dst) ? scratch : left; | 5410 Register left_reg = left.is(dst) ? scratch : left; |
5391 Register right_reg = right.is(dst) ? t9 : right; | 5411 Register right_reg = right.is(dst) ? t9 : right; |
5392 DCHECK(!dst.is(left_reg)); | 5412 DCHECK(!dst.is(left_reg)); |
5393 DCHECK(!dst.is(right_reg)); | 5413 DCHECK(!dst.is(right_reg)); |
5394 Move(left_reg, left); | 5414 Move(left_reg, left); |
5395 Move(right_reg, right); | 5415 Move(right_reg, right); |
5396 addu(dst, left, right); | 5416 addu(dst, left, right); |
5397 bnvc(left_reg, right_reg, no_overflow_label); | 5417 Bnvc(left_reg, right_reg, no_overflow_label); |
5398 } else { | 5418 } else { |
5399 bovc(left, right, overflow_label); | 5419 Bovc(left, right, overflow_label); |
5400 addu(dst, left, right); | 5420 addu(dst, left, right); |
5401 if (no_overflow_label) bc(no_overflow_label); | 5421 if (no_overflow_label) bc(no_overflow_label); |
5402 } | 5422 } |
5403 } else { | 5423 } else { |
5404 Register overflow_dst = t9; | 5424 Register overflow_dst = t9; |
5405 DCHECK(!dst.is(scratch)); | 5425 DCHECK(!dst.is(scratch)); |
5406 DCHECK(!dst.is(overflow_dst)); | 5426 DCHECK(!dst.is(overflow_dst)); |
5407 DCHECK(!scratch.is(overflow_dst)); | 5427 DCHECK(!scratch.is(overflow_dst)); |
5408 DCHECK(!left.is(overflow_dst)); | 5428 DCHECK(!left.is(overflow_dst)); |
5409 DCHECK(!right.is(overflow_dst)); | 5429 DCHECK(!right.is(overflow_dst)); |
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6909 if (mag.shift > 0) sra(result, result, mag.shift); | 6929 if (mag.shift > 0) sra(result, result, mag.shift); |
6910 srl(at, dividend, 31); | 6930 srl(at, dividend, 31); |
6911 Addu(result, result, Operand(at)); | 6931 Addu(result, result, Operand(at)); |
6912 } | 6932 } |
6913 | 6933 |
6914 | 6934 |
6915 } // namespace internal | 6935 } // namespace internal |
6916 } // namespace v8 | 6936 } // namespace v8 |
6917 | 6937 |
6918 #endif // V8_TARGET_ARCH_MIPS | 6938 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |