Index: src/compiler/pipeline.cc |
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc |
index 3a0d27b0593f51ad1306350ac95b4cfb25da4093..2ab614e3c0df05ab8e4bf32cecf12af4954f5f78 100644 |
--- a/src/compiler/pipeline.cc |
+++ b/src/compiler/pipeline.cc |
@@ -21,6 +21,7 @@ |
#include "src/compiler/js-generic-lowering.h" |
#include "src/compiler/js-inlining.h" |
#include "src/compiler/js-typed-lowering.h" |
+#include "src/compiler/jump-threading.h" |
#include "src/compiler/machine-operator-reducer.h" |
#include "src/compiler/pipeline-statistics.h" |
#include "src/compiler/register-allocator.h" |
@@ -578,6 +579,18 @@ struct ResolveControlFlowPhase { |
}; |
+struct JumpThreadingPhase { |
+ static const char* phase_name() { return "jump threading"; } |
+ |
+ void Run(PipelineData* data, Zone* temp_zone) { |
+ ZoneVector<BasicBlock::RpoNumber> result(temp_zone); |
+ if (JumpThreading::ComputeForwarding(temp_zone, result, data->sequence())) { |
+ JumpThreading::ApplyForwarding(result, data->sequence()); |
+ } |
+ } |
+}; |
+ |
+ |
struct GenerateCodePhase { |
static const char* phase_name() { return "generate code"; } |
@@ -902,7 +915,12 @@ void Pipeline::GenerateCode(Linkage* linkage) { |
BeginPhaseKind("code generation"); |
- // Generate native sequence. |
+ // Optimimize jumps. |
+ if (FLAG_turbo_jt) { |
+ Run<JumpThreadingPhase>(); |
+ } |
+ |
+ // Generate final machine code. |
Run<GenerateCodePhase>(linkage); |
if (profiler_data != NULL) { |