When linking natives lazily (as in AOT compilation), don't resolve them eagerly.

Avoids requiring an embedder to setup native stubs for functions that aren't called just to run Dart_Precompile.

Issue #24686

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2779703003 .
This commit is contained in:
Ryan Macnak 2017-03-28 15:29:22 -07:00
parent 483066a697
commit 8df8025f2a

View file

@ -3972,6 +3972,15 @@ void NativeCallInstr::SetupNative() {
Zone* zone = Thread::Current()->zone();
const Class& cls = Class::Handle(zone, function().Owner());
const Library& library = Library::Handle(zone, cls.library());
Dart_NativeEntryResolver resolver = library.native_entry_resolver();
bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
set_is_bootstrap_native(is_bootstrap_native);
if (link_lazily() && !is_bootstrap_native) {
return;
}
const int num_params =
NativeArguments::ParameterCountForResolution(function());
bool auto_setup_scope = true;
@ -3985,9 +3994,6 @@ void NativeCallInstr::SetupNative() {
}
set_native_c_function(native_function);
function().SetIsNativeAutoSetupScope(auto_setup_scope);
Dart_NativeEntryResolver resolver = library.native_entry_resolver();
bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
set_is_bootstrap_native(is_bootstrap_native);
}
#undef __