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

Side by Side Diff: runtime/vm/intermediate_language_x64.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
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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 3706 matching lines...) Expand 10 before | Expand all | Expand 10 after
3717 } 3717 }
3718 case Token::kBIT_XOR: { 3718 case Token::kBIT_XOR: {
3719 __ xorps(left, right); 3719 __ xorps(left, right);
3720 break; 3720 break;
3721 } 3721 }
3722 default: UNREACHABLE(); 3722 default: UNREACHABLE();
3723 } 3723 }
3724 } 3724 }
3725 3725
3726 3726
3727 LocationSummary* MathSqrtInstr::MakeLocationSummary() const { 3727 LocationSummary* MathUnaryInstr::MakeLocationSummary() const {
3728 const intptr_t kNumInputs = 1; 3728 const intptr_t kNumInputs = 1;
3729 const intptr_t kNumTemps = 0; 3729 const intptr_t kNumTemps = 0;
3730 LocationSummary* summary = 3730 LocationSummary* summary =
3731 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3731 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3732 summary->set_in(0, Location::RequiresFpuRegister()); 3732 summary->set_in(0, Location::RequiresFpuRegister());
3733 summary->set_out(Location::RequiresFpuRegister()); 3733 summary->set_out(Location::RequiresFpuRegister());
3734 return summary; 3734 return summary;
3735 } 3735 }
3736 3736
3737 3737
3738 void MathSqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3738 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3739 __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg()); 3739 if (kind() == MethodRecognizer::kMathSqrt) {
Ivan Posva 2013/08/05 23:32:16 ditto
srdjan 2013/08/06 15:43:05 Done.
3740 __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
3741 return;
3742 }
3743
3744 if ((kind() == MethodRecognizer::kMathCos) ||
3745 (kind() == MethodRecognizer::kMathSin)) {
3746 __ pushq(RAX);
3747 __ movsd(Address(RSP, 0), locs()->in(0).fpu_reg());
3748 __ fldl(Address(RSP, 0));
3749 if (kind() == MethodRecognizer::kMathSin) {
3750 __ fsin();
3751 } else {
3752 ASSERT(kind() == MethodRecognizer::kMathCos);
3753 __ fcos();
3754 }
3755 __ fstpl(Address(RSP, 0));
3756 __ movsd(locs()->out().fpu_reg(), Address(RSP, 0));
3757 __ addq(RSP, Immediate(kWordSize));
3758 return;
3759 }
3760 UNREACHABLE();
3740 } 3761 }
3741 3762
3742 3763
3743 LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const { 3764 LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const {
3744 const intptr_t kNumInputs = 1; 3765 const intptr_t kNumInputs = 1;
3745 return LocationSummary::Make(kNumInputs, 3766 return LocationSummary::Make(kNumInputs,
3746 Location::SameAsFirstInput(), 3767 Location::SameAsFirstInput(),
3747 LocationSummary::kNoCall); 3768 LocationSummary::kNoCall);
3748 } 3769 }
3749 3770
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
4562 PcDescriptors::kOther, 4583 PcDescriptors::kOther,
4563 locs()); 4584 locs());
4564 __ Drop(2); // Discard type arguments and receiver. 4585 __ Drop(2); // Discard type arguments and receiver.
4565 } 4586 }
4566 4587
4567 } // namespace dart 4588 } // namespace dart
4568 4589
4569 #undef __ 4590 #undef __
4570 4591
4571 #endif // defined TARGET_ARCH_X64 4592 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/intermediate_language_mips.cc ('K') | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698