OLD | NEW |
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 3789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3800 return kLibcAtanRuntimeEntry; | 3800 return kLibcAtanRuntimeEntry; |
3801 case MethodRecognizer::kMathAtan2: | 3801 case MethodRecognizer::kMathAtan2: |
3802 return kLibcAtan2RuntimeEntry; | 3802 return kLibcAtan2RuntimeEntry; |
3803 default: | 3803 default: |
3804 UNREACHABLE(); | 3804 UNREACHABLE(); |
3805 } | 3805 } |
3806 return kLibcPowRuntimeEntry; | 3806 return kLibcPowRuntimeEntry; |
3807 } | 3807 } |
3808 | 3808 |
3809 | 3809 |
3810 const RuntimeEntry& MathUnaryInstr::TargetFunction() const { | |
3811 switch (kind()) { | |
3812 case MathUnaryInstr::kSin: | |
3813 return kLibcSinRuntimeEntry; | |
3814 case MathUnaryInstr::kCos: | |
3815 return kLibcCosRuntimeEntry; | |
3816 default: | |
3817 UNREACHABLE(); | |
3818 } | |
3819 return kLibcSinRuntimeEntry; | |
3820 } | |
3821 | |
3822 | |
3823 const char* MathUnaryInstr::KindToCString(MathUnaryKind kind) { | 3810 const char* MathUnaryInstr::KindToCString(MathUnaryKind kind) { |
3824 switch (kind) { | 3811 switch (kind) { |
3825 case kIllegal: return "illegal"; | 3812 case kIllegal: return "illegal"; |
3826 case kSin: return "sin"; | |
3827 case kCos: return "cos"; | |
3828 case kSqrt: return "sqrt"; | 3813 case kSqrt: return "sqrt"; |
3829 case kDoubleSquare: return "double-square"; | 3814 case kDoubleSquare: return "double-square"; |
3830 } | 3815 } |
3831 UNREACHABLE(); | 3816 UNREACHABLE(); |
3832 return ""; | 3817 return ""; |
3833 } | 3818 } |
3834 | 3819 |
3835 | 3820 |
3836 const RuntimeEntry& CaseInsensitiveCompareUC16Instr::TargetFunction() const { | 3821 const RuntimeEntry& CaseInsensitiveCompareUC16Instr::TargetFunction() const { |
3837 return kCaseInsensitiveCompareUC16RuntimeEntry; | 3822 return kCaseInsensitiveCompareUC16RuntimeEntry; |
3838 } | 3823 } |
3839 | 3824 |
3840 | 3825 |
3841 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, | 3826 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, |
3842 intptr_t deopt_id, | 3827 intptr_t deopt_id, |
3843 MergedMathInstr::Kind kind) | 3828 MergedMathInstr::Kind kind) |
3844 : PureDefinition(deopt_id), | 3829 : PureDefinition(deopt_id), |
3845 inputs_(inputs), | 3830 inputs_(inputs), |
3846 kind_(kind) { | 3831 kind_(kind) { |
3847 ASSERT(inputs_->length() == InputCountFor(kind_)); | 3832 ASSERT(inputs_->length() == InputCountFor(kind_)); |
3848 for (intptr_t i = 0; i < inputs_->length(); ++i) { | 3833 for (intptr_t i = 0; i < inputs_->length(); ++i) { |
3849 ASSERT((*inputs)[i] != NULL); | 3834 ASSERT((*inputs)[i] != NULL); |
3850 (*inputs)[i]->set_instruction(this); | 3835 (*inputs)[i]->set_instruction(this); |
3851 (*inputs)[i]->set_use_index(i); | 3836 (*inputs)[i]->set_use_index(i); |
3852 } | 3837 } |
3853 } | 3838 } |
3854 | 3839 |
3855 | 3840 |
3856 intptr_t MergedMathInstr::OutputIndexOf(intptr_t kind) { | 3841 intptr_t MergedMathInstr::OutputIndexOf(MethodRecognizer::Kind kind) { |
3857 switch (kind) { | 3842 switch (kind) { |
3858 case MathUnaryInstr::kSin: return 1; | 3843 case MethodRecognizer::kMathSin: return 1; |
3859 case MathUnaryInstr::kCos: return 0; | 3844 case MethodRecognizer::kMathCos: return 0; |
3860 default: UNIMPLEMENTED(); return -1; | 3845 default: UNIMPLEMENTED(); return -1; |
3861 } | 3846 } |
3862 } | 3847 } |
3863 | 3848 |
3864 | 3849 |
3865 intptr_t MergedMathInstr::OutputIndexOf(Token::Kind token) { | 3850 intptr_t MergedMathInstr::OutputIndexOf(Token::Kind token) { |
3866 switch (token) { | 3851 switch (token) { |
3867 case Token::kTRUNCDIV: return 0; | 3852 case Token::kTRUNCDIV: return 0; |
3868 case Token::kMOD: return 1; | 3853 case Token::kMOD: return 1; |
3869 default: UNIMPLEMENTED(); return -1; | 3854 default: UNIMPLEMENTED(); return -1; |
(...skipping 22 matching lines...) Expand all Loading... |
3892 set_native_c_function(native_function); | 3877 set_native_c_function(native_function); |
3893 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3878 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
3894 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3879 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
3895 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3880 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
3896 set_is_bootstrap_native(is_bootstrap_native); | 3881 set_is_bootstrap_native(is_bootstrap_native); |
3897 } | 3882 } |
3898 | 3883 |
3899 #undef __ | 3884 #undef __ |
3900 | 3885 |
3901 } // namespace dart | 3886 } // namespace dart |
OLD | NEW |