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

Unified Diff: runtime/vm/precompiler.cc

Issue 1371453002: Precompile invoke-field-dispatchers for closures. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months 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/precompiler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/precompiler.cc
diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc
index 317e718af4f6cdeeec634de66b359cf05b098866..1e89986ca2f5191884732b36f76269da4f62ed27 100644
--- a/runtime/vm/precompiler.cc
+++ b/runtime/vm/precompiler.cc
@@ -401,6 +401,10 @@ void Precompiler::AddCalleesOf(const Function& function) {
// A dynamic call.
selector = call_site.target_name();
AddSelector(selector);
+ if (selector.raw() == Symbols::Call().raw()) {
+ // Potential closure call.
+ AddClosureCall(call_site);
+ }
}
} else if (entry.IsField()) {
// Potential need for field initializer.
@@ -416,6 +420,22 @@ void Precompiler::AddCalleesOf(const Function& function) {
}
+void Precompiler::AddClosureCall(const ICData& call_site) {
+ const Array& arguments_descriptor =
+ Array::Handle(Z, call_site.arguments_descriptor());
+ const Type& function_impl =
+ Type::Handle(Z, I->object_store()->function_impl_type());
+ const Class& cache_class =
+ Class::Handle(Z, function_impl.type_class());
+ const Function& dispatcher = Function::Handle(Z,
+ cache_class.GetInvocationDispatcher(Symbols::Call(),
+ arguments_descriptor,
+ RawFunction::kInvokeFieldDispatcher,
+ true /* create_if_absent */));
+ AddFunction(dispatcher);
+}
+
+
void Precompiler::AddField(const Field& field) {
if (field.is_static()) {
// Potential const object. Uninitialized field will harmlessly do a
« no previous file with comments | « runtime/vm/precompiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698