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 10914142: Intrinsify Double.toInt. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_x64.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 __ Bind(&is_zero); 1162 __ Bind(&is_zero);
1163 // Check for negative zero (get the sign bit). 1163 // Check for negative zero (get the sign bit).
1164 __ movmskpd(EAX, XMM0); 1164 __ movmskpd(EAX, XMM0);
1165 __ testl(EAX, Immediate(1)); 1165 __ testl(EAX, Immediate(1));
1166 __ j(NOT_ZERO, &is_true, Assembler::kNearJump); 1166 __ j(NOT_ZERO, &is_true, Assembler::kNearJump);
1167 __ jmp(&is_false, Assembler::kNearJump); 1167 __ jmp(&is_false, Assembler::kNearJump);
1168 return true; // Method is complete, no slow case. 1168 return true; // Method is complete, no slow case.
1169 } 1169 }
1170 1170
1171 1171
1172 bool Intrinsifier::Double_toInt(Assembler* assembler) {
1173 __ movl(EAX, Address(ESP, +1 * kWordSize));
1174 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset()));
1175 __ cvttsd2si(EAX, XMM0);
1176 // Overflow is signalled with minint.
1177 Label fall_through;
1178 // Check for overflow and that it fits into Smi.
1179 __ cmpl(EAX, Immediate(0xC0000000));
1180 __ j(NEGATIVE, &fall_through, Assembler::kNearJump);
1181 __ SmiTag(EAX);
1182 __ ret();
1183 __ Bind(&fall_through);
1184 return false;
1185 }
1186
1187
1172 // Argument type is not known 1188 // Argument type is not known
1173 bool Intrinsifier::Math_sqrt(Assembler* assembler) { 1189 bool Intrinsifier::Math_sqrt(Assembler* assembler) {
1174 Label fall_through, is_smi, double_op; 1190 Label fall_through, is_smi, double_op;
1175 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); 1191 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through);
1176 // Argument is double and is in EAX. 1192 // Argument is double and is in EAX.
1177 __ movsd(XMM1, FieldAddress(EAX, Double::value_offset())); 1193 __ movsd(XMM1, FieldAddress(EAX, Double::value_offset()));
1178 __ Bind(&double_op); 1194 __ Bind(&double_op);
1179 __ sqrtsd(XMM0, XMM1); 1195 __ sqrtsd(XMM0, XMM1);
1180 const Class& double_class = Class::Handle( 1196 const Class& double_class = Class::Handle(
1181 Isolate::Current()->object_store()->double_class()); 1197 Isolate::Current()->object_store()->double_class());
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 __ Bind(&is_true); 1423 __ Bind(&is_true);
1408 __ LoadObject(EAX, bool_true); 1424 __ LoadObject(EAX, bool_true);
1409 __ ret(); 1425 __ ret();
1410 return true; 1426 return true;
1411 } 1427 }
1412 1428
1413 #undef __ 1429 #undef __
1414 } // namespace dart 1430 } // namespace dart
1415 1431
1416 #endif // defined TARGET_ARCH_IA32 1432 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698