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

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

Issue 9909024: Fix trigonometric intrinsics: if allocation fails remember to release the loaded value on FPU stack. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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/assembler_ia32_test.cc ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 __ Bind(&double_op); 1046 __ Bind(&double_op);
1047 switch (kind) { 1047 switch (kind) {
1048 case kSine: __ fsin(); break; 1048 case kSine: __ fsin(); break;
1049 case kCosine: __ fcos(); break; 1049 case kCosine: __ fcos(); break;
1050 default: 1050 default:
1051 UNREACHABLE(); 1051 UNREACHABLE();
1052 } 1052 }
1053 const Class& double_class = Class::ZoneHandle( 1053 const Class& double_class = Class::ZoneHandle(
1054 Isolate::Current()->object_store()->double_class()); 1054 Isolate::Current()->object_store()->double_class());
1055 __ LoadObject(EBX, double_class); 1055 __ LoadObject(EBX, double_class);
1056 Label alloc_failed;
1056 AssemblerMacros::TryAllocate(assembler, 1057 AssemblerMacros::TryAllocate(assembler,
1057 double_class, 1058 double_class,
1058 EBX, // Class register. 1059 EBX, // Class register.
1059 &fall_through, 1060 &alloc_failed,
1060 EAX); // Result register. 1061 EAX); // Result register.
1061 __ fstpl(FieldAddress(EAX, Double::value_offset())); 1062 __ fstpl(FieldAddress(EAX, Double::value_offset()));
1062 __ ret(); 1063 __ ret();
1063 1064
1064 __ Bind(&is_smi); // smi -> double. 1065 __ Bind(&is_smi); // smi -> double.
1065 __ SmiUntag(EAX); 1066 __ SmiUntag(EAX);
1066 __ pushl(EAX); 1067 __ pushl(EAX);
1067 __ filds(Address(ESP, 0)); 1068 __ filds(Address(ESP, 0));
1068 __ popl(EAX); 1069 __ popl(EAX);
1069 __ jmp(&double_op); 1070 __ jmp(&double_op);
1070 1071
1072 __ Bind(&alloc_failed);
1073 __ ffree(0);
1074 __ fincstp();
1075
1071 __ Bind(&fall_through); 1076 __ Bind(&fall_through);
1072 } 1077 }
1073 1078
1074 1079
1075 static bool Math_sin(Assembler* assembler) { 1080 static bool Math_sin(Assembler* assembler) {
1076 EmitTrigonometric(assembler, kSine); 1081 EmitTrigonometric(assembler, kSine);
1077 return false; // Compile method for slow case. 1082 return false; // Compile method for slow case.
1078 } 1083 }
1079 1084
1080 1085
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 } \ 1302 } \
1298 1303
1299 INTRINSIC_LIST(FIND_INTRINSICS); 1304 INTRINSIC_LIST(FIND_INTRINSICS);
1300 #undef FIND_INTRINSICS 1305 #undef FIND_INTRINSICS
1301 return false; 1306 return false;
1302 } 1307 }
1303 1308
1304 } // namespace dart 1309 } // namespace dart
1305 1310
1306 #endif // defined TARGET_ARCH_IA32 1311 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_ia32_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698