| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 | 696 |
| 697 // Implementation: | 697 // Implementation: |
| 698 // res = left % right; | 698 // res = left % right; |
| 699 // if (res < 0) { | 699 // if (res < 0) { |
| 700 // if (right < 0) { | 700 // if (right < 0) { |
| 701 // res = res - right; | 701 // res = res - right; |
| 702 // } else { | 702 // } else { |
| 703 // res = res + right; | 703 // res = res + right; |
| 704 // } | 704 // } |
| 705 // } | 705 // } |
| 706 bool Intrinsifier::Integer_modulo(Assembler* assembler) { | 706 bool Intrinsifier::Integer_moduloFromInteger(Assembler* assembler) { |
| 707 Label fall_through, negative_result; | 707 Label fall_through, negative_result; |
| 708 TestBothArgumentsSmis(assembler, &fall_through); | 708 TestBothArgumentsSmis(assembler, &fall_through); |
| 709 // RAX: right argument (divisor) | 709 __ movq(RCX, Address(RSP, + 2 * kWordSize)); |
| 710 __ movq(RCX, RAX); | |
| 711 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Left argument (dividend). | |
| 712 // RAX: Tagged left (dividend). | 710 // RAX: Tagged left (dividend). |
| 713 // RCX: Tagged right (divisor). | 711 // RCX: Tagged right (divisor). |
| 714 __ cmpq(RCX, Immediate(0)); | 712 __ cmpq(RCX, Immediate(0)); |
| 715 __ j(EQUAL, &fall_through); | 713 __ j(EQUAL, &fall_through); |
| 716 EmitRemainderOperation(assembler); | 714 EmitRemainderOperation(assembler); |
| 717 // Untagged remainder result in RAX. | 715 // Untagged remainder result in RAX. |
| 718 __ cmpq(RAX, Immediate(0)); | 716 __ cmpq(RAX, Immediate(0)); |
| 719 __ j(LESS, &negative_result, Assembler::kNearJump); | 717 __ j(LESS, &negative_result, Assembler::kNearJump); |
| 720 __ SmiTag(RAX); | 718 __ SmiTag(RAX); |
| 721 __ ret(); | 719 __ ret(); |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 __ Bind(&fall_through); | 1687 __ Bind(&fall_through); |
| 1690 return false; | 1688 return false; |
| 1691 } | 1689 } |
| 1692 | 1690 |
| 1693 | 1691 |
| 1694 #undef __ | 1692 #undef __ |
| 1695 | 1693 |
| 1696 } // namespace dart | 1694 } // namespace dart |
| 1697 | 1695 |
| 1698 #endif // defined TARGET_ARCH_X64 | 1696 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |