| 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 <memory> | 8 #include <memory> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 // - connect allocating representation changes into the control&effect | 1067 // - connect allocating representation changes into the control&effect |
| 1068 // chains and lower them, | 1068 // chains and lower them, |
| 1069 // - get rid of the region markers, | 1069 // - get rid of the region markers, |
| 1070 // - introduce effect phis and rewire effects to get SSA again. | 1070 // - introduce effect phis and rewire effects to get SSA again. |
| 1071 EffectControlLinearizer linearizer(data->jsgraph(), schedule, temp_zone); | 1071 EffectControlLinearizer linearizer(data->jsgraph(), schedule, temp_zone); |
| 1072 linearizer.Run(); | 1072 linearizer.Run(); |
| 1073 } | 1073 } |
| 1074 }; | 1074 }; |
| 1075 | 1075 |
| 1076 // The store-store elimination greatly benefits from doing a common operator | 1076 // The store-store elimination greatly benefits from doing a common operator |
| 1077 // reducer just before it, to eliminate conditional deopts with a constant | 1077 // reducer and dead code elimination just before it, to eliminate conditional |
| 1078 // condition. | 1078 // deopts with a constant condition. |
| 1079 | 1079 |
| 1080 struct DeadCodeEliminationPhase { | 1080 struct DeadCodeEliminationPhase { |
| 1081 static const char* phase_name() { return "common operator reducer"; } | 1081 static const char* phase_name() { return "dead code elimination"; } |
| 1082 | 1082 |
| 1083 void Run(PipelineData* data, Zone* temp_zone) { | 1083 void Run(PipelineData* data, Zone* temp_zone) { |
| 1084 // Run the common operator reducer. | |
| 1085 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | 1084 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
| 1086 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), | 1085 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), |
| 1087 data->common()); | 1086 data->common()); |
| 1088 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), | 1087 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), |
| 1089 data->common(), data->machine()); | 1088 data->common(), data->machine()); |
| 1090 AddReducer(data, &graph_reducer, &dead_code_elimination); | 1089 AddReducer(data, &graph_reducer, &dead_code_elimination); |
| 1091 AddReducer(data, &graph_reducer, &common_reducer); | 1090 AddReducer(data, &graph_reducer, &common_reducer); |
| 1092 graph_reducer.ReduceGraph(); | 1091 graph_reducer.ReduceGraph(); |
| 1093 } | 1092 } |
| 1094 }; | 1093 }; |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 data->BeginPhaseKind("block building"); | 1586 data->BeginPhaseKind("block building"); |
| 1588 | 1587 |
| 1589 // Run early optimization pass. | 1588 // Run early optimization pass. |
| 1590 Run<EarlyOptimizationPhase>(); | 1589 Run<EarlyOptimizationPhase>(); |
| 1591 RunPrintAndVerify("Early optimized", true); | 1590 RunPrintAndVerify("Early optimized", true); |
| 1592 | 1591 |
| 1593 Run<EffectControlLinearizationPhase>(); | 1592 Run<EffectControlLinearizationPhase>(); |
| 1594 RunPrintAndVerify("Effect and control linearized", true); | 1593 RunPrintAndVerify("Effect and control linearized", true); |
| 1595 | 1594 |
| 1596 Run<DeadCodeEliminationPhase>(); | 1595 Run<DeadCodeEliminationPhase>(); |
| 1597 RunPrintAndVerify("Common operator reducer", true); | 1596 RunPrintAndVerify("Dead code elimination", true); |
| 1598 | 1597 |
| 1599 if (FLAG_turbo_store_elimination) { | 1598 if (FLAG_turbo_store_elimination) { |
| 1600 Run<StoreStoreEliminationPhase>(); | 1599 Run<StoreStoreEliminationPhase>(); |
| 1601 RunPrintAndVerify("Store-store elimination", true); | 1600 RunPrintAndVerify("Store-store elimination", true); |
| 1602 } | 1601 } |
| 1603 | 1602 |
| 1604 // Optimize control flow. | 1603 // Optimize control flow. |
| 1605 if (FLAG_turbo_cf_optimization) { | 1604 if (FLAG_turbo_cf_optimization) { |
| 1606 Run<ControlFlowOptimizationPhase>(); | 1605 Run<ControlFlowOptimizationPhase>(); |
| 1607 RunPrintAndVerify("Control flow optimized", true); | 1606 RunPrintAndVerify("Control flow optimized", true); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 data->DeleteRegisterAllocationZone(); | 1938 data->DeleteRegisterAllocationZone(); |
| 1940 } | 1939 } |
| 1941 | 1940 |
| 1942 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1941 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
| 1943 | 1942 |
| 1944 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1943 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
| 1945 | 1944 |
| 1946 } // namespace compiler | 1945 } // namespace compiler |
| 1947 } // namespace internal | 1946 } // namespace internal |
| 1948 } // namespace v8 | 1947 } // namespace v8 |
| OLD | NEW |