Fix representation change insertion for phis.

R=mstarzinger@chromium.org
BUG=

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23590 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
titzer@chromium.org 2014-09-02 10:14:21 +00:00
parent 4f0a65da7b
commit ed5f9f8765

View File

@ -254,14 +254,16 @@ class RepresentationSelector {
// Helper for handling phis. // Helper for handling phis.
void VisitPhi(Node* node, MachineTypeUnion use) { void VisitPhi(Node* node, MachineTypeUnion use) {
// First, propagate the usage information to inputs of the phi. // First, propagate the usage information to inputs of the phi.
if (!lower()) {
int values = OperatorProperties::GetValueInputCount(node->op()); int values = OperatorProperties::GetValueInputCount(node->op());
// Propagate {use} of the phi to value inputs, and 0 to control.
Node::Inputs inputs = node->inputs(); Node::Inputs inputs = node->inputs();
for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end(); for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
++iter, --values) { ++iter, --values) {
// Propagate {use} of the phi to value inputs, and 0 to control.
// TODO(titzer): it'd be nice to have distinguished edge kinds here. // TODO(titzer): it'd be nice to have distinguished edge kinds here.
ProcessInput(node, iter.index(), values > 0 ? use : 0); ProcessInput(node, iter.index(), values > 0 ? use : 0);
} }
}
// Phis adapt to whatever output representation their uses demand, // Phis adapt to whatever output representation their uses demand,
// pushing representation changes to their inputs. // pushing representation changes to their inputs.
MachineTypeUnion use_rep = GetUseInfo(node) & kRepMask; MachineTypeUnion use_rep = GetUseInfo(node) & kRepMask;
@ -296,7 +298,19 @@ class RepresentationSelector {
} }
// Preserve the usage type, but set the representation. // Preserve the usage type, but set the representation.
Type* upper = NodeProperties::GetBounds(node).upper; Type* upper = NodeProperties::GetBounds(node).upper;
SetOutput(node, rep | changer_->TypeFromUpperBound(upper)); MachineTypeUnion output_type = rep | changer_->TypeFromUpperBound(upper);
SetOutput(node, output_type);
if (lower()) {
int values = OperatorProperties::GetValueInputCount(node->op());
// Convert inputs to the output representation of this phi.
Node::Inputs inputs = node->inputs();
for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
++iter, --values) {
// TODO(titzer): it'd be nice to have distinguished edge kinds here.
ProcessInput(node, iter.index(), values > 0 ? output_type : 0);
}
}
} }
Operator* Int32Op(Node* node) { Operator* Int32Op(Node* node) {