| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index 1b113305ef14714e6ad984ef73fea859c405d2ce..096c4e3356a9548c99bac1bed77a9460cbdbd110 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -44,6 +44,7 @@
|
| #include "hydrogen-osr.h"
|
| #include "hydrogen-range-analysis.h"
|
| #include "hydrogen-redundant-phi.h"
|
| +#include "hydrogen-removable-simulates.h"
|
| #include "hydrogen-representation-changes.h"
|
| #include "hydrogen-sce.h"
|
| #include "hydrogen-uint32-analysis.h"
|
| @@ -2572,69 +2573,6 @@ void HGraph::CollectPhis() {
|
| }
|
|
|
|
|
| -void HGraph::MergeRemovableSimulates() {
|
| - HPhase phase("H_Merge removable simulates", this);
|
| - ZoneList<HSimulate*> mergelist(2, zone());
|
| - for (int i = 0; i < blocks()->length(); ++i) {
|
| - HBasicBlock* block = blocks()->at(i);
|
| - // Make sure the merge list is empty at the start of a block.
|
| - ASSERT(mergelist.is_empty());
|
| - // Nasty heuristic: Never remove the first simulate in a block. This
|
| - // just so happens to have a beneficial effect on register allocation.
|
| - bool first = true;
|
| - for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
|
| - HInstruction* current = it.Current();
|
| - if (current->IsLeaveInlined()) {
|
| - // Never fold simulates from inlined environments into simulates
|
| - // in the outer environment.
|
| - // (Before each HEnterInlined, there is a non-foldable HSimulate
|
| - // anyway, so we get the barrier in the other direction for free.)
|
| - // Simply remove all accumulated simulates without merging. This
|
| - // is safe because simulates after instructions with side effects
|
| - // are never added to the merge list.
|
| - while (!mergelist.is_empty()) {
|
| - mergelist.RemoveLast()->DeleteAndReplaceWith(NULL);
|
| - }
|
| - continue;
|
| - }
|
| - if (current->IsReturn()) {
|
| - // Drop mergeable simulates in the list. This is safe because
|
| - // simulates after instructions with side effects are never added
|
| - // to the merge list.
|
| - while (!mergelist.is_empty()) {
|
| - mergelist.RemoveLast()->DeleteAndReplaceWith(NULL);
|
| - }
|
| - continue;
|
| - }
|
| - // Skip the non-simulates and the first simulate.
|
| - if (!current->IsSimulate()) continue;
|
| - if (first) {
|
| - first = false;
|
| - continue;
|
| - }
|
| - HSimulate* current_simulate = HSimulate::cast(current);
|
| - if ((current_simulate->previous()->HasObservableSideEffects() &&
|
| - !current_simulate->next()->IsSimulate()) ||
|
| - !current_simulate->is_candidate_for_removal()) {
|
| - // This simulate is not suitable for folding.
|
| - // Fold the ones accumulated so far.
|
| - current_simulate->MergeWith(&mergelist);
|
| - continue;
|
| - } else {
|
| - // Accumulate this simulate for folding later on.
|
| - mergelist.Add(current_simulate, zone());
|
| - }
|
| - }
|
| -
|
| - if (!mergelist.is_empty()) {
|
| - // Merge the accumulated simulates at the end of the block.
|
| - HSimulate* last = mergelist.RemoveLast();
|
| - last->MergeWith(&mergelist);
|
| - }
|
| - }
|
| -}
|
| -
|
| -
|
| void HGraph::RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi) {
|
| if (!phi->CheckFlag(HValue::kAllowUndefinedAsNaN)) return;
|
| phi->ClearFlag(HValue::kAllowUndefinedAsNaN);
|
| @@ -3137,7 +3075,7 @@ bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) {
|
| // Remove HSimulate instructions that have turned out not to be needed
|
| // after all by folding them into the following HSimulate.
|
| // This must happen after inferring representations.
|
| - MergeRemovableSimulates();
|
| + Run<HMergeRemovableSimulatesPhase>();
|
|
|
| MarkDeoptimizeOnUndefined();
|
| Run<HRepresentationChangesPhase>();
|
|
|