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

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

Issue 509153003: New bigint implementation in the vm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 __ xorl(EAX, ECX); 1046 __ xorl(EAX, ECX);
1047 // BSR does not write the destination register if source is zero. Put a 1 in 1047 // BSR does not write the destination register if source is zero. Put a 1 in
1048 // the Smi tag bit to ensure BSR writes to destination register. 1048 // the Smi tag bit to ensure BSR writes to destination register.
1049 __ orl(EAX, Immediate(kSmiTagMask)); 1049 __ orl(EAX, Immediate(kSmiTagMask));
1050 __ bsrl(EAX, EAX); 1050 __ bsrl(EAX, EAX);
1051 __ SmiTag(EAX); 1051 __ SmiTag(EAX);
1052 __ ret(); 1052 __ ret();
1053 } 1053 }
1054 1054
1055 1055
1056 void Intrinsifier::Bigint_getNeg(Assembler* assembler) {
1057 __ movl(EAX, Address(ESP, + 1 * kWordSize));
1058 __ movl(EAX, FieldAddress(EAX, Bigint::neg_offset()));
1059 __ ret();
1060 }
1061
1062
1063 void Intrinsifier::Bigint_setNeg(Assembler* assembler) {
1064 __ movl(EAX, Address(ESP, + 1 * kWordSize));
1065 __ movl(ECX, Address(ESP, + 2 * kWordSize));
1066 __ StoreIntoObject(ECX, FieldAddress(ECX, Bigint::neg_offset()), EAX, false);
1067 __ ret();
1068 }
1069
1070
1071 void Intrinsifier::Bigint_getUsed(Assembler* assembler) {
1072 __ movl(EAX, Address(ESP, + 1 * kWordSize));
1073 __ movl(EAX, FieldAddress(EAX, Bigint::used_offset()));
1074 __ ret();
1075 }
1076
1077
1078 void Intrinsifier::Bigint_setUsed(Assembler* assembler) {
1079 __ movl(EAX, Address(ESP, + 1 * kWordSize));
1080 __ movl(ECX, Address(ESP, + 2 * kWordSize));
1081 __ StoreIntoObject(ECX, FieldAddress(ECX, Bigint::used_offset()), EAX);
1082 __ ret();
1083 }
1084
1085
1086 void Intrinsifier::Bigint_getDigits(Assembler* assembler) {
1087 __ movl(EAX, Address(ESP, + 1 * kWordSize));
1088 __ movl(EAX, FieldAddress(EAX, Bigint::digits_offset()));
1089 __ ret();
1090 }
1091
1092
1093 void Intrinsifier::Bigint_setDigits(Assembler* assembler) {
1094 __ movl(EAX, Address(ESP, + 1 * kWordSize));
1095 __ movl(ECX, Address(ESP, + 2 * kWordSize));
1096 __ StoreIntoObject(ECX,
1097 FieldAddress(ECX, Bigint::digits_offset()), EAX, false);
1098 __ ret();
1099 }
1100
1101
1056 // Check if the last argument is a double, jump to label 'is_smi' if smi 1102 // Check if the last argument is a double, jump to label 'is_smi' if smi
1057 // (easy to convert to double), otherwise jump to label 'not_double_smi', 1103 // (easy to convert to double), otherwise jump to label 'not_double_smi',
1058 // Returns the last argument in EAX. 1104 // Returns the last argument in EAX.
1059 static void TestLastArgumentIsDouble(Assembler* assembler, 1105 static void TestLastArgumentIsDouble(Assembler* assembler,
1060 Label* is_smi, 1106 Label* is_smi,
1061 Label* not_double_smi) { 1107 Label* not_double_smi) {
1062 __ movl(EAX, Address(ESP, + 1 * kWordSize)); 1108 __ movl(EAX, Address(ESP, + 1 * kWordSize));
1063 __ testl(EAX, Immediate(kSmiTagMask)); 1109 __ testl(EAX, Immediate(kSmiTagMask));
1064 __ j(ZERO, is_smi, Assembler::kNearJump); // Jump if Smi. 1110 __ j(ZERO, is_smi, Assembler::kNearJump); // Jump if Smi.
1065 __ CompareClassId(EAX, kDoubleCid, EBX); 1111 __ CompareClassId(EAX, kDoubleCid, EBX);
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 Isolate::current_tag_offset()); 1836 Isolate::current_tag_offset());
1791 // Set return value to Isolate::current_tag_. 1837 // Set return value to Isolate::current_tag_.
1792 __ movl(EAX, current_tag_addr); 1838 __ movl(EAX, current_tag_addr);
1793 __ ret(); 1839 __ ret();
1794 } 1840 }
1795 1841
1796 #undef __ 1842 #undef __
1797 } // namespace dart 1843 } // namespace dart
1798 1844
1799 #endif // defined TARGET_ARCH_IA32 1845 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698