Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(887)

Side by Side Diff: runtime/vm/intrinsifier_ia32.cc

Issue 59933004: In preparation of inlining remainder and modulo binary Smi operations: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intrinsifier_arm.cc ('k') | runtime/vm/intrinsifier_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 723
724 __ Bind(&done); 724 __ Bind(&done);
725 // The remainder of two smis is always a smi, no overflow check needed. 725 // The remainder of two smis is always a smi, no overflow check needed.
726 __ SmiTag(EAX); 726 __ SmiTag(EAX);
727 __ ret(); 727 __ ret();
728 728
729 __ Bind(&fall_through); 729 __ Bind(&fall_through);
730 } 730 }
731 731
732 732
733 void Intrinsifier::Integer_remainder(Assembler* assembler) {
734 Label fall_through;
735 TestBothArgumentsSmis(assembler, &fall_through);
736 // EAX: right argument (divisor)
737 __ movl(EBX, EAX);
738 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Left argument (dividend).
739 // EAX: Tagged left (dividend).
740 // EBX: Tagged right (divisor).
741 // Check if modulo by zero -> exception thrown in main function.
742 __ cmpl(EBX, Immediate(0));
743 __ j(EQUAL, &fall_through, Assembler::kNearJump);
744 EmitRemainderOperation(assembler);
745 // Untagged remainder result in EDX.
746 __ movl(EAX, EDX);
747 __ SmiTag(EAX);
748 __ ret();
749
750 __ Bind(&fall_through);
751 }
752
753
754 void Intrinsifier::Integer_truncDivide(Assembler* assembler) { 733 void Intrinsifier::Integer_truncDivide(Assembler* assembler) {
755 Label fall_through; 734 Label fall_through;
756 TestBothArgumentsSmis(assembler, &fall_through); 735 TestBothArgumentsSmis(assembler, &fall_through);
757 // EAX: right argument (divisor) 736 // EAX: right argument (divisor)
758 __ cmpl(EAX, Immediate(0)); 737 __ cmpl(EAX, Immediate(0));
759 __ j(EQUAL, &fall_through, Assembler::kNearJump); 738 __ j(EQUAL, &fall_through, Assembler::kNearJump);
760 __ movl(EBX, EAX); 739 __ movl(EBX, EAX);
761 __ SmiUntag(EBX); 740 __ SmiUntag(EBX);
762 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Left argument (dividend). 741 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // Left argument (dividend).
763 __ SmiUntag(EAX); 742 __ SmiUntag(EAX);
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 1783
1805 1784
1806 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 1785 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
1807 StringEquality(assembler, kTwoByteStringCid); 1786 StringEquality(assembler, kTwoByteStringCid);
1808 } 1787 }
1809 1788
1810 #undef __ 1789 #undef __
1811 } // namespace dart 1790 } // namespace dart
1812 1791
1813 #endif // defined TARGET_ARCH_IA32 1792 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_arm.cc ('k') | runtime/vm/intrinsifier_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698