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

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
« no previous file with comments | « runtime/vm/intermediate_language_mips.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) 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) {
3740 __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
3741 } else if ((kind() == MethodRecognizer::kMathCos) ||
3742 (kind() == MethodRecognizer::kMathSin)) {
3743 __ pushq(RAX);
3744 __ movsd(Address(RSP, 0), locs()->in(0).fpu_reg());
3745 __ fldl(Address(RSP, 0));
3746 if (kind() == MethodRecognizer::kMathSin) {
3747 __ fsin();
3748 } else {
3749 ASSERT(kind() == MethodRecognizer::kMathCos);
3750 __ fcos();
3751 }
3752 __ fstpl(Address(RSP, 0));
3753 __ movsd(locs()->out().fpu_reg(), Address(RSP, 0));
3754 __ addq(RSP, Immediate(kWordSize));
3755 return;
3756 } else {
3757 UNREACHABLE();
3758 }
3740 } 3759 }
3741 3760
3742 3761
3743 LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const { 3762 LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const {
3744 const intptr_t kNumInputs = 1; 3763 const intptr_t kNumInputs = 1;
3745 return LocationSummary::Make(kNumInputs, 3764 return LocationSummary::Make(kNumInputs,
3746 Location::SameAsFirstInput(), 3765 Location::SameAsFirstInput(),
3747 LocationSummary::kNoCall); 3766 LocationSummary::kNoCall);
3748 } 3767 }
3749 3768
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
4562 PcDescriptors::kOther, 4581 PcDescriptors::kOther,
4563 locs()); 4582 locs());
4564 __ Drop(2); // Discard type arguments and receiver. 4583 __ Drop(2); // Discard type arguments and receiver.
4565 } 4584 }
4566 4585
4567 } // namespace dart 4586 } // namespace dart
4568 4587
4569 #undef __ 4588 #undef __
4570 4589
4571 #endif // defined TARGET_ARCH_X64 4590 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698