| 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 // The intrinsic code below is executed before a method has built its frame. | 5 // The intrinsic code below is executed before a method has built its frame. |
| 6 // The return address is on the stack and the arguments below it. | 6 // The return address is on the stack and the arguments below it. |
| 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. | 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. |
| 8 // Each intrinsification method returns true if the corresponding | 8 // Each intrinsification method returns true if the corresponding |
| 9 // Dart method was intrinsified. | 9 // Dart method was intrinsified. |
| 10 | 10 |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 | 708 |
| 709 // Implementation: | 709 // Implementation: |
| 710 // res = left % right; | 710 // res = left % right; |
| 711 // if (res < 0) { | 711 // if (res < 0) { |
| 712 // if (right < 0) { | 712 // if (right < 0) { |
| 713 // res = res - right; | 713 // res = res - right; |
| 714 // } else { | 714 // } else { |
| 715 // res = res + right; | 715 // res = res + right; |
| 716 // } | 716 // } |
| 717 // } | 717 // } |
| 718 bool Intrinsifier::Integer_modulo(Assembler* assembler) { | 718 bool Intrinsifier::Integer_moduloFromInteger(Assembler* assembler) { |
| 719 Label fall_through, subtract; | 719 Label fall_through, subtract; |
| 720 TestBothArgumentsSmis(assembler, &fall_through); | 720 TestBothArgumentsSmis(assembler, &fall_through); |
| 721 // EAX: right argument (divisor) | 721 __ movl(EBX, Address(ESP, + 2 * kWordSize)); |
| 722 __ movl(EBX, EAX); | |
| 723 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Left argument (dividend). | |
| 724 // EAX: Tagged left (dividend). | 722 // EAX: Tagged left (dividend). |
| 725 // EBX: Tagged right (divisor). | 723 // EBX: Tagged right (divisor). |
| 726 // Check if modulo by zero -> exception thrown in main function. | 724 // Check if modulo by zero -> exception thrown in main function. |
| 727 __ cmpl(EBX, Immediate(0)); | 725 __ cmpl(EBX, Immediate(0)); |
| 728 __ j(EQUAL, &fall_through, Assembler::kNearJump); | 726 __ j(EQUAL, &fall_through, Assembler::kNearJump); |
| 729 EmitRemainderOperation(assembler); | 727 EmitRemainderOperation(assembler); |
| 730 // Untagged remainder result in EDX. | 728 // Untagged remainder result in EDX. |
| 731 Label done; | 729 Label done; |
| 732 __ movl(EAX, EDX); | 730 __ movl(EAX, EDX); |
| 733 __ cmpl(EAX, Immediate(0)); | 731 __ cmpl(EAX, Immediate(0)); |
| (...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 __ ret(); | 1767 __ ret(); |
| 1770 | 1768 |
| 1771 __ Bind(&fall_through); | 1769 __ Bind(&fall_through); |
| 1772 return false; | 1770 return false; |
| 1773 } | 1771 } |
| 1774 | 1772 |
| 1775 #undef __ | 1773 #undef __ |
| 1776 } // namespace dart | 1774 } // namespace dart |
| 1777 | 1775 |
| 1778 #endif // defined TARGET_ARCH_IA32 | 1776 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |