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

Unified Diff: runtime/vm/parser.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/native_entry.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 748c38d53e86745f00a67f8e4e670f79d90e65fe..8271d481700e33dc8d77611b29f6f0d4df24c8fe 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -7339,39 +7339,20 @@ void Parser::AddFormalParamsToScope(const ParamList* params,
void Parser::ParseNativeFunctionBlock(const ParamList* params,
const Function& func) {
ASSERT(func.is_native());
- TRACE_PARSER("ParseNativeFunctionBlock");
- const Class& cls = Class::Handle(Z, func.Owner());
- const Library& library = Library::Handle(Z, cls.library());
ASSERT(func.NumParameters() == params->parameters->length());
+ TRACE_PARSER("ParseNativeFunctionBlock");
// Parse the function name out.
- const intptr_t native_pos = TokenPos();
const String& native_name = ParseNativeDeclaration();
- // Now resolve the native function to the corresponding native entrypoint.
- const int num_params = NativeArguments::ParameterCountForResolution(func);
- bool auto_setup_scope = true;
- NativeFunction native_function = NativeEntry::ResolveNative(
- library, native_name, num_params, &auto_setup_scope);
- if (native_function == NULL) {
- ReportError(native_pos,
- "native function '%s' (%" Pd " arguments) cannot be found",
- native_name.ToCString(), func.NumParameters());
- }
- func.SetIsNativeAutoSetupScope(auto_setup_scope);
-
// Now add the NativeBodyNode and return statement.
- Dart_NativeEntryResolver resolver = library.native_entry_resolver();
- bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
current_block_->statements->Add(new(Z) ReturnNode(
TokenPos(),
new(Z) NativeBodyNode(
TokenPos(),
Function::ZoneHandle(Z, func.raw()),
native_name,
- native_function,
current_block_->scope,
- is_bootstrap_native,
FLAG_link_natives_lazily)));
}
« no previous file with comments | « runtime/vm/native_entry.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698