Commit f190a6d2 authored by Benedikt Meurer's avatar Benedikt Meurer

[turbofan] Add poor man's store elimination for storing to fields.

This is a very simple dead store elimination that removes StoreField
nodes which are immediately followed by other StoreField nodes that
store to the same field. Ideally there should be a fully featured store
elimination, which walks over the effect graph starting from the end,
but there are some technical difficulties to solve before we can get to
that, esp. we need to think about "effect producing" operators like
ValueEffect first. Once we have that, it is trivial to remove this temporary
poor man's store elimination.

R=dcarney@chromium.org

Review URL: https://codereview.chromium.org/1070003002

Cr-Commit-Position: refs/heads/master@{#27697}
parent 99be3e82
......@@ -100,6 +100,21 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
if (m.HasValue()) return ReplaceNumber(FastUI2D(m.Value()));
break;
}
case IrOpcode::kStoreField: {
// TODO(turbofan): Poor man's store elimination, remove this once we have
// a fully featured store elimination in place.
Node* const effect = node->InputAt(2);
if (effect->op()->Equals(node->op()) && effect->OwnedBy(node) &&
effect->InputAt(0) == node->InputAt(0)) {
// The {effect} is a store to the same field in the same object, and
// {node} is the only effect observer, so we can kill {effect} and
// instead make {node} depend on the incoming effect to {effect}.
node->ReplaceInput(2, effect->InputAt(2));
effect->Kill();
return Changed(node);
}
break;
}
default:
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment