| 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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 | 714 |
| 715 // Implementation: | 715 // Implementation: |
| 716 // res = left % right; | 716 // res = left % right; |
| 717 // if (res < 0) { | 717 // if (res < 0) { |
| 718 // if (right < 0) { | 718 // if (right < 0) { |
| 719 // res = res - right; | 719 // res = res - right; |
| 720 // } else { | 720 // } else { |
| 721 // res = res + right; | 721 // res = res + right; |
| 722 // } | 722 // } |
| 723 // } | 723 // } |
| 724 bool Intrinsifier::Integer_modulo(Assembler* assembler) { | 724 bool Intrinsifier::Integer_moduloFromInteger(Assembler* assembler) { |
| 725 Label fall_through, subtract; | 725 Label fall_through, subtract; |
| 726 TestBothArgumentsSmis(assembler, &fall_through); | 726 // Test arguments for smi. |
| 727 __ lw(T1, Address(SP, 0 * kWordSize)); |
| 728 __ lw(T0, Address(SP, 1 * kWordSize)); |
| 729 __ or_(CMPRES, T0, T1); |
| 730 __ andi(CMPRES, CMPRES, Immediate(kSmiTagMask)); |
| 731 __ bne(CMPRES, ZR, &fall_through); |
| 727 // T1: Tagged left (dividend). | 732 // T1: Tagged left (dividend). |
| 728 // T0: Tagged right (divisor). | 733 // T0: Tagged right (divisor). |
| 729 // Check if modulo by zero -> exception thrown in main function. | 734 // Check if modulo by zero -> exception thrown in main function. |
| 730 __ beq(T0, ZR, &fall_through); | 735 __ beq(T0, ZR, &fall_through); |
| 731 EmitRemainderOperation(assembler); | 736 EmitRemainderOperation(assembler); |
| 732 // Untagged right in T0. Untagged remainder result in V0. | 737 // Untagged right in T0. Untagged remainder result in V0. |
| 733 | 738 |
| 734 Label done; | 739 Label done; |
| 735 __ bgez(V0, &done); | 740 __ bgez(V0, &done); |
| 736 __ bltz(T0, &subtract); | 741 __ bltz(T0, &subtract); |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1775 __ Bind(&ok); | 1780 __ Bind(&ok); |
| 1776 __ Ret(); | 1781 __ Ret(); |
| 1777 | 1782 |
| 1778 __ Bind(&fall_through); | 1783 __ Bind(&fall_through); |
| 1779 return false; | 1784 return false; |
| 1780 } | 1785 } |
| 1781 | 1786 |
| 1782 } // namespace dart | 1787 } // namespace dart |
| 1783 | 1788 |
| 1784 #endif // defined TARGET_ARCH_MIPS | 1789 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |