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

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

Issue 22266005: Inline fsin/fcos. Huge speedup on Box2D. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.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) 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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 3665 matching lines...) Expand 10 before | Expand all | Expand 10 after
3676 } 3676 }
3677 case Token::kBIT_XOR: { 3677 case Token::kBIT_XOR: {
3678 __ xorps(left, right); 3678 __ xorps(left, right);
3679 break; 3679 break;
3680 } 3680 }
3681 default: UNREACHABLE(); 3681 default: UNREACHABLE();
3682 } 3682 }
3683 } 3683 }
3684 3684
3685 3685
3686 LocationSummary* MathSqrtInstr::MakeLocationSummary() const { 3686 LocationSummary* MathUnaryInstr::MakeLocationSummary() const {
3687 const intptr_t kNumInputs = 1; 3687 const intptr_t kNumInputs = 1;
3688 const intptr_t kNumTemps = 0; 3688 const intptr_t kNumTemps = 0;
3689 LocationSummary* summary = 3689 LocationSummary* summary =
3690 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3690 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3691 summary->set_in(0, Location::RequiresFpuRegister()); 3691 summary->set_in(0, Location::RequiresFpuRegister());
3692 summary->set_out(Location::RequiresFpuRegister()); 3692 summary->set_out(Location::RequiresFpuRegister());
3693 return summary; 3693 return summary;
3694 } 3694 }
3695 3695
3696 3696
3697 void MathSqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3697 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3698 __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg()); 3698 if (kind() == MethodRecognizer::kMathSqrt) {
3699 __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
3700 } else if ((kind() == MethodRecognizer::kMathCos) ||
3701 (kind() == MethodRecognizer::kMathSin)) {
3702 __ pushl(EAX);
3703 __ pushl(EAX);
3704 __ movsd(Address(ESP, 0), locs()->in(0).fpu_reg());
3705 __ fldl(Address(ESP, 0));
3706 if (kind() == MethodRecognizer::kMathSin) {
3707 __ fsin();
3708 } else {
3709 ASSERT(kind() == MethodRecognizer::kMathCos);
3710 __ fcos();
3711 }
3712 __ fstpl(Address(ESP, 0));
3713 __ movsd(locs()->out().fpu_reg(), Address(ESP, 0));
3714 __ addl(ESP, Immediate(2 * kWordSize));
3715 } else {
3716 UNREACHABLE();
3717 }
3699 } 3718 }
3700 3719
3701 3720
3702 LocationSummary* MathMinMaxInstr::MakeLocationSummary() const { 3721 LocationSummary* MathMinMaxInstr::MakeLocationSummary() const {
3703 if (result_cid() == kDoubleCid) { 3722 if (result_cid() == kDoubleCid) {
3704 const intptr_t kNumInputs = 2; 3723 const intptr_t kNumInputs = 2;
3705 const intptr_t kNumTemps = 1; 3724 const intptr_t kNumTemps = 1;
3706 LocationSummary* summary = 3725 LocationSummary* summary =
3707 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3726 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3708 summary->set_in(0, Location::RequiresFpuRegister()); 3727 summary->set_in(0, Location::RequiresFpuRegister());
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
4929 PcDescriptors::kOther, 4948 PcDescriptors::kOther,
4930 locs()); 4949 locs());
4931 __ Drop(2); // Discard type arguments and receiver. 4950 __ Drop(2); // Discard type arguments and receiver.
4932 } 4951 }
4933 4952
4934 } // namespace dart 4953 } // namespace dart
4935 4954
4936 #undef __ 4955 #undef __
4937 4956
4938 #endif // defined TARGET_ARCH_IA32 4957 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698