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

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

Issue 8866010: Fix for intrinsified Math.sqrt method, added test. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | « no previous file | tests/language/src/IntrinsifiedMethodsTest.dart » ('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) 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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); 689 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset()));
690 switch (kind) { 690 switch (kind) {
691 case Token::kADD: __ addsd(XMM0, XMM1); break; 691 case Token::kADD: __ addsd(XMM0, XMM1); break;
692 case Token::kSUB: __ subsd(XMM0, XMM1); break; 692 case Token::kSUB: __ subsd(XMM0, XMM1); break;
693 case Token::kMUL: __ mulsd(XMM0, XMM1); break; 693 case Token::kMUL: __ mulsd(XMM0, XMM1); break;
694 case Token::kDIV: __ divsd(XMM0, XMM1); break; 694 case Token::kDIV: __ divsd(XMM0, XMM1); break;
695 default: UNREACHABLE(); 695 default: UNREACHABLE();
696 } 696 }
697 const Class& double_class = Class::ZoneHandle( 697 const Class& double_class = Class::ZoneHandle(
698 Isolate::Current()->object_store()->double_class()); 698 Isolate::Current()->object_store()->double_class());
699 __ LoadObject(EBX, double_class);
699 AssemblerMacros::TryAllocate(assembler, 700 AssemblerMacros::TryAllocate(assembler,
700 double_class, 701 double_class,
701 EBX, // Class register. 702 EBX, // Class register.
702 &fall_through, 703 &fall_through,
703 EAX); // Result register. 704 EAX); // Result register.
704 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); 705 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0);
705 __ ret(); 706 __ ret();
706 __ Bind(&fall_through); 707 __ Bind(&fall_through);
707 return false; 708 return false;
708 } 709 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 // Argument type is not known 783 // Argument type is not known
783 static bool Math_sqrt(Assembler* assembler) { 784 static bool Math_sqrt(Assembler* assembler) {
784 Label fall_through, is_smi, double_op; 785 Label fall_through, is_smi, double_op;
785 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); 786 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through);
786 // Argument is double and is in EAX, class in EBX. 787 // Argument is double and is in EAX, class in EBX.
787 __ movsd(XMM1, FieldAddress(EAX, Double::value_offset())); 788 __ movsd(XMM1, FieldAddress(EAX, Double::value_offset()));
788 __ Bind(&double_op); 789 __ Bind(&double_op);
789 __ sqrtsd(XMM0, XMM1); 790 __ sqrtsd(XMM0, XMM1);
790 const Class& double_class = Class::ZoneHandle( 791 const Class& double_class = Class::ZoneHandle(
791 Isolate::Current()->object_store()->double_class()); 792 Isolate::Current()->object_store()->double_class());
793 __ LoadObject(EBX, double_class);
792 AssemblerMacros::TryAllocate(assembler, 794 AssemblerMacros::TryAllocate(assembler,
793 double_class, 795 double_class,
794 EBX, // Class register. 796 EBX, // Class register.
795 &fall_through, 797 &fall_through,
796 EAX); // Result register. 798 EAX); // Result register.
797 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); 799 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0);
798 __ ret(); 800 __ ret();
799 __ Bind(&is_smi); 801 __ Bind(&is_smi);
800 __ SmiUntag(EAX); 802 __ SmiUntag(EAX);
801 __ cvtsi2sd(XMM1, EAX); 803 __ cvtsi2sd(XMM1, EAX);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 } \ 981 } \
980 982
981 INTRINSIC_LIST(FIND_INTRINSICS); 983 INTRINSIC_LIST(FIND_INTRINSICS);
982 #undef FIND_INTRINSICS 984 #undef FIND_INTRINSICS
983 return false; 985 return false;
984 } 986 }
985 987
986 } // namespace dart 988 } // namespace dart
987 989
988 #endif // defined TARGET_ARCH_IA32 990 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | tests/language/src/IntrinsifiedMethodsTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698