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

Unified Diff: runtime/vm/native_entry.cc

Issue 1412633007: Save the native name on the function instead of finding it in the token stream for lazily-linked na… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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/compiler.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/native_entry.cc
diff --git a/runtime/vm/native_entry.cc b/runtime/vm/native_entry.cc
index 63c9a61a185036241fb5689ec9cf3bfcc2f6b938..adedfb78914f4555036492b085899939b56926ab 100644
--- a/runtime/vm/native_entry.cc
+++ b/runtime/vm/native_entry.cc
@@ -129,33 +129,17 @@ void NativeEntry::NativeCallWrapper(Dart_NativeArguments args,
}
-static bool IsNativeKeyword(const TokenStream::Iterator& it) {
- return Token::IsIdentifier(it.CurrentTokenKind()) &&
- (it.CurrentLiteral() == Symbols::Native().raw());
-}
-
-
static NativeFunction ResolveNativeFunction(Zone* zone,
const Function& func,
bool* is_bootstrap_native) {
- const Script& script = Script::Handle(zone, func.script());
const Class& cls = Class::Handle(zone, func.Owner());
const Library& library = Library::Handle(zone, cls.library());
*is_bootstrap_native =
Bootstrap::IsBootstapResolver(library.native_entry_resolver());
- TokenStream::Iterator it(TokenStream::Handle(zone, script.tokens()),
- func.token_pos());
-
- const intptr_t end_pos = func.end_token_pos();
- while (!IsNativeKeyword(it) && it.CurrentPosition() <= end_pos) {
- it.Advance();
- }
- ASSERT(IsNativeKeyword(it));
- it.Advance();
- ASSERT(it.CurrentTokenKind() == Token::kSTRING);
- const String& native_name = String::Handle(it.CurrentLiteral());
+ const String& native_name = String::Handle(zone, func.native_name());
+ ASSERT(!native_name.IsNull());
const int num_params = NativeArguments::ParameterCountForResolution(func);
bool auto_setup_scope = true;
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698