Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index fe494f2731a5e274680060c746f31ce56522944b..1d42455ce3c1bafed61ec5a48a6c953f57c0c56f 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -831,11 +831,15 @@ void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
HEnvironment* last_environment = pred->last_environment(); |
for (int i = 0; i < block->phis()->length(); ++i) { |
HPhi* phi = block->phis()->at(i); |
- last_environment->SetValueAt(phi->merged_index(), phi); |
+ if (phi->merged_index() < last_environment->length()) { |
+ last_environment->SetValueAt(phi->merged_index(), phi); |
+ } |
} |
for (int i = 0; i < block->deleted_phis()->length(); ++i) { |
- last_environment->SetValueAt(block->deleted_phis()->at(i), |
- graph_->GetConstantUndefined()); |
+ if (block->deleted_phis()->at(i) < last_environment->length()) { |
+ last_environment->SetValueAt(block->deleted_phis()->at(i), |
+ graph_->GetConstantUndefined()); |
+ } |
} |
block->UpdateEnvironment(last_environment); |
// Pick up the outgoing argument count of one of the predecessors. |