| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
| 6 | 6 |
| 7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
| 11 #include "src/bootstrapper.h" // TODO(mstarzinger): Only temporary. | 11 #include "src/bootstrapper.h" // TODO(mstarzinger): Only temporary. |
| 12 #include "src/compiler/ast-graph-builder.h" | 12 #include "src/compiler/ast-graph-builder.h" |
| 13 #include "src/compiler/ast-loop-assignment-analyzer.h" | 13 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 14 #include "src/compiler/basic-block-instrumentor.h" | 14 #include "src/compiler/basic-block-instrumentor.h" |
| 15 #include "src/compiler/change-lowering.h" | 15 #include "src/compiler/change-lowering.h" |
| 16 #include "src/compiler/code-generator.h" | 16 #include "src/compiler/code-generator.h" |
| 17 #include "src/compiler/common-operator-reducer.h" | 17 #include "src/compiler/common-operator-reducer.h" |
| 18 #include "src/compiler/control-flow-optimizer.h" |
| 18 #include "src/compiler/control-reducer.h" | 19 #include "src/compiler/control-reducer.h" |
| 19 #include "src/compiler/graph-replay.h" | 20 #include "src/compiler/graph-replay.h" |
| 20 #include "src/compiler/graph-visualizer.h" | 21 #include "src/compiler/graph-visualizer.h" |
| 21 #include "src/compiler/instruction.h" | 22 #include "src/compiler/instruction.h" |
| 22 #include "src/compiler/instruction-selector.h" | 23 #include "src/compiler/instruction-selector.h" |
| 23 #include "src/compiler/js-builtin-reducer.h" | 24 #include "src/compiler/js-builtin-reducer.h" |
| 24 #include "src/compiler/js-context-specialization.h" | 25 #include "src/compiler/js-context-specialization.h" |
| 25 #include "src/compiler/js-generic-lowering.h" | 26 #include "src/compiler/js-generic-lowering.h" |
| 26 #include "src/compiler/js-inlining.h" | 27 #include "src/compiler/js-inlining.h" |
| 27 #include "src/compiler/js-intrinsic-lowering.h" | 28 #include "src/compiler/js-intrinsic-lowering.h" |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 GraphReducer graph_reducer(data->graph(), temp_zone); | 536 GraphReducer graph_reducer(data->graph(), temp_zone); |
| 536 AddReducer(data, &graph_reducer, &vn_reducer); | 537 AddReducer(data, &graph_reducer, &vn_reducer); |
| 537 AddReducer(data, &graph_reducer, &simple_reducer); | 538 AddReducer(data, &graph_reducer, &simple_reducer); |
| 538 AddReducer(data, &graph_reducer, &machine_reducer); | 539 AddReducer(data, &graph_reducer, &machine_reducer); |
| 539 AddReducer(data, &graph_reducer, &common_reducer); | 540 AddReducer(data, &graph_reducer, &common_reducer); |
| 540 graph_reducer.ReduceGraph(); | 541 graph_reducer.ReduceGraph(); |
| 541 } | 542 } |
| 542 }; | 543 }; |
| 543 | 544 |
| 544 | 545 |
| 546 struct ControlFlowOptimizationPhase { |
| 547 static const char* phase_name() { return "control flow optimization"; } |
| 548 |
| 549 void Run(PipelineData* data, Zone* temp_zone) { |
| 550 ControlFlowOptimizer optimizer(data->jsgraph(), temp_zone); |
| 551 optimizer.Optimize(); |
| 552 } |
| 553 }; |
| 554 |
| 555 |
| 545 struct ChangeLoweringPhase { | 556 struct ChangeLoweringPhase { |
| 546 static const char* phase_name() { return "change lowering"; } | 557 static const char* phase_name() { return "change lowering"; } |
| 547 | 558 |
| 548 void Run(PipelineData* data, Zone* temp_zone) { | 559 void Run(PipelineData* data, Zone* temp_zone) { |
| 549 SourcePositionTable::Scope pos(data->source_positions(), | 560 SourcePositionTable::Scope pos(data->source_positions(), |
| 550 SourcePosition::Unknown()); | 561 SourcePosition::Unknown()); |
| 551 ValueNumberingReducer vn_reducer(temp_zone); | 562 ValueNumberingReducer vn_reducer(temp_zone); |
| 552 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); | 563 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); |
| 553 ChangeLowering lowering(data->jsgraph()); | 564 ChangeLowering lowering(data->jsgraph()); |
| 554 MachineOperatorReducer machine_reducer(data->jsgraph()); | 565 MachineOperatorReducer machine_reducer(data->jsgraph()); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 if (info()->is_osr()) { | 963 if (info()->is_osr()) { |
| 953 Run<OsrDeconstructionPhase>(); | 964 Run<OsrDeconstructionPhase>(); |
| 954 if (info()->bailout_reason() != kNoReason) return Handle<Code>::null(); | 965 if (info()->bailout_reason() != kNoReason) return Handle<Code>::null(); |
| 955 RunPrintAndVerify("OSR deconstruction"); | 966 RunPrintAndVerify("OSR deconstruction"); |
| 956 } | 967 } |
| 957 | 968 |
| 958 // Lower simplified operators and insert changes. | 969 // Lower simplified operators and insert changes. |
| 959 Run<SimplifiedLoweringPhase>(); | 970 Run<SimplifiedLoweringPhase>(); |
| 960 RunPrintAndVerify("Lowered simplified"); | 971 RunPrintAndVerify("Lowered simplified"); |
| 961 | 972 |
| 973 // Optimize control flow. |
| 974 if (FLAG_turbo_cf_optimization) { |
| 975 Run<ControlFlowOptimizationPhase>(); |
| 976 RunPrintAndVerify("Control flow optimized"); |
| 977 } |
| 978 |
| 962 // Lower changes that have been inserted before. | 979 // Lower changes that have been inserted before. |
| 963 Run<ChangeLoweringPhase>(); | 980 Run<ChangeLoweringPhase>(); |
| 964 // // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. | 981 // // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. |
| 965 RunPrintAndVerify("Lowered changes", true); | 982 RunPrintAndVerify("Lowered changes", true); |
| 966 | 983 |
| 967 Run<LateControlReductionPhase>(); | 984 Run<LateControlReductionPhase>(); |
| 968 RunPrintAndVerify("Late Control reduced"); | 985 RunPrintAndVerify("Late Control reduced"); |
| 969 } else { | 986 } else { |
| 970 if (info()->is_osr()) { | 987 if (info()->is_osr()) { |
| 971 Run<OsrDeconstructionPhase>(); | 988 Run<OsrDeconstructionPhase>(); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 | 1209 |
| 1193 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { | 1210 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { |
| 1194 TurboCfgFile tcf(data->isolate()); | 1211 TurboCfgFile tcf(data->isolate()); |
| 1195 tcf << AsC1VAllocator("CodeGen", data->register_allocator()); | 1212 tcf << AsC1VAllocator("CodeGen", data->register_allocator()); |
| 1196 } | 1213 } |
| 1197 } | 1214 } |
| 1198 | 1215 |
| 1199 } // namespace compiler | 1216 } // namespace compiler |
| 1200 } // namespace internal | 1217 } // namespace internal |
| 1201 } // namespace v8 | 1218 } // namespace v8 |
| OLD | NEW |