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

Unified Diff: src/hydrogen-instructions.cc

Issue 9455011: Lazy removal of dead HValues in GVN from use lists. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index c59c9e4f946847ae25fe2e2ed4018dea796fafa3..9d39d033eb7a9d0cf56c8a24b6b6ef0dbf73f235 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -276,6 +276,15 @@ bool HValue::IsDefinedAfter(HBasicBlock* other) const {
}
+HUseListNode* HUseListNode::tail() {
+ // Skip and remove dead items in the use list.
+ while (tail_ != NULL && tail_->value()->CheckFlag(HValue::kIsDead)) {
+ tail_ = tail_->tail_;
+ }
+ return tail_;
+}
+
+
HUseIterator::HUseIterator(HUseListNode* head) : next_(head) {
Advance();
}
@@ -374,7 +383,10 @@ void HValue::DeleteAndReplaceWith(HValue* other) {
// We replace all uses first, so Delete can assert that there are none.
if (other != NULL) ReplaceAllUsesWith(other);
ASSERT(HasNoUses());
- ClearOperands();
+ // Clearing the operands includes going through the use list of each operand
+ // to remove this HValue, which can be expensive. Instead, we simply mark it
+ // as dead and remove it lazily from the operands' use lists.
+ SetFlag(kIsDead);
DeleteFromGraph();
}

Powered by Google App Engine
This is Rietveld 408576698