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

Unified Diff: runtime/vm/flow_graph.cc

Issue 2498073004: AOT: Fix bug in receiver type propagation after unique selector calls. (Closed)
Patch Set: address comments Created 4 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/flow_graph.h ('k') | runtime/vm/flow_graph_range_analysis.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph.cc
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
index bcc18fbd9717e79255e99150ea1f92b0105d0ff1..b8e84b56b0814d0eef3598e73588d0c377661b37 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -2056,6 +2056,46 @@ void FlowGraph::TryOptimizePatterns() {
}
+// Returns true if use is dominated by the given instruction.
+// Note: uses that occur at instruction itself are not dominated by it.
+static bool IsDominatedUse(Instruction* dom, Value* use) {
+ BlockEntryInstr* dom_block = dom->GetBlock();
+
+ Instruction* instr = use->instruction();
+
+ PhiInstr* phi = instr->AsPhi();
+ if (phi != NULL) {
+ return dom_block->Dominates(phi->block()->PredecessorAt(use->use_index()));
+ }
+
+ BlockEntryInstr* use_block = instr->GetBlock();
+ if (use_block == dom_block) {
+ // Fast path for the case of block entry.
+ if (dom_block == dom) return true;
+
+ for (Instruction* curr = dom->next(); curr != NULL; curr = curr->next()) {
+ if (curr == instr) return true;
+ }
+
+ return false;
+ }
+
+ return dom_block->Dominates(use_block);
+}
+
+
+void FlowGraph::RenameDominatedUses(Definition* def,
+ Instruction* dom,
+ Definition* other) {
+ for (Value::Iterator it(def->input_use_list()); !it.Done(); it.Advance()) {
+ Value* use = it.Current();
+ if (IsDominatedUse(dom, use)) {
+ use->BindTo(other);
+ }
+ }
+}
+
+
static bool IsPositiveOrZeroSmiConst(Definition* d) {
ConstantInstr* const_instr = d->AsConstant();
if ((const_instr != NULL) && (const_instr->value().IsSmi())) {
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | runtime/vm/flow_graph_range_analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698