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 3696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3707 intptr_t MergedMathInstr::OutputIndexOf(Token::Kind token) { | 3707 intptr_t MergedMathInstr::OutputIndexOf(Token::Kind token) { |
3708 switch (token) { | 3708 switch (token) { |
3709 case Token::kTRUNCDIV: return 0; | 3709 case Token::kTRUNCDIV: return 0; |
3710 case Token::kMOD: return 1; | 3710 case Token::kMOD: return 1; |
3711 default: UNIMPLEMENTED(); return -1; | 3711 default: UNIMPLEMENTED(); return -1; |
3712 } | 3712 } |
3713 } | 3713 } |
3714 | 3714 |
3715 | 3715 |
3716 void NativeCallInstr::SetupNative() { | 3716 void NativeCallInstr::SetupNative() { |
3717 Zone* Z = Thread::Current()->zone(); | 3717 Zone* zone = Thread::Current()->zone(); |
3718 const Class& cls = Class::Handle(Z, function().Owner()); | 3718 const Class& cls = Class::Handle(zone, function().Owner()); |
3719 const Library& library = Library::Handle(Z, cls.library()); | 3719 const Library& library = Library::Handle(zone, cls.library()); |
3720 const int num_params = | 3720 const int num_params = |
3721 NativeArguments::ParameterCountForResolution(function()); | 3721 NativeArguments::ParameterCountForResolution(function()); |
3722 bool auto_setup_scope = true; | 3722 bool auto_setup_scope = true; |
3723 NativeFunction native_function = NativeEntry::ResolveNative( | 3723 NativeFunction native_function = NativeEntry::ResolveNative( |
3724 library, native_name(), num_params, &auto_setup_scope); | 3724 library, native_name(), num_params, &auto_setup_scope); |
3725 if (native_function == NULL) { | 3725 if (native_function == NULL) { |
3726 Report::MessageF(Report::kError, | 3726 Report::MessageF(Report::kError, |
3727 Script::Handle(function().script()), | 3727 Script::Handle(function().script()), |
3728 function().token_pos(), | 3728 function().token_pos(), |
3729 Report::AtLocation, | 3729 Report::AtLocation, |
3730 "native function '%s' (%" Pd " arguments) cannot be found", | 3730 "native function '%s' (%" Pd " arguments) cannot be found", |
3731 native_name().ToCString(), | 3731 native_name().ToCString(), |
3732 function().NumParameters()); | 3732 function().NumParameters()); |
3733 } | 3733 } |
3734 set_native_c_function(native_function); | 3734 set_native_c_function(native_function); |
3735 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3735 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
3736 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3736 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
3737 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3737 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
3738 set_is_bootstrap_native(is_bootstrap_native); | 3738 set_is_bootstrap_native(is_bootstrap_native); |
3739 } | 3739 } |
3740 | 3740 |
3741 #undef __ | 3741 #undef __ |
3742 | 3742 |
3743 } // namespace dart | 3743 } // namespace dart |
OLD | NEW |