Fix bug in r10812.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9455016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10816 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2012-02-23 15:37:27 +00:00
parent 8affd2bead
commit 0a6f18294f

View File

@ -384,9 +384,18 @@ void HValue::DeleteAndReplaceWith(HValue* other) {
if (other != NULL) ReplaceAllUsesWith(other);
ASSERT(HasNoUses());
// 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.
// to remove this HValue, which can be expensive. Instead, we mark this as
// dead and only check the first item in the use list of each operand.
// For the following items in the use lists we rely on the tail() method to
// skip dead dead items and remove them lazily.
SetFlag(kIsDead);
for (int i = 0; i < OperandCount(); ++i) {
HValue* operand = OperandAt(i);
HUseListNode* first = operand->use_list_;
if (first != NULL && first->index() == i && first->value() == this) {
operand->use_list_ = first->tail();
}
}
DeleteFromGraph();
}