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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 10879036: Compute the def-use list on-demand by walking the dominator tree. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 250db29bc0f90df213cd3d233fe1f33abe37effb..51ec2e1270ef79cbfaebfdbfa48435a8b2304f6c 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -73,20 +73,6 @@ bool CheckClassComp::AttributesEqual(Computation* other) const {
}
-UseVal::UseVal(Definition* definition)
- : definition_(definition), next_use_(NULL), previous_use_(NULL) {
- AddToUseList();
-}
-
-
-void UseVal::SetDefinition(Definition* definition) {
- ASSERT(definition != NULL);
- RemoveFromUseList();
- definition_ = definition;
- AddToUseList();
-}
-
-
// Returns true if the value represents a constant.
bool UseVal::BindsToConstant() const {
BindInstr* bind = definition()->AsBind();
@@ -121,34 +107,6 @@ const Object& UseVal::BoundConstant() const {
}
-void UseVal::RemoveFromUseList() {
- ASSERT(definition_ != NULL);
- if (next_use_ != NULL) {
- next_use_->previous_use_ = previous_use_;
- }
- if (previous_use_ != NULL) {
- previous_use_->next_use_ = next_use_;
- } else {
- // This is the head of the list.
- ASSERT(definition_->use_list() == this);
- definition_->set_use_list(next_use_);
- }
- previous_use_ = next_use_ = NULL;
- definition_ = NULL;
-}
-
-
-void UseVal::AddToUseList() {
- ASSERT(next_use_ == NULL && previous_use_ == NULL && definition_ != NULL);
- UseVal* head = definition_->use_list();
- if (head != NULL) {
- next_use_ = head;
- head->previous_use_ = this;
- }
- definition_->set_use_list(this);
-}
-
-
MethodRecognizer::Kind MethodRecognizer::RecognizeKind(
const Function& function) {
// Only core and math library methods can be recognized.
@@ -226,7 +184,6 @@ Instruction* Instruction::RemoveFromGraph(bool return_previous) {
// that the instruction is removed from the graph.
set_previous(NULL);
set_next(NULL);
- ASSERT(!IsDefinition() || AsDefinition()->use_list() == NULL);
return return_previous ? prev_instr : next_instr;
}
@@ -406,22 +363,20 @@ void Instruction::RecordAssignedVars(BitVector* assigned_vars,
void Definition::ReplaceUsesWith(Definition* other) {
- UseVal* head = use_list();
- if (head == NULL) return;
-
- UseVal* current = head;
- while (current->next_use() != NULL) {
- current->definition_ = other;
- current = current->next_use();
+ while (instr_use_list_ != NULL) {
+ UseVal* current = instr_use_list_;
+ instr_use_list_ = instr_use_list_->next_use();
+ current->set_definition(other);
+ current->set_next_use(other->instr_use_list());
+ other->set_instr_use_list(current);
}
- current->definition_ = other;
-
- if (other->use_list() != NULL) {
- current->next_use_ = other->use_list();
- other->use_list()->previous_use_ = current;
+ while (env_use_list_ != NULL) {
+ UseVal* current = env_use_list_;
+ env_use_list_ = env_use_list_->next_use();
+ current->set_definition(other);
+ current->set_next_use(other->env_use_list());
+ other->set_env_use_list(current);
}
- other->set_use_list(head);
- set_use_list(NULL);
}
@@ -1085,7 +1040,6 @@ Definition* StrictCompareComp::TryReplace(BindInstr* instr) const {
// Remove the constant from the graph.
BindInstr* right = right_use->definition()->AsBind();
if (right != NULL) {
- right->set_use_list(NULL);
right->RemoveFromGraph();
}
// Return left subexpression as the replacement for this instruction.

Powered by Google App Engine
This is Rietveld 408576698