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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 12091091: Move recording of definition used from the value to the definition. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index 4f8c749dbcd83f9a486e5f9babbca7449cb1df29..88f0797328b669936f5c263c33d9f5e943f0c733 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -2239,9 +2239,9 @@ void RangeAnalysis::RenameDominatedUses(Definition* def,
if ((phi != NULL) && !phi->is_alive()) continue;
if (IsDominatedUse(dom, use)) {
- use->RemoveFromInputUseList();
+ use->definition()->RemoveInputUse(use);
use->set_definition(other);
- use->AddToInputUseList();
+ other->AddInputUse(use);
}
}
}
@@ -2317,15 +2317,15 @@ ConstraintInstr* RangeAnalysis::InsertConstraintFor(Definition* defn,
// No need to constrain constants.
if (defn->IsConstant()) return NULL;
- ConstraintInstr* constraint =
- new ConstraintInstr(new Value(defn), constraint_range);
+ Value* value = new Value(defn);
+ ConstraintInstr* constraint = new ConstraintInstr(value, constraint_range);
constraint->InsertAfter(after);
constraint->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index());
RenameDominatedUses(defn, after, constraint);
constraints_.Add(constraint);
- constraint->value()->set_instruction(constraint);
- constraint->value()->set_use_index(0);
- constraint->value()->AddToInputUseList();
+ value->set_instruction(constraint);
+ value->set_use_index(0);
+ defn->AddInputUse(value);
return constraint;
}
@@ -2969,7 +2969,7 @@ void LICM::TryHoistCheckSmiThroughPhi(ForwardInstructionIterator* it,
BlockEntryInstr* header,
BlockEntryInstr* pre_header,
CheckSmiInstr* current) {
- PhiInstr* phi = current->InputAt(0)->definition()->AsPhi();
+ PhiInstr* phi = current->value()->definition()->AsPhi();
if (!header->loop_info()->Contains(phi->block()->preorder_number())) {
return;
}
@@ -3006,9 +3006,9 @@ void LICM::TryHoistCheckSmiThroughPhi(ForwardInstructionIterator* it,
// Replace value we are checking with phi's input. Maintain use lists.
Definition* non_smi_input_defn = phi->InputAt(non_smi_input)->definition();
- current->value()->RemoveFromInputUseList();
+ phi->RemoveInputUse(current->value());
current->value()->set_definition(non_smi_input_defn);
- current->value()->AddToInputUseList();
+ non_smi_input_defn->AddInputUse(current->value());
phi->SetPropagatedCid(kSmiCid);
}
@@ -3541,13 +3541,14 @@ class LoadOptimizer : public ValueObject {
// from the graph by this iteration.
// To prevent using them we additionally mark definitions themselves
// as replaced and store a pointer to the replacement.
- Value* input = new Value((*pred_out_values)[expr_id]->Replacement());
+ Definition* replacement = (*pred_out_values)[expr_id]->Replacement();
+ Value* input = new Value(replacement);
phi->SetInputAt(i, input);
// TODO(vegorov): add a helper function to handle input insertion.
input->set_instruction(phi);
input->set_use_index(i);
- input->AddToInputUseList();
+ replacement->AddInputUse(input);
}
phi->set_ssa_temp_index(graph_->alloc_ssa_temp_index());

Powered by Google App Engine
This is Rietveld 408576698