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