Chromium Code Reviews| Index: src/compiler/pipeline.cc |
| diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc |
| index d711abefb8338ead3c661268696013612f3a1253..b84a5d0af70f876e6bb5bde15215da20b1456527 100644 |
| --- a/src/compiler/pipeline.cc |
| +++ b/src/compiler/pipeline.cc |
| @@ -19,6 +19,7 @@ |
| #include "src/compiler/common-operator-reducer.h" |
| #include "src/compiler/control-flow-optimizer.h" |
| #include "src/compiler/dead-code-elimination.h" |
| +#include "src/compiler/effect-control-linearizer.h" |
| #include "src/compiler/escape-analysis-reducer.h" |
| #include "src/compiler/escape-analysis.h" |
| #include "src/compiler/frame-elider.h" |
| @@ -225,6 +226,7 @@ class PipelineData { |
| DCHECK(!schedule_); |
| schedule_ = schedule; |
| } |
| + void reset_schedule() { schedule_ = nullptr; } |
| Zone* instruction_zone() const { return instruction_zone_; } |
| InstructionSequence* sequence() const { return sequence_; } |
| @@ -799,6 +801,15 @@ struct ControlFlowOptimizationPhase { |
| } |
| }; |
| +struct FixLowLevelEffectsPhase { |
|
Benedikt Meurer
2016/04/18 04:34:18
Can we have a single ControlEffectLinearizationPha
Jarin
2016/04/18 07:53:33
Done.
|
| + static const char* phase_name() { return "low-level effect wiring"; } |
| + |
| + void Run(PipelineData* data, Zone* temp_zone) { |
| + EffectControlLinearizer introducer(data->jsgraph(), data->schedule(), |
| + temp_zone); |
| + introducer.Run(); |
| + } |
| +}; |
| struct ChangeLoweringPhase { |
| static const char* phase_name() { return "change lowering"; } |
| @@ -823,6 +834,26 @@ struct ChangeLoweringPhase { |
| } |
| }; |
| +struct ComputeEffectSchedulePhase { |
| + static const char* phase_name() { return "effect scheduling"; } |
| + |
| + void Run(PipelineData* data, Zone* temp_zone) { |
| + Schedule* schedule = Scheduler::ComputeSchedule(temp_zone, data->graph(), |
| + Scheduler::kNoFlags); |
| + if (FLAG_turbo_verify) ScheduleVerifier::Run(schedule); |
| + data->set_schedule(schedule); |
| + } |
| +}; |
| + |
| +struct EffectScheduleTrimmingPhase { |
|
Benedikt Meurer
2016/04/18 04:34:18
Can you put a TODO on this guy, that we only need
Jarin
2016/04/18 07:53:33
Done.
|
| + static const char* phase_name() { return "effect schedule graph trimming"; } |
| + void Run(PipelineData* data, Zone* temp_zone) { |
| + GraphTrimmer trimmer(temp_zone, data->graph()); |
| + NodeVector roots(temp_zone); |
| + data->jsgraph()->GetCachedNodes(&roots); |
| + trimmer.TrimGraph(roots.begin(), roots.end()); |
| + } |
| +}; |
| struct EarlyGraphTrimmingPhase { |
| static const char* phase_name() { return "early graph trimming"; } |
| @@ -1251,6 +1282,31 @@ Handle<Code> Pipeline::GenerateCode() { |
| Run<SimplifiedLoweringPhase>(); |
| RunPrintAndVerify("Lowered simplified"); |
| + if (!info()->shared_info()->asm_function()) { |
|
Benedikt Meurer
2016/04/18 04:34:18
How bad is this actually for asm.js functions?
|
| + // TODO(jarin) Run value numbering for the representation changes. |
| + |
| + // The scheduler requires the graphs to be trimmed, so trim now. |
| + Run<EffectScheduleTrimmingPhase>(); |
| + |
| + // Schedule the graph without node splitting so that we can |
| + // fix the effect and control flow for nodes with low-level side |
| + // effects (such as changing representation to tagged or |
| + // 'floating' allocation regions.) |
| + Run<ComputeEffectSchedulePhase>(); |
| + |
| + // Post-pass for wiring the control/effects |
| + // - connect allocating representation changes into the control&effect |
| + // chains and lower them, |
| + // - get rid of the region markers, |
| + // - introduce effect phis and rewire effects to get SSA again. |
| + Run<FixLowLevelEffectsPhase>(); |
| + |
| + // Get rid of the schedule. |
| + // TODO(jarin) We should produce the schedule in a temporary zone. |
| + data.reset_schedule(); |
| + RunPrintAndVerify("Fixed state flow"); |
| + } |
| + |
| Run<BranchEliminationPhase>(); |
| RunPrintAndVerify("Branch conditions eliminated"); |