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

Unified Diff: runtime/vm/precompiler.cc

Issue 2548943002: VM: Treat dynamic calls consistently in the treeshaker. (Closed)
Patch Set: Created 4 years 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 8d72d929abe6c6db84d12611f4966a5a61782a1d..ce07486c707488878bde0cd3312493e488848a53 100644
--- a/runtime/vm/precompiler.cc
+++ b/runtime/vm/precompiler.cc
@@ -841,31 +841,28 @@ void Precompiler::AddCalleesOf(const Function& function) {
if (pool.InfoAt(i) == ObjectPool::kTaggedObject) {
entry = pool.ObjectAt(i);
if (entry.IsICData()) {
+ // A dynamic call.
call_site ^= entry.raw();
- for (intptr_t j = 0; j < call_site.NumberOfChecks(); j++) {
- target = call_site.GetTargetAt(j);
- AddFunction(target);
- if (!target.is_static()) {
- // Super call (should not enqueue selector) or dynamic call with a
- // CHA prediction (should enqueue selector).
- selector = call_site.target_name();
- AddSelector(selector);
- }
- }
- if (call_site.NumberOfChecks() == 0) {
- // A dynamic call.
- selector = call_site.target_name();
- AddSelector(selector);
- if (selector.raw() == Symbols::Call().raw()) {
- // Potential closure call.
- AddClosureCall(call_site);
- }
+ ASSERT(!call_site.is_static_call());
+ selector = call_site.target_name();
+ AddSelector(selector);
+ if (selector.raw() == Symbols::Call().raw()) {
+ // Potential closure call.
+ const Array& arguments_descriptor =
+ Array::Handle(Z, call_site.arguments_descriptor());
+ AddClosureCall(arguments_descriptor);
}
} else if (entry.IsMegamorphicCache()) {
// A dynamic call.
cache ^= entry.raw();
selector = cache.target_name();
AddSelector(selector);
+ if (selector.raw() == Symbols::Call().raw()) {
+ // Potential closure call.
+ const Array& arguments_descriptor =
+ Array::Handle(Z, cache.arguments_descriptor());
+ AddClosureCall(arguments_descriptor);
+ }
} else if (entry.IsField()) {
// Potential need for field initializer.
field ^= entry.raw();
@@ -1068,9 +1065,7 @@ void Precompiler::AddConstObject(const Instance& instance) {
}
-void Precompiler::AddClosureCall(const ICData& call_site) {
- const Array& arguments_descriptor =
- Array::Handle(Z, call_site.arguments_descriptor());
+void Precompiler::AddClosureCall(const Array& arguments_descriptor) {
const Class& cache_class =
Class::Handle(Z, I->object_store()->closure_class());
const Function& dispatcher = Function::Handle(
« 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