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

Unified Diff: runtime/vm/aot_optimizer.cc

Issue 2740973003: AOT: Use propagated type when specializing single target calls. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/aot_optimizer.cc
diff --git a/runtime/vm/aot_optimizer.cc b/runtime/vm/aot_optimizer.cc
index 1ff277f486325b70647c3f4524f874442f104834..944a9b43b8c2971ddaa3f2f1eeaf537a254ada5d 100644
--- a/runtime/vm/aot_optimizer.cc
+++ b/runtime/vm/aot_optimizer.cc
@@ -1833,11 +1833,23 @@ void AotOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
Definition* callee_receiver = instr->ArgumentAt(0);
const Function& function = flow_graph_->function();
+ Class& receiver_class = Class::Handle(Z);
+
if (function.IsDynamicFunction() &&
flow_graph_->IsReceiver(callee_receiver)) {
// Call receiver is method receiver.
- Class& receiver_class = Class::Handle(Z, function.Owner());
-
+ receiver_class = function.Owner();
+ } else {
+ CompileType* type = instr->ArgumentAt(0)->Type();
+ if (type->ToAbstractType()->IsType() &&
+ !type->ToAbstractType()->IsDynamicType() && !type->is_nullable()) {
+ receiver_class = type->ToAbstractType()->type_class();
+ if (receiver_class.is_implemented()) {
+ receiver_class = Class::null();
+ }
+ }
+ }
+ if (!receiver_class.IsNull()) {
GrowableArray<intptr_t> class_ids(6);
if (thread()->cha()->ConcreteSubclasses(receiver_class, &class_ids)) {
// First check if all subclasses end up calling the same method.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698