Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index e567e1cdb193bd7720bf8d6787e693ff9f53b89b..f62a2835fcca26a4e8a75f1ee2ef31d5e19486a0 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -3587,7 +3587,10 @@ bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) { |
HStackCheckEliminator sce(this); |
sce.Process(); |
- if (FLAG_array_bounds_checks_elimination) EliminateRedundantBoundsChecks(); |
+ if (FLAG_idefs) SetupInformativeDefinitions(); |
+ if (FLAG_array_bounds_checks_elimination && !FLAG_idefs) { |
+ EliminateRedundantBoundsChecks(); |
+ } |
if (FLAG_array_index_dehoisting) DehoistSimpleArrayIndexComputations(); |
if (FLAG_dead_code_elimination) DeadCodeElimination(); |
@@ -3597,6 +3600,39 @@ bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) { |
} |
+void HGraph::SetupInformativeDefinitionsInBlock(HBasicBlock* block) { |
+ for (int phi_index = 0; phi_index < block->phis()->length(); phi_index++) { |
+ HPhi* phi = block->phis()->at(phi_index); |
+ phi->AddInformativeDefinitions(); |
+ // We do not support phis that "redefine just one operand". |
+ ASSERT(!phi->IsInformativeDefinition()); |
+ } |
+ |
+ for (HInstruction* i = block->first(); i != NULL; i = i->next()) { |
+ i->AddInformativeDefinitions(); |
+ i->UpdateRedefinedUsesWhileSettingUpInformativeDefinitions(); |
+ } |
+} |
+ |
+ |
+// This method is recursive, so if its stack frame is large it could |
+// cause a stack overflow. |
+// To keep the individual stack frames small we do the actual work inside |
+// SetupInformativeDefinitionsInBlock(); |
+void HGraph::SetupInformativeDefinitionsRecursively(HBasicBlock* block) { |
+ SetupInformativeDefinitionsInBlock(block); |
+ for (int i = 0; i < block->dominated_blocks()->length(); ++i) { |
+ SetupInformativeDefinitionsRecursively(block->dominated_blocks()->at(i)); |
+ } |
+} |
+ |
+ |
+void HGraph::SetupInformativeDefinitions() { |
+ HPhase phase("H_Setup informative definitions", this); |
+ SetupInformativeDefinitionsRecursively(entry_block()); |
+} |
+ |
+ |
// We try to "factor up" HBoundsCheck instructions towards the root of the |
// dominator tree. |
// For now we handle checks where the index is like "exp + int32value". |