Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index e567e1cdb193bd7720bf8d6787e693ff9f53b89b..1e337b22a32b0188f80cb5cb566918290a6146b9 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -3587,7 +3587,9 @@ 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(); |
|
Jakob Kummerow
2013/01/31 14:06:43
nit: {} please
Massi
2013/01/31 17:16:19
Done.
|
| if (FLAG_array_index_dehoisting) DehoistSimpleArrayIndexComputations(); |
| if (FLAG_dead_code_elimination) DeadCodeElimination(); |
| @@ -3597,6 +3599,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". |