Index: src/compiler/pipeline.cc |
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc |
index 19f0d6c45d725c0765a5ca3da3ca5a270cc1e18f..83b784f8060568978cf25515abcc31e15f756aef 100644 |
--- a/src/compiler/pipeline.cc |
+++ b/src/compiler/pipeline.cc |
@@ -15,6 +15,7 @@ |
#include "src/compiler/change-lowering.h" |
#include "src/compiler/code-generator.h" |
#include "src/compiler/common-operator-reducer.h" |
+#include "src/compiler/control-flow-optimizer.h" |
#include "src/compiler/control-reducer.h" |
#include "src/compiler/graph-replay.h" |
#include "src/compiler/graph-visualizer.h" |
@@ -544,6 +545,16 @@ struct SimplifiedLoweringPhase { |
}; |
+struct ControlFlowOptimizationPhase { |
+ static const char* phase_name() { return "control flow optimization"; } |
+ |
+ void Run(PipelineData* data, Zone* temp_zone) { |
+ ControlFlowOptimizer optimizer(data->jsgraph(), temp_zone); |
+ optimizer.Optimize(); |
+ } |
+}; |
+ |
+ |
struct ChangeLoweringPhase { |
static const char* phase_name() { return "change lowering"; } |
@@ -961,6 +972,12 @@ Handle<Code> Pipeline::GenerateCode() { |
Run<SimplifiedLoweringPhase>(); |
RunPrintAndVerify("Lowered simplified"); |
+ // Optimize control flow. |
+ if (FLAG_turbo_switch) { |
+ Run<ControlFlowOptimizationPhase>(); |
+ RunPrintAndVerify("Control flow optimized"); |
+ } |
+ |
// Lower changes that have been inserted before. |
Run<ChangeLoweringPhase>(); |
// // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. |