Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 1b113305ef14714e6ad984ef73fea859c405d2ce..ae0c9ac9c84f40a9b3131b4208f2f9ce7f349b9a 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -34,6 +34,7 @@ |
#include "full-codegen.h" |
#include "hashmap.h" |
#include "hydrogen-bce.h" |
+#include "hydrogen-canonicalize.h" |
#include "hydrogen-dce.h" |
#include "hydrogen-environment-liveness.h" |
#include "hydrogen-escape-analysis.h" |
@@ -2090,33 +2091,6 @@ void HGraph::FinalizeUniqueValueIds() { |
} |
-void HGraph::Canonicalize() { |
- HPhase phase("H_Canonicalize", this); |
- // Before removing no-op instructions, save their semantic value. |
- // We must be careful not to set the flag unnecessarily, because GVN |
- // cannot identify two instructions when their flag value differs. |
- for (int i = 0; i < blocks()->length(); ++i) { |
- for (HInstructionIterator it(blocks()->at(i)); !it.Done(); it.Advance()) { |
- HInstruction* instr = it.Current(); |
- if (instr->IsArithmeticBinaryOperation() && |
- instr->representation().IsInteger32() && |
- instr->HasAtLeastOneUseWithFlagAndNoneWithout( |
- HInstruction::kTruncatingToInt32)) { |
- instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32); |
- } |
- } |
- } |
- // Perform actual Canonicalization pass. |
- for (int i = 0; i < blocks()->length(); ++i) { |
- for (HInstructionIterator it(blocks()->at(i)); !it.Done(); it.Advance()) { |
- HInstruction* instr = it.Current(); |
- HValue* value = instr->Canonicalize(); |
- if (value != instr) instr->DeleteAndReplaceWith(value); |
- } |
- } |
-} |
- |
- |
// Block ordering was implemented with two mutually recursive methods, |
// HGraph::Postorder and HGraph::PostorderLoopBlocks. |
// The recursion could lead to stack overflow so the algorithm has been |
@@ -3149,7 +3123,7 @@ bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) { |
// zero. |
if (FLAG_opt_safe_uint32_operations) Run<HUint32AnalysisPhase>(); |
- if (FLAG_use_canonicalizing) Canonicalize(); |
+ if (FLAG_use_canonicalizing) Run<HCanonicalizePhase>(); |
if (FLAG_use_escape_analysis) Run<HEscapeAnalysisPhase>(); |