Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1075)

Unified Diff: runtime/vm/intermediate_language.cc

Issue 1420173006: Move resolving of natives to a late stage (during code emission). That eliminates unnecessary nativ… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: r Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index f063e7dae66ddea337a74b2470f6eab49cd5630f..2293d9c179f4c0b5f400b34f026db30a10d4af37 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -5,6 +5,7 @@
#include "vm/intermediate_language.h"
#include "vm/bit_vector.h"
+#include "vm/bootstrap.h"
#include "vm/compiler.h"
#include "vm/constant_propagator.h"
#include "vm/cpu.h"
@@ -3656,6 +3657,30 @@ intptr_t MergedMathInstr::OutputIndexOf(Token::Kind token) {
}
+void NativeCallInstr::SetupNative() {
+ Zone* Z = Thread::Current()->zone();
+ const Class& cls = Class::Handle(Z, function().Owner());
+ const Library& library = Library::Handle(Z, cls.library());
+ const int num_params =
+ NativeArguments::ParameterCountForResolution(function());
+ bool auto_setup_scope = true;
+ NativeFunction native_function = NativeEntry::ResolveNative(
+ library, native_name(), num_params, &auto_setup_scope);
+ if (native_function == NULL) {
+ Report::MessageF(Report::kError,
+ Script::Handle(function().script()),
+ function().token_pos(),
+ "native function '%s' (%" Pd " arguments) cannot be found",
+ native_name().ToCString(),
+ function().NumParameters());
+ }
+ 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 __
} // namespace dart
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698