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 5475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5486 Register overflow_dst = t9; | 5486 Register overflow_dst = t9; |
5487 DCHECK(!dst.is(scratch)); | 5487 DCHECK(!dst.is(scratch)); |
5488 DCHECK(!dst.is(overflow_dst)); | 5488 DCHECK(!dst.is(overflow_dst)); |
5489 DCHECK(!scratch.is(overflow_dst)); | 5489 DCHECK(!scratch.is(overflow_dst)); |
5490 DCHECK(!left.is(overflow_dst)); | 5490 DCHECK(!left.is(overflow_dst)); |
5491 DCHECK(!right.is(overflow_dst)); | 5491 DCHECK(!right.is(overflow_dst)); |
5492 DCHECK(!left.is(scratch)); | 5492 DCHECK(!left.is(scratch)); |
5493 DCHECK(!right.is(scratch)); | 5493 DCHECK(!right.is(scratch)); |
5494 | 5494 |
5495 if (left.is(right) && dst.is(left)) { | 5495 if (left.is(right) && dst.is(left)) { |
5496 mov(overflow_dst, right); | 5496 mov(scratch, left); // Preserve left and right. |
5497 right = overflow_dst; | 5497 addu(dst, left, right); // Both are overwritten. |
5498 } | 5498 xor_(overflow_dst, dst, scratch); // Left and right are equal. |
5499 | 5499 Label done; // Restore inputs if overflow. |
5500 if (dst.is(left)) { | 5500 Branch(&done, ge, overflow_dst, Operand(zero_reg)); |
| 5501 mov(left, scratch); // Original left and right. |
| 5502 bind(&done); |
| 5503 } else if (dst.is(left)) { |
5501 mov(scratch, left); // Preserve left. | 5504 mov(scratch, left); // Preserve left. |
5502 addu(dst, left, right); // Left is overwritten. | 5505 addu(dst, left, right); // Left is overwritten. |
5503 xor_(scratch, dst, scratch); // Original left. | 5506 xor_(scratch, dst, scratch); // Original left. |
5504 xor_(overflow_dst, dst, right); | 5507 xor_(overflow_dst, dst, right); |
5505 and_(overflow_dst, overflow_dst, scratch); | 5508 and_(overflow_dst, overflow_dst, scratch); |
5506 } else if (dst.is(right)) { | 5509 } else if (dst.is(right)) { |
5507 mov(scratch, right); // Preserve right. | 5510 mov(scratch, right); // Preserve right. |
5508 addu(dst, left, right); // Right is overwritten. | 5511 addu(dst, left, right); // Right is overwritten. |
5509 xor_(scratch, dst, scratch); // Original right. | 5512 xor_(scratch, dst, scratch); // Original right. |
5510 xor_(overflow_dst, dst, left); | 5513 xor_(overflow_dst, dst, left); |
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6912 if (mag.shift > 0) sra(result, result, mag.shift); | 6915 if (mag.shift > 0) sra(result, result, mag.shift); |
6913 srl(at, dividend, 31); | 6916 srl(at, dividend, 31); |
6914 Addu(result, result, Operand(at)); | 6917 Addu(result, result, Operand(at)); |
6915 } | 6918 } |
6916 | 6919 |
6917 | 6920 |
6918 } // namespace internal | 6921 } // namespace internal |
6919 } // namespace v8 | 6922 } // namespace v8 |
6920 | 6923 |
6921 #endif // V8_TARGET_ARCH_MIPS | 6924 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |