| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 | 705 |
| 706 // Implementation: | 706 // Implementation: |
| 707 // res = left % right; | 707 // res = left % right; |
| 708 // if (res < 0) { | 708 // if (res < 0) { |
| 709 // if (right < 0) { | 709 // if (right < 0) { |
| 710 // res = res - right; | 710 // res = res - right; |
| 711 // } else { | 711 // } else { |
| 712 // res = res + right; | 712 // res = res + right; |
| 713 // } | 713 // } |
| 714 // } | 714 // } |
| 715 bool Intrinsifier::Integer_modulo(Assembler* assembler) { | 715 bool Intrinsifier::Integer_moduloFromInteger(Assembler* assembler) { |
| 716 // Check to see if we have integer division | 716 // Check to see if we have integer division |
| 717 Label fall_through, subtract; | 717 Label fall_through, subtract; |
| 718 TestBothArgumentsSmis(assembler, &fall_through); | 718 __ ldr(R1, Address(SP, + 0 * kWordSize)); |
| 719 __ ldr(R0, Address(SP, + 1 * kWordSize)); |
| 720 __ orr(TMP, R0, ShifterOperand(R1)); |
| 721 __ tst(TMP, ShifterOperand(kSmiTagMask)); |
| 722 __ b(&fall_through, NE); |
| 719 // R1: Tagged left (dividend). | 723 // R1: Tagged left (dividend). |
| 720 // R0: Tagged right (divisor). | 724 // R0: Tagged right (divisor). |
| 721 // Check if modulo by zero -> exception thrown in main function. | 725 // Check if modulo by zero -> exception thrown in main function. |
| 722 __ cmp(R0, ShifterOperand(0)); | 726 __ cmp(R0, ShifterOperand(0)); |
| 723 __ b(&fall_through, EQ); | 727 __ b(&fall_through, EQ); |
| 724 EmitRemainderOperation(assembler); | 728 EmitRemainderOperation(assembler); |
| 725 // Untagged right in R0. Untagged remainder result in R1. | 729 // Untagged right in R0. Untagged remainder result in R1. |
| 726 | 730 |
| 727 __ cmp(R1, ShifterOperand(0)); | 731 __ cmp(R1, ShifterOperand(0)); |
| 728 __ mov(R0, ShifterOperand(R1, LSL, 1), GE); // Tag and move result to R0. | 732 __ mov(R0, ShifterOperand(R1, LSL, 1), GE); // Tag and move result to R0. |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1693 __ Bind(&ok); | 1697 __ Bind(&ok); |
| 1694 __ Ret(); | 1698 __ Ret(); |
| 1695 | 1699 |
| 1696 __ Bind(&fall_through); | 1700 __ Bind(&fall_through); |
| 1697 return false; | 1701 return false; |
| 1698 } | 1702 } |
| 1699 | 1703 |
| 1700 } // namespace dart | 1704 } // namespace dart |
| 1701 | 1705 |
| 1702 #endif // defined TARGET_ARCH_ARM | 1706 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |