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

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

Issue 1670113004: VM: Optimized calls to asin, acos, tan. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/method_recognizer.h » ('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/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 3526 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 case MethodRecognizer::kMathAtan:
3547 case MethodRecognizer::kMathTan:
3548 case MethodRecognizer::kMathAcos:
3549 case MethodRecognizer::kMathAsin:
3547 return 1; 3550 return 1;
3548 case MethodRecognizer::kDoubleMod: 3551 case MethodRecognizer::kDoubleMod:
3549 case MethodRecognizer::kMathDoublePow: 3552 case MethodRecognizer::kMathDoublePow:
3550 case MethodRecognizer::kMathAtan2: 3553 case MethodRecognizer::kMathAtan2:
3551 return 2; 3554 return 2;
3552 default: 3555 default:
3553 UNREACHABLE(); 3556 UNREACHABLE();
3554 } 3557 }
3555 return 0; 3558 return 0;
3556 } 3559 }
(...skipping 23 matching lines...) Expand all
3580 static_cast<UnaryMathCFunction>(&ceil))); 3583 static_cast<UnaryMathCFunction>(&ceil)));
3581 3584
3582 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcTrunc, 1, true /* is_float */, 3585 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcTrunc, 1, true /* is_float */,
3583 reinterpret_cast<RuntimeFunction>( 3586 reinterpret_cast<RuntimeFunction>(
3584 static_cast<UnaryMathCFunction>(&trunc))); 3587 static_cast<UnaryMathCFunction>(&trunc)));
3585 3588
3586 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcRound, 1, true /* is_float */, 3589 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcRound, 1, true /* is_float */,
3587 reinterpret_cast<RuntimeFunction>( 3590 reinterpret_cast<RuntimeFunction>(
3588 static_cast<UnaryMathCFunction>(&round))); 3591 static_cast<UnaryMathCFunction>(&round)));
3589 3592
3593 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcCos, 1, true /* is_float */,
3594 reinterpret_cast<RuntimeFunction>(
3595 static_cast<UnaryMathCFunction>(&cos)));
3596
3597 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcSin, 1, true /* is_float */,
3598 reinterpret_cast<RuntimeFunction>(
3599 static_cast<UnaryMathCFunction>(&sin)));
3600
3601 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcAsin, 1, true /* is_float */,
3602 reinterpret_cast<RuntimeFunction>(
3603 static_cast<UnaryMathCFunction>(&asin)));
3604
3605 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcAcos, 1, true /* is_float */,
3606 reinterpret_cast<RuntimeFunction>(
3607 static_cast<UnaryMathCFunction>(&acos)));
3608
3609 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcTan, 1, true /* is_float */,
3610 reinterpret_cast<RuntimeFunction>(
3611 static_cast<UnaryMathCFunction>(&tan)));
3612
3613 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcAtan, 1, true /* is_float */,
3614 reinterpret_cast<RuntimeFunction>(
3615 static_cast<UnaryMathCFunction>(&atan)));
3616
3590 3617
3591 const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const { 3618 const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const {
3592 switch (recognized_kind_) { 3619 switch (recognized_kind_) {
3593 case MethodRecognizer::kDoubleTruncate: 3620 case MethodRecognizer::kDoubleTruncate:
3594 return kLibcTruncRuntimeEntry; 3621 return kLibcTruncRuntimeEntry;
3595 case MethodRecognizer::kDoubleRound: 3622 case MethodRecognizer::kDoubleRound:
3596 return kLibcRoundRuntimeEntry; 3623 return kLibcRoundRuntimeEntry;
3597 case MethodRecognizer::kDoubleFloor: 3624 case MethodRecognizer::kDoubleFloor:
3598 return kLibcFloorRuntimeEntry; 3625 return kLibcFloorRuntimeEntry;
3599 case MethodRecognizer::kDoubleCeil: 3626 case MethodRecognizer::kDoubleCeil:
3600 return kLibcCeilRuntimeEntry; 3627 return kLibcCeilRuntimeEntry;
3601 case MethodRecognizer::kMathDoublePow: 3628 case MethodRecognizer::kMathDoublePow:
3602 return kLibcPowRuntimeEntry; 3629 return kLibcPowRuntimeEntry;
3603 case MethodRecognizer::kDoubleMod: 3630 case MethodRecognizer::kDoubleMod:
3604 return kDartModuloRuntimeEntry; 3631 return kDartModuloRuntimeEntry;
3632 case MethodRecognizer::kMathTan:
3633 return kLibcTanRuntimeEntry;
3634 case MethodRecognizer::kMathAsin:
3635 return kLibcAsinRuntimeEntry;
3636 case MethodRecognizer::kMathAcos:
3637 return kLibcAcosRuntimeEntry;
3605 case MethodRecognizer::kMathAtan: 3638 case MethodRecognizer::kMathAtan:
3606 return kLibcAtanRuntimeEntry; 3639 return kLibcAtanRuntimeEntry;
3607 case MethodRecognizer::kMathAtan2: 3640 case MethodRecognizer::kMathAtan2:
3608 return kLibcAtan2RuntimeEntry; 3641 return kLibcAtan2RuntimeEntry;
3609 default: 3642 default:
3610 UNREACHABLE(); 3643 UNREACHABLE();
3611 } 3644 }
3612 return kLibcPowRuntimeEntry; 3645 return kLibcPowRuntimeEntry;
3613 } 3646 }
3614 3647
3615 3648
3616 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcCos, 1, true /* is_float */,
3617 reinterpret_cast<RuntimeFunction>(
3618 static_cast<UnaryMathCFunction>(&cos)));
3619
3620 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcSin, 1, true /* is_float */,
3621 reinterpret_cast<RuntimeFunction>(
3622 static_cast<UnaryMathCFunction>(&sin)));
3623
3624 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcAtan, 1, true /* is_float */,
3625 reinterpret_cast<RuntimeFunction>(
3626 static_cast<UnaryMathCFunction>(&atan)));
3627
3628 const RuntimeEntry& MathUnaryInstr::TargetFunction() const { 3649 const RuntimeEntry& MathUnaryInstr::TargetFunction() const {
3629 switch (kind()) { 3650 switch (kind()) {
3630 case MathUnaryInstr::kSin: 3651 case MathUnaryInstr::kSin:
3631 return kLibcSinRuntimeEntry; 3652 return kLibcSinRuntimeEntry;
3632 case MathUnaryInstr::kCos: 3653 case MathUnaryInstr::kCos:
3633 return kLibcCosRuntimeEntry; 3654 return kLibcCosRuntimeEntry;
3634 default: 3655 default:
3635 UNREACHABLE(); 3656 UNREACHABLE();
3636 } 3657 }
3637 return kLibcSinRuntimeEntry; 3658 return kLibcSinRuntimeEntry;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
3710 set_native_c_function(native_function); 3731 set_native_c_function(native_function);
3711 function().SetIsNativeAutoSetupScope(auto_setup_scope); 3732 function().SetIsNativeAutoSetupScope(auto_setup_scope);
3712 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); 3733 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
3713 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); 3734 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
3714 set_is_bootstrap_native(is_bootstrap_native); 3735 set_is_bootstrap_native(is_bootstrap_native);
3715 } 3736 }
3716 3737
3717 #undef __ 3738 #undef __
3718 3739
3719 } // namespace dart 3740 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/method_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698