Fix a representation change bug in the Hydrogen graph construction.

We could try to treat an HPhi as an HInstruction because the code did
not properly handle the case of a phi in a block with itself as one of
the predecessors.

BUG=v8:1134

Review URL: http://codereview.chromium.org/6471020

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6721 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e88f25f6
......@@ -1813,17 +1813,15 @@ void HGraph::InsertRepresentationChangeForUse(HValue* value,
bool is_truncating) {
// Insert the representation change right before its use. For phi-uses we
// insert at the end of the corresponding predecessor.
HBasicBlock* insert_block = use->block();
HInstruction* next = NULL;
if (use->IsPhi()) {
int index = 0;
while (use->OperandAt(index) != value) ++index;
insert_block = insert_block->predecessors()->at(index);
next = use->block()->predecessors()->at(index)->end();
} else {
next = HInstruction::cast(use);
}
HInstruction* next = (insert_block == use->block())
? HInstruction::cast(use)
: insert_block->end();
// For constants we try to make the representation change at compile
// time. When a representation change is not possible without loss of
// information we treat constants like normal instructions and insert the
......
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