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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 | 705 |
706 __ Bind(&subtract); | 706 __ Bind(&subtract); |
707 __ subq(RAX, RCX); | 707 __ subq(RAX, RCX); |
708 __ SmiTag(RAX); | 708 __ SmiTag(RAX); |
709 __ ret(); | 709 __ ret(); |
710 | 710 |
711 __ Bind(&fall_through); | 711 __ Bind(&fall_through); |
712 } | 712 } |
713 | 713 |
714 | 714 |
715 void Intrinsifier::Integer_remainder(Assembler* assembler) { | |
716 Label fall_through; | |
717 TestBothArgumentsSmis(assembler, &fall_through); | |
718 // RAX: right argument (divisor) | |
719 __ movq(RCX, RAX); | |
720 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Left argument (dividend). | |
721 // RAX: Tagged left (dividend). | |
722 // RCX: Tagged right (divisor). | |
723 __ cmpq(RCX, Immediate(0)); | |
724 __ j(EQUAL, &fall_through); | |
725 EmitRemainderOperation(assembler); | |
726 // Untagged remainder result in RAX. | |
727 __ SmiTag(RAX); | |
728 __ ret(); | |
729 __ Bind(&fall_through); | |
730 } | |
731 | |
732 | |
733 void Intrinsifier::Integer_truncDivide(Assembler* assembler) { | 715 void Intrinsifier::Integer_truncDivide(Assembler* assembler) { |
734 Label fall_through, not_32bit; | 716 Label fall_through, not_32bit; |
735 TestBothArgumentsSmis(assembler, &fall_through); | 717 TestBothArgumentsSmis(assembler, &fall_through); |
736 // RAX: right argument (divisor) | 718 // RAX: right argument (divisor) |
737 __ cmpq(RAX, Immediate(0)); | 719 __ cmpq(RAX, Immediate(0)); |
738 __ j(EQUAL, &fall_through, Assembler::kNearJump); | 720 __ j(EQUAL, &fall_through, Assembler::kNearJump); |
739 __ movq(RCX, RAX); | 721 __ movq(RCX, RAX); |
740 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Left argument (dividend). | 722 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Left argument (dividend). |
741 | 723 |
742 // Check if both operands fit into 32bits as idiv with 64bit operands | 724 // Check if both operands fit into 32bits as idiv with 64bit operands |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 | 1698 |
1717 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1699 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1718 StringEquality(assembler, kTwoByteStringCid); | 1700 StringEquality(assembler, kTwoByteStringCid); |
1719 } | 1701 } |
1720 | 1702 |
1721 #undef __ | 1703 #undef __ |
1722 | 1704 |
1723 } // namespace dart | 1705 } // namespace dart |
1724 | 1706 |
1725 #endif // defined TARGET_ARCH_X64 | 1707 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |