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

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

Issue 646493003: Implement bigint absAdd, bigint absSub, and Montgomery mulMod intrinsics on ARM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 months 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
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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 ASSERT(CTX == ESI); 922 ASSERT(CTX == ESI);
923 923
924 __ movl(EDI, Address(ESP, 6 * kWordSize)); // digits 924 __ movl(EDI, Address(ESP, 6 * kWordSize)); // digits
925 __ movl(EAX, Address(ESP, 5 * kWordSize)); // used is Smi 925 __ movl(EAX, Address(ESP, 5 * kWordSize)); // used is Smi
926 __ SmiUntag(EAX); // used > 0. 926 __ SmiUntag(EAX); // used > 0.
927 __ movl(ESI, Address(ESP, 4 * kWordSize)); // a_digits 927 __ movl(ESI, Address(ESP, 4 * kWordSize)); // a_digits
928 __ movl(ECX, Address(ESP, 3 * kWordSize)); // a_used is Smi 928 __ movl(ECX, Address(ESP, 3 * kWordSize)); // a_used is Smi
929 __ SmiUntag(ECX); // a_used > 0. 929 __ SmiUntag(ECX); // a_used > 0.
930 __ movl(EBX, Address(ESP, 2 * kWordSize)); // r_digits 930 __ movl(EBX, Address(ESP, 2 * kWordSize)); // r_digits
931 931
932 // Precompute 'used - a_used' now so that CF is not lost later. 932 // Precompute 'used - a_used' now so that carry flag is not lost later.
933 __ subl(EAX, ECX); 933 __ subl(EAX, ECX);
934 __ incl(EAX); // To account for the extra test between loops. 934 __ incl(EAX); // To account for the extra test between loops.
935 __ pushl(EAX); 935 __ pushl(EAX);
936 936
937 __ xorl(EDX, EDX); // EDX = 0, CF = 0. 937 __ xorl(EDX, EDX); // EDX = 0, carry flag = 0.
938 Label add_loop; 938 Label add_loop;
939 __ Bind(&add_loop); 939 __ Bind(&add_loop);
940 __ movl(EAX, FieldAddress(EDI, EDX, TIMES_4, TypedData::data_offset())); 940 __ movl(EAX, FieldAddress(EDI, EDX, TIMES_4, TypedData::data_offset()));
941 __ adcl(EAX, FieldAddress(ESI, EDX, TIMES_4, TypedData::data_offset())); 941 __ adcl(EAX, FieldAddress(ESI, EDX, TIMES_4, TypedData::data_offset()));
942 __ movl(FieldAddress(EBX, EDX, TIMES_4, TypedData::data_offset()), EAX); 942 __ movl(FieldAddress(EBX, EDX, TIMES_4, TypedData::data_offset()), EAX);
943 __ incl(EDX); // Does not affect CF. 943 __ incl(EDX); // Does not affect carry flag.
944 __ decl(ECX); // Does not affect CF. 944 __ decl(ECX); // Does not affect carry flag.
945 __ j(NOT_ZERO, &add_loop, Assembler::kNearJump); 945 __ j(NOT_ZERO, &add_loop, Assembler::kNearJump);
946 946
947 Label last_carry; 947 Label last_carry;
948 __ popl(ECX); 948 __ popl(ECX);
949 __ decl(ECX); // Does not affect CF. 949 __ decl(ECX); // Does not affect carry flag.
950 __ j(ZERO, &last_carry, Assembler::kNearJump); 950 __ j(ZERO, &last_carry, Assembler::kNearJump);
951 951
952 Label carry_loop; 952 Label carry_loop;
953 __ Bind(&carry_loop); 953 __ Bind(&carry_loop);
954 __ movl(EAX, FieldAddress(EDI, EDX, TIMES_4, TypedData::data_offset())); 954 __ movl(EAX, FieldAddress(EDI, EDX, TIMES_4, TypedData::data_offset()));
955 __ adcl(EAX, Immediate(0)); 955 __ adcl(EAX, Immediate(0));
956 __ movl(FieldAddress(EBX, EDX, TIMES_4, TypedData::data_offset()), EAX); 956 __ movl(FieldAddress(EBX, EDX, TIMES_4, TypedData::data_offset()), EAX);
957 __ incl(EDX); // Does not affect CF. 957 __ incl(EDX); // Does not affect carry flag.
958 __ decl(ECX); // Does not affect CF. 958 __ decl(ECX); // Does not affect carry flag.
959 __ j(NOT_ZERO, &carry_loop, Assembler::kNearJump); 959 __ j(NOT_ZERO, &carry_loop, Assembler::kNearJump);
960 960
961 __ Bind(&last_carry); 961 __ Bind(&last_carry);
962 __ movl(EAX, Immediate(0)); 962 __ movl(EAX, Immediate(0));
963 __ adcl(EAX, Immediate(0)); 963 __ adcl(EAX, Immediate(0));
964 __ movl(FieldAddress(EBX, EDX, TIMES_4, TypedData::data_offset()), EAX); 964 __ movl(FieldAddress(EBX, EDX, TIMES_4, TypedData::data_offset()), EAX);
965 965
966 // Restore CTX and return. 966 // Restore CTX and return.
967 __ popl(CTX); 967 __ popl(CTX);
968 // Returning Object::null() is not required, since this method is private. 968 // Returning Object::null() is not required, since this method is private.
(...skipping 11 matching lines...) Expand all
980 ASSERT(CTX == ESI); 980 ASSERT(CTX == ESI);
981 981
982 __ movl(EDI, Address(ESP, 6 * kWordSize)); // digits 982 __ movl(EDI, Address(ESP, 6 * kWordSize)); // digits
983 __ movl(EAX, Address(ESP, 5 * kWordSize)); // used is Smi 983 __ movl(EAX, Address(ESP, 5 * kWordSize)); // used is Smi
984 __ SmiUntag(EAX); // used > 0. 984 __ SmiUntag(EAX); // used > 0.
985 __ movl(ESI, Address(ESP, 4 * kWordSize)); // a_digits 985 __ movl(ESI, Address(ESP, 4 * kWordSize)); // a_digits
986 __ movl(ECX, Address(ESP, 3 * kWordSize)); // a_used is Smi 986 __ movl(ECX, Address(ESP, 3 * kWordSize)); // a_used is Smi
987 __ SmiUntag(ECX); // a_used > 0. 987 __ SmiUntag(ECX); // a_used > 0.
988 __ movl(EBX, Address(ESP, 2 * kWordSize)); // r_digits 988 __ movl(EBX, Address(ESP, 2 * kWordSize)); // r_digits
989 989
990 // Precompute 'used - a_used' now so that CF is not lost later. 990 // Precompute 'used - a_used' now so that carry flag is not lost later.
991 __ subl(EAX, ECX); 991 __ subl(EAX, ECX);
992 __ incl(EAX); // To account for the extra test between loops. 992 __ incl(EAX); // To account for the extra test between loops.
993 __ pushl(EAX); 993 __ pushl(EAX);
994 994
995 __ xorl(EDX, EDX); // EDX = 0, CF = 0. 995 __ xorl(EDX, EDX); // EDX = 0, carry flag = 0.
996 Label sub_loop; 996 Label sub_loop;
997 __ Bind(&sub_loop); 997 __ Bind(&sub_loop);
998 __ movl(EAX, FieldAddress(EDI, EDX, TIMES_4, TypedData::data_offset())); 998 __ movl(EAX, FieldAddress(EDI, EDX, TIMES_4, TypedData::data_offset()));
999 __ sbbl(EAX, FieldAddress(ESI, EDX, TIMES_4, TypedData::data_offset())); 999 __ sbbl(EAX, FieldAddress(ESI, EDX, TIMES_4, TypedData::data_offset()));
1000 __ movl(FieldAddress(EBX, EDX, TIMES_4, TypedData::data_offset()), EAX); 1000 __ movl(FieldAddress(EBX, EDX, TIMES_4, TypedData::data_offset()), EAX);
1001 __ incl(EDX); // Does not affect CF. 1001 __ incl(EDX); // Does not affect carry flag.
1002 __ decl(ECX); // Does not affect CF. 1002 __ decl(ECX); // Does not affect carry flag.
1003 __ j(NOT_ZERO, &sub_loop, Assembler::kNearJump); 1003 __ j(NOT_ZERO, &sub_loop, Assembler::kNearJump);
1004 1004
1005 Label done; 1005 Label done;
1006 __ popl(ECX); 1006 __ popl(ECX);
1007 __ decl(ECX); // Does not affect CF. 1007 __ decl(ECX); // Does not affect carry flag.
1008 __ j(ZERO, &done, Assembler::kNearJump); 1008 __ j(ZERO, &done, Assembler::kNearJump);
1009 1009
1010 Label carry_loop; 1010 Label carry_loop;
1011 __ Bind(&carry_loop); 1011 __ Bind(&carry_loop);
1012 __ movl(EAX, FieldAddress(EDI, EDX, TIMES_4, TypedData::data_offset())); 1012 __ movl(EAX, FieldAddress(EDI, EDX, TIMES_4, TypedData::data_offset()));
1013 __ sbbl(EAX, Immediate(0)); 1013 __ sbbl(EAX, Immediate(0));
1014 __ movl(FieldAddress(EBX, EDX, TIMES_4, TypedData::data_offset()), EAX); 1014 __ movl(FieldAddress(EBX, EDX, TIMES_4, TypedData::data_offset()), EAX);
1015 __ incl(EDX); // Does not affect CF. 1015 __ incl(EDX); // Does not affect carry flag.
1016 __ decl(ECX); // Does not affect CF. 1016 __ decl(ECX); // Does not affect carry flag.
1017 __ j(NOT_ZERO, &carry_loop, Assembler::kNearJump); 1017 __ j(NOT_ZERO, &carry_loop, Assembler::kNearJump);
1018 1018
1019 __ Bind(&done); 1019 __ Bind(&done);
1020 // Restore CTX and return. 1020 // Restore CTX and return.
1021 __ popl(CTX); 1021 __ popl(CTX);
1022 // Returning Object::null() is not required, since this method is private. 1022 // Returning Object::null() is not required, since this method is private.
1023 __ ret(); 1023 __ ret();
1024 } 1024 }
1025 1025
1026 1026
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 Isolate::current_tag_offset()); 2087 Isolate::current_tag_offset());
2088 // Set return value to Isolate::current_tag_. 2088 // Set return value to Isolate::current_tag_.
2089 __ movl(EAX, current_tag_addr); 2089 __ movl(EAX, current_tag_addr);
2090 __ ret(); 2090 __ ret();
2091 } 2091 }
2092 2092
2093 #undef __ 2093 #undef __
2094 } // namespace dart 2094 } // namespace dart
2095 2095
2096 #endif // defined TARGET_ARCH_IA32 2096 #endif // defined TARGET_ARCH_IA32
OLDNEW
« runtime/vm/intrinsifier_arm.cc ('K') | « runtime/vm/intrinsifier_arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698