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

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

Issue 1662153002: VM: Support fast calls to atan and atan2 in optimized code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: cleanup Created 4 years, 10 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
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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/constant_propagator.h" 10 #include "vm/constant_propagator.h"
(...skipping 3525 matching lines...) Expand 10 before | Expand all | Expand 10 after
3536 intptr_t InvokeMathCFunctionInstr::ArgumentCountFor( 3536 intptr_t InvokeMathCFunctionInstr::ArgumentCountFor(
3537 MethodRecognizer::Kind kind) { 3537 MethodRecognizer::Kind kind) {
3538 switch (kind) { 3538 switch (kind) {
3539 case MethodRecognizer::kDoubleTruncate: 3539 case MethodRecognizer::kDoubleTruncate:
3540 case MethodRecognizer::kDoubleFloor: 3540 case MethodRecognizer::kDoubleFloor:
3541 case MethodRecognizer::kDoubleCeil: { 3541 case MethodRecognizer::kDoubleCeil: {
3542 ASSERT(!TargetCPUFeatures::double_truncate_round_supported()); 3542 ASSERT(!TargetCPUFeatures::double_truncate_round_supported());
3543 return 1; 3543 return 1;
3544 } 3544 }
3545 case MethodRecognizer::kDoubleRound: 3545 case MethodRecognizer::kDoubleRound:
3546 case MethodRecognizer::kMathAtan:
3546 return 1; 3547 return 1;
3547 case MethodRecognizer::kDoubleMod: 3548 case MethodRecognizer::kDoubleMod:
3548 case MethodRecognizer::kMathDoublePow: 3549 case MethodRecognizer::kMathDoublePow:
3550 case MethodRecognizer::kMathAtan2:
3549 return 2; 3551 return 2;
3550 default: 3552 default:
3551 UNREACHABLE(); 3553 UNREACHABLE();
3552 } 3554 }
3553 return 0; 3555 return 0;
3554 } 3556 }
3555 3557
3556 // Use expected function signatures to help MSVC compiler resolve overloading. 3558 // Use expected function signatures to help MSVC compiler resolve overloading.
3557 typedef double (*UnaryMathCFunction) (double x); 3559 typedef double (*UnaryMathCFunction) (double x);
3558 typedef double (*BinaryMathCFunction) (double x, double y); 3560 typedef double (*BinaryMathCFunction) (double x, double y);
3559 3561
3560 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcPow, 2, true /* is_float */, 3562 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcPow, 2, true /* is_float */,
3561 reinterpret_cast<RuntimeFunction>( 3563 reinterpret_cast<RuntimeFunction>(
3562 static_cast<BinaryMathCFunction>(&pow))); 3564 static_cast<BinaryMathCFunction>(&pow)));
3563 3565
3564 DEFINE_RAW_LEAF_RUNTIME_ENTRY(DartModulo, 2, true /* is_float */, 3566 DEFINE_RAW_LEAF_RUNTIME_ENTRY(DartModulo, 2, true /* is_float */,
3565 reinterpret_cast<RuntimeFunction>( 3567 reinterpret_cast<RuntimeFunction>(
3566 static_cast<BinaryMathCFunction>(&DartModulo))); 3568 static_cast<BinaryMathCFunction>(&DartModulo)));
3567 3569
3570 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcAtan2, 2, true /* is_float */,
3571 reinterpret_cast<RuntimeFunction>(
3572 static_cast<BinaryMathCFunction>(&atan2)));
Vyacheslav Egorov (Google) 2016/02/04 10:30:58 I think this has to call to atan2_ieee to workarou
Florian Schneider 2016/02/04 21:41:49 Yes. Done.
3573
3568 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcFloor, 1, true /* is_float */, 3574 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcFloor, 1, true /* is_float */,
3569 reinterpret_cast<RuntimeFunction>( 3575 reinterpret_cast<RuntimeFunction>(
3570 static_cast<UnaryMathCFunction>(&floor))); 3576 static_cast<UnaryMathCFunction>(&floor)));
3571 3577
3572 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcCeil, 1, true /* is_float */, 3578 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcCeil, 1, true /* is_float */,
3573 reinterpret_cast<RuntimeFunction>( 3579 reinterpret_cast<RuntimeFunction>(
3574 static_cast<UnaryMathCFunction>(&ceil))); 3580 static_cast<UnaryMathCFunction>(&ceil)));
3575 3581
3576 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcTrunc, 1, true /* is_float */, 3582 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcTrunc, 1, true /* is_float */,
3577 reinterpret_cast<RuntimeFunction>( 3583 reinterpret_cast<RuntimeFunction>(
(...skipping 11 matching lines...) Expand all
3589 case MethodRecognizer::kDoubleRound: 3595 case MethodRecognizer::kDoubleRound:
3590 return kLibcRoundRuntimeEntry; 3596 return kLibcRoundRuntimeEntry;
3591 case MethodRecognizer::kDoubleFloor: 3597 case MethodRecognizer::kDoubleFloor:
3592 return kLibcFloorRuntimeEntry; 3598 return kLibcFloorRuntimeEntry;
3593 case MethodRecognizer::kDoubleCeil: 3599 case MethodRecognizer::kDoubleCeil:
3594 return kLibcCeilRuntimeEntry; 3600 return kLibcCeilRuntimeEntry;
3595 case MethodRecognizer::kMathDoublePow: 3601 case MethodRecognizer::kMathDoublePow:
3596 return kLibcPowRuntimeEntry; 3602 return kLibcPowRuntimeEntry;
3597 case MethodRecognizer::kDoubleMod: 3603 case MethodRecognizer::kDoubleMod:
3598 return kDartModuloRuntimeEntry; 3604 return kDartModuloRuntimeEntry;
3605 case MethodRecognizer::kMathAtan:
3606 return kLibcAtanRuntimeEntry;
3607 case MethodRecognizer::kMathAtan2:
3608 return kLibcAtan2RuntimeEntry;
3599 default: 3609 default:
3600 UNREACHABLE(); 3610 UNREACHABLE();
3601 } 3611 }
3602 return kLibcPowRuntimeEntry; 3612 return kLibcPowRuntimeEntry;
3603 } 3613 }
3604 3614
3605 3615
3606 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcCos, 1, true /* is_float */, 3616 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcCos, 1, true /* is_float */,
3607 reinterpret_cast<RuntimeFunction>( 3617 reinterpret_cast<RuntimeFunction>(
3608 static_cast<UnaryMathCFunction>(&cos))); 3618 static_cast<UnaryMathCFunction>(&cos)));
3609 3619
3610 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcSin, 1, true /* is_float */, 3620 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcSin, 1, true /* is_float */,
3611 reinterpret_cast<RuntimeFunction>( 3621 reinterpret_cast<RuntimeFunction>(
3612 static_cast<UnaryMathCFunction>(&sin))); 3622 static_cast<UnaryMathCFunction>(&sin)));
3613 3623
3624 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcAtan, 1, true /* is_float */,
3625 reinterpret_cast<RuntimeFunction>(
3626 static_cast<UnaryMathCFunction>(&atan)));
3614 3627
3615 const RuntimeEntry& MathUnaryInstr::TargetFunction() const { 3628 const RuntimeEntry& MathUnaryInstr::TargetFunction() const {
3616 switch (kind()) { 3629 switch (kind()) {
3617 case MathUnaryInstr::kSin: 3630 case MathUnaryInstr::kSin:
3618 return kLibcSinRuntimeEntry; 3631 return kLibcSinRuntimeEntry;
3619 case MathUnaryInstr::kCos: 3632 case MathUnaryInstr::kCos:
3620 return kLibcCosRuntimeEntry; 3633 return kLibcCosRuntimeEntry;
3621 default: 3634 default:
3622 UNREACHABLE(); 3635 UNREACHABLE();
3623 } 3636 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
3697 set_native_c_function(native_function); 3710 set_native_c_function(native_function);
3698 function().SetIsNativeAutoSetupScope(auto_setup_scope); 3711 function().SetIsNativeAutoSetupScope(auto_setup_scope);
3699 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); 3712 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
3700 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); 3713 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
3701 set_is_bootstrap_native(is_bootstrap_native); 3714 set_is_bootstrap_native(is_bootstrap_native);
3702 } 3715 }
3703 3716
3704 #undef __ 3717 #undef __
3705 3718
3706 } // namespace dart 3719 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698