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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: Created 3 years, 10 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
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 9ca50407861f25d80bfa09e82cf196ef1b1d42c6..58c89af677be63397259f17ea3af0e6e6beb2957 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -14,6 +14,7 @@
#include "vm/flow_graph_builder.h"
#include "vm/flow_graph_compiler.h"
#include "vm/flow_graph_range_analysis.h"
+#include "vm/jit_optimizer.h"
#include "vm/locations.h"
#include "vm/method_recognizer.h"
#include "vm/object.h"
@@ -3192,6 +3193,26 @@ RawType* PolymorphicInstanceCallInstr::ComputeRuntimeType(
}
+Definition* InstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
+ const intptr_t receiver_cid = PushArgumentAt(0)->value()->Type()->ToCid();
+
+ if (!HasICData()) return this;
+
+ const ICData& new_ic_data =
+ JitOptimizer::TrySpecializeICData(*ic_data(), receiver_cid);
+ if (new_ic_data.raw() == ic_data()->raw()) {
+ // No specialization.
+ return this;
+ }
+
+ const bool with_checks = false;
+ const bool complete = false;
+ PolymorphicInstanceCallInstr* specialized = new PolymorphicInstanceCallInstr(
+ this, new_ic_data, with_checks, complete);
+ return specialized;
+}
+
+
Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
if (!HasSingleRecognizedTarget() || with_checks()) {
return this;

Powered by Google App Engine
This is Rietveld 408576698