Index: src/x64/lithium-x64.cc |
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc |
index 4b2ffbe2128d324fada1f9c648a5d83d21ae684f..3dcc97f5fed95ca97e1d25f3ee48857fb26f1c21 100644 |
--- a/src/x64/lithium-x64.cc |
+++ b/src/x64/lithium-x64.cc |
@@ -814,7 +814,11 @@ 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); |
- if (phi->merged_index() < last_environment->length()) { |
+ // TODO(mstarzinger): The length check below should actually not |
+ // be necessary, but some array stubs already rely on it. This |
+ // should be investigated and fixed. |
+ if (phi->HasMergedIndex() && |
+ phi->merged_index() < last_environment->length()) { |
last_environment->SetValueAt(phi->merged_index(), phi); |
} |
} |