| 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 5580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5591 and_(overflow_dst, scratch, overflow_dst); | 5591 and_(overflow_dst, scratch, overflow_dst); |
| 5592 } else { | 5592 } else { |
| 5593 subu(dst, left, right); | 5593 subu(dst, left, right); |
| 5594 xor_(overflow_dst, dst, left); | 5594 xor_(overflow_dst, dst, left); |
| 5595 xor_(scratch, left, right); | 5595 xor_(scratch, left, right); |
| 5596 and_(overflow_dst, scratch, overflow_dst); | 5596 and_(overflow_dst, scratch, overflow_dst); |
| 5597 } | 5597 } |
| 5598 BranchOvfHelper(this, overflow_dst, overflow_label, no_overflow_label); | 5598 BranchOvfHelper(this, overflow_dst, overflow_label, no_overflow_label); |
| 5599 } | 5599 } |
| 5600 | 5600 |
| 5601 static inline void BranchOvfHelperMult(MacroAssembler* masm, |
| 5602 Register overflow_dst, |
| 5603 Label* overflow_label, |
| 5604 Label* no_overflow_label) { |
| 5605 DCHECK(overflow_label || no_overflow_label); |
| 5606 if (!overflow_label) { |
| 5607 DCHECK(no_overflow_label); |
| 5608 masm->Branch(no_overflow_label, eq, overflow_dst, Operand(zero_reg)); |
| 5609 } else { |
| 5610 masm->Branch(overflow_label, ne, overflow_dst, Operand(zero_reg)); |
| 5611 if (no_overflow_label) masm->Branch(no_overflow_label); |
| 5612 } |
| 5613 } |
| 5614 |
| 5615 void MacroAssembler::MulBranchOvf(Register dst, Register left, |
| 5616 const Operand& right, Label* overflow_label, |
| 5617 Label* no_overflow_label, Register scratch) { |
| 5618 DCHECK(overflow_label || no_overflow_label); |
| 5619 if (right.is_reg()) { |
| 5620 MulBranchOvf(dst, left, right.rm(), overflow_label, no_overflow_label, |
| 5621 scratch); |
| 5622 } else { |
| 5623 Register overflow_dst = t9; |
| 5624 DCHECK(!dst.is(scratch)); |
| 5625 DCHECK(!dst.is(overflow_dst)); |
| 5626 DCHECK(!scratch.is(overflow_dst)); |
| 5627 DCHECK(!left.is(overflow_dst)); |
| 5628 DCHECK(!left.is(scratch)); |
| 5629 |
| 5630 Mul(overflow_dst, dst, left, right.immediate()); |
| 5631 sra(scratch, dst, 31); |
| 5632 xor_(overflow_dst, overflow_dst, scratch); |
| 5633 |
| 5634 BranchOvfHelperMult(this, overflow_dst, overflow_label, no_overflow_label); |
| 5635 } |
| 5636 } |
| 5637 |
| 5638 void MacroAssembler::MulBranchOvf(Register dst, Register left, Register right, |
| 5639 Label* overflow_label, |
| 5640 Label* no_overflow_label, Register scratch) { |
| 5641 DCHECK(overflow_label || no_overflow_label); |
| 5642 Register overflow_dst = t9; |
| 5643 DCHECK(!dst.is(scratch)); |
| 5644 DCHECK(!dst.is(overflow_dst)); |
| 5645 DCHECK(!scratch.is(overflow_dst)); |
| 5646 DCHECK(!overflow_dst.is(left)); |
| 5647 DCHECK(!overflow_dst.is(right)); |
| 5648 DCHECK(!scratch.is(left)); |
| 5649 DCHECK(!scratch.is(right)); |
| 5650 |
| 5651 Mul(overflow_dst, dst, left, right); |
| 5652 sra(scratch, dst, 31); |
| 5653 xor_(overflow_dst, overflow_dst, scratch); |
| 5654 |
| 5655 BranchOvfHelperMult(this, overflow_dst, overflow_label, no_overflow_label); |
| 5656 } |
| 5601 | 5657 |
| 5602 void MacroAssembler::CallRuntime(const Runtime::Function* f, int num_arguments, | 5658 void MacroAssembler::CallRuntime(const Runtime::Function* f, int num_arguments, |
| 5603 SaveFPRegsMode save_doubles, | 5659 SaveFPRegsMode save_doubles, |
| 5604 BranchDelaySlot bd) { | 5660 BranchDelaySlot bd) { |
| 5605 // All parameters are on the stack. v0 has the return value after call. | 5661 // All parameters are on the stack. v0 has the return value after call. |
| 5606 | 5662 |
| 5607 // If the expected number of arguments of the runtime function is | 5663 // If the expected number of arguments of the runtime function is |
| 5608 // constant, we check that the actual number of arguments match the | 5664 // constant, we check that the actual number of arguments match the |
| 5609 // expectation. | 5665 // expectation. |
| 5610 CHECK(f->nargs < 0 || f->nargs == num_arguments); | 5666 CHECK(f->nargs < 0 || f->nargs == num_arguments); |
| (...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6925 if (mag.shift > 0) sra(result, result, mag.shift); | 6981 if (mag.shift > 0) sra(result, result, mag.shift); |
| 6926 srl(at, dividend, 31); | 6982 srl(at, dividend, 31); |
| 6927 Addu(result, result, Operand(at)); | 6983 Addu(result, result, Operand(at)); |
| 6928 } | 6984 } |
| 6929 | 6985 |
| 6930 | 6986 |
| 6931 } // namespace internal | 6987 } // namespace internal |
| 6932 } // namespace v8 | 6988 } // namespace v8 |
| 6933 | 6989 |
| 6934 #endif // V8_TARGET_ARCH_MIPS | 6990 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |