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 3951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3962 case Token::kMOD: | 3962 case Token::kMOD: |
3963 return 1; | 3963 return 1; |
3964 default: | 3964 default: |
3965 UNIMPLEMENTED(); | 3965 UNIMPLEMENTED(); |
3966 return -1; | 3966 return -1; |
3967 } | 3967 } |
3968 } | 3968 } |
3969 | 3969 |
3970 | 3970 |
3971 void NativeCallInstr::SetupNative() { | 3971 void NativeCallInstr::SetupNative() { |
| 3972 if (link_lazily()) { |
| 3973 // Resolution will happen during NativeEntry::LinkNativeCall. |
| 3974 return; |
| 3975 } |
| 3976 |
3972 Zone* zone = Thread::Current()->zone(); | 3977 Zone* zone = Thread::Current()->zone(); |
3973 const Class& cls = Class::Handle(zone, function().Owner()); | 3978 const Class& cls = Class::Handle(zone, function().Owner()); |
3974 const Library& library = Library::Handle(zone, cls.library()); | 3979 const Library& library = Library::Handle(zone, cls.library()); |
| 3980 |
| 3981 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
| 3982 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
| 3983 set_is_bootstrap_native(is_bootstrap_native); |
| 3984 |
3975 const int num_params = | 3985 const int num_params = |
3976 NativeArguments::ParameterCountForResolution(function()); | 3986 NativeArguments::ParameterCountForResolution(function()); |
3977 bool auto_setup_scope = true; | 3987 bool auto_setup_scope = true; |
3978 NativeFunction native_function = NativeEntry::ResolveNative( | 3988 NativeFunction native_function = NativeEntry::ResolveNative( |
3979 library, native_name(), num_params, &auto_setup_scope); | 3989 library, native_name(), num_params, &auto_setup_scope); |
3980 if (native_function == NULL) { | 3990 if (native_function == NULL) { |
3981 Report::MessageF(Report::kError, Script::Handle(function().script()), | 3991 Report::MessageF(Report::kError, Script::Handle(function().script()), |
3982 function().token_pos(), Report::AtLocation, | 3992 function().token_pos(), Report::AtLocation, |
3983 "native function '%s' (%" Pd " arguments) cannot be found", | 3993 "native function '%s' (%" Pd " arguments) cannot be found", |
3984 native_name().ToCString(), function().NumParameters()); | 3994 native_name().ToCString(), function().NumParameters()); |
3985 } | 3995 } |
| 3996 set_is_auto_scope(auto_setup_scope); |
3986 set_native_c_function(native_function); | 3997 set_native_c_function(native_function); |
3987 function().SetIsNativeAutoSetupScope(auto_setup_scope); | |
3988 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | |
3989 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | |
3990 set_is_bootstrap_native(is_bootstrap_native); | |
3991 } | 3998 } |
3992 | 3999 |
3993 #undef __ | 4000 #undef __ |
3994 | 4001 |
3995 } // namespace dart | 4002 } // namespace dart |
OLD | NEW |