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

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

Issue 22853009: For trigonometric functions call to C-libraries: they are faster than x87 operations (3% on Box2D). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 #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 3809 matching lines...) Expand 10 before | Expand all | Expand 10 after
3820 break; 3820 break;
3821 case Token::kSUB: 3821 case Token::kSUB:
3822 __ subpl(left, right); 3822 __ subpl(left, right);
3823 break; 3823 break;
3824 default: UNREACHABLE(); 3824 default: UNREACHABLE();
3825 } 3825 }
3826 } 3826 }
3827 3827
3828 3828
3829 LocationSummary* MathUnaryInstr::MakeLocationSummary() const { 3829 LocationSummary* MathUnaryInstr::MakeLocationSummary() const {
3830 if ((kind() == MethodRecognizer::kMathSin) ||
3831 (kind() == MethodRecognizer::kMathCos)) {
3832 const intptr_t kNumInputs = 1;
3833 const intptr_t kNumTemps = 0;
3834 LocationSummary* summary =
3835 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
3836 summary->set_in(0, Location::FpuRegisterLocation(XMM1));
3837 summary->set_out(Location::FpuRegisterLocation(XMM1));
3838 return summary;
3839 }
3830 const intptr_t kNumInputs = 1; 3840 const intptr_t kNumInputs = 1;
3831 const intptr_t kNumTemps = 0; 3841 const intptr_t kNumTemps = 0;
3832 LocationSummary* summary = 3842 LocationSummary* summary =
3833 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3843 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3834 summary->set_in(0, Location::RequiresFpuRegister()); 3844 summary->set_in(0, Location::RequiresFpuRegister());
3835 summary->set_out(Location::RequiresFpuRegister()); 3845 summary->set_out(Location::RequiresFpuRegister());
3836 return summary; 3846 return summary;
3837 } 3847 }
3838 3848
3839 3849
3840 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3850 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3841 if (kind() == MethodRecognizer::kMathSqrt) { 3851 if (kind() == MethodRecognizer::kMathSqrt) {
3842 __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg()); 3852 __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
3843 } else if ((kind() == MethodRecognizer::kMathCos) || 3853 } else {
3844 (kind() == MethodRecognizer::kMathSin)) { 3854 __ EnterFrame(0);
3845 __ pushl(EAX); 3855 __ ReserveAlignedFrameSpace(kDoubleSize * InputCount());
3846 __ pushl(EAX);
3847 __ movsd(Address(ESP, 0), locs()->in(0).fpu_reg()); 3856 __ movsd(Address(ESP, 0), locs()->in(0).fpu_reg());
3848 __ fldl(Address(ESP, 0)); 3857 __ CallRuntime(TargetFunction(), InputCount());
3849 if (kind() == MethodRecognizer::kMathSin) {
3850 __ fsin();
3851 } else {
3852 ASSERT(kind() == MethodRecognizer::kMathCos);
3853 __ fcos();
3854 }
3855 __ fstpl(Address(ESP, 0)); 3858 __ fstpl(Address(ESP, 0));
3856 __ movsd(locs()->out().fpu_reg(), Address(ESP, 0)); 3859 __ movsd(locs()->out().fpu_reg(), Address(ESP, 0));
3857 __ addl(ESP, Immediate(2 * kWordSize)); 3860 __ leave();
3858 } else {
3859 UNREACHABLE();
3860 } 3861 }
3861 } 3862 }
3862 3863
3863 3864
3864 LocationSummary* MathMinMaxInstr::MakeLocationSummary() const { 3865 LocationSummary* MathMinMaxInstr::MakeLocationSummary() const {
3865 if (result_cid() == kDoubleCid) { 3866 if (result_cid() == kDoubleCid) {
3866 const intptr_t kNumInputs = 2; 3867 const intptr_t kNumInputs = 2;
3867 const intptr_t kNumTemps = 1; 3868 const intptr_t kNumTemps = 1;
3868 LocationSummary* summary = 3869 LocationSummary* summary =
3869 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3870 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
5191 PcDescriptors::kOther, 5192 PcDescriptors::kOther,
5192 locs()); 5193 locs());
5193 __ Drop(2); // Discard type arguments and receiver. 5194 __ Drop(2); // Discard type arguments and receiver.
5194 } 5195 }
5195 5196
5196 } // namespace dart 5197 } // namespace dart
5197 5198
5198 #undef __ 5199 #undef __
5199 5200
5200 #endif // defined TARGET_ARCH_IA32 5201 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698