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/adapters.h" | 10 #include "src/base/adapters.h" |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1025 // Post-pass for wiring the control/effects | 1025 // Post-pass for wiring the control/effects |
1026 // - connect allocating representation changes into the control&effect | 1026 // - connect allocating representation changes into the control&effect |
1027 // chains and lower them, | 1027 // chains and lower them, |
1028 // - get rid of the region markers, | 1028 // - get rid of the region markers, |
1029 // - introduce effect phis and rewire effects to get SSA again. | 1029 // - introduce effect phis and rewire effects to get SSA again. |
1030 EffectControlLinearizer linearizer(data->jsgraph(), schedule, temp_zone); | 1030 EffectControlLinearizer linearizer(data->jsgraph(), schedule, temp_zone); |
1031 linearizer.Run(); | 1031 linearizer.Run(); |
1032 } | 1032 } |
1033 }; | 1033 }; |
1034 | 1034 |
1035 // The store-store elimination greatly benefits from doing a common operator | |
1036 // reducer just before it, to eliminate conditional deopts with a constant | |
1037 // condition. | |
1038 | |
1039 struct CommonOperatorReducerPhase { | |
Jarin
2016/07/25 09:52:13
Rename to DeadCodeEliminationPhase (because that i
bgeron
2016/07/27 13:40:37
Done.
| |
1040 static const char* phase_name() { return "common operator reducer"; } | |
1041 | |
1042 void Run(PipelineData* data, Zone* temp_zone) { | |
1043 // Run the common operator reducer. | |
1044 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | |
1045 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), | |
1046 data->common()); | |
1047 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), | |
1048 data->common(), data->machine()); | |
1049 AddReducer(data, &graph_reducer, &dead_code_elimination); | |
1050 AddReducer(data, &graph_reducer, &common_reducer); | |
1051 graph_reducer.ReduceGraph(); | |
1052 } | |
1053 }; | |
1054 | |
1035 struct StoreStoreEliminationPhase { | 1055 struct StoreStoreEliminationPhase { |
1036 static const char* phase_name() { return "Store-store elimination"; } | 1056 static const char* phase_name() { return "store-store elimination"; } |
1037 | 1057 |
1038 void Run(PipelineData* data, Zone* temp_zone) { | 1058 void Run(PipelineData* data, Zone* temp_zone) { |
1039 StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone); | 1059 GraphTrimmer(temp_zone, data->graph()).TrimGraph(); |
Jarin
2016/07/25 09:52:13
Could you call the trimming on the roots, too? (As
bgeron
2016/07/27 13:40:37
Done. Actually, I think the graph would be trimmed
| |
1040 store_store_elimination.Run(); | 1060 |
1061 StoreStoreElimination::Run(data->jsgraph(), temp_zone); | |
1041 } | 1062 } |
1042 }; | 1063 }; |
1043 | 1064 |
1044 struct LoadEliminationPhase { | 1065 struct LoadEliminationPhase { |
1045 static const char* phase_name() { return "load elimination"; } | 1066 static const char* phase_name() { return "load elimination"; } |
1046 | 1067 |
1047 void Run(PipelineData* data, Zone* temp_zone) { | 1068 void Run(PipelineData* data, Zone* temp_zone) { |
1048 // The memory optimizer requires the graphs to be trimmed, so trim now. | 1069 // The memory optimizer requires the graphs to be trimmed, so trim now. |
1049 GraphTrimmer trimmer(temp_zone, data->graph()); | 1070 GraphTrimmer trimmer(temp_zone, data->graph()); |
1050 NodeVector roots(temp_zone); | 1071 NodeVector roots(temp_zone); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1511 } | 1532 } |
1512 | 1533 |
1513 bool PipelineImpl::OptimizeGraph(Linkage* linkage) { | 1534 bool PipelineImpl::OptimizeGraph(Linkage* linkage) { |
1514 PipelineData* data = this->data_; | 1535 PipelineData* data = this->data_; |
1515 | 1536 |
1516 data->BeginPhaseKind("block building"); | 1537 data->BeginPhaseKind("block building"); |
1517 | 1538 |
1518 Run<EffectControlLinearizationPhase>(); | 1539 Run<EffectControlLinearizationPhase>(); |
1519 RunPrintAndVerify("Effect and control linearized", true); | 1540 RunPrintAndVerify("Effect and control linearized", true); |
1520 | 1541 |
1542 Run<CommonOperatorReducerPhase>(); | |
1543 RunPrintAndVerify("Common operator reducer", true); | |
1544 | |
1521 if (FLAG_turbo_store_elimination) { | 1545 if (FLAG_turbo_store_elimination) { |
1522 Run<StoreStoreEliminationPhase>(); | 1546 Run<StoreStoreEliminationPhase>(); |
1523 RunPrintAndVerify("Store-store elimination", true); | 1547 RunPrintAndVerify("Store-store elimination", true); |
1524 } | 1548 } |
1525 | 1549 |
1526 // Optimize control flow. | 1550 // Optimize control flow. |
1527 if (FLAG_turbo_cf_optimization) { | 1551 if (FLAG_turbo_cf_optimization) { |
1528 Run<ControlFlowOptimizationPhase>(); | 1552 Run<ControlFlowOptimizationPhase>(); |
1529 RunPrintAndVerify("Control flow optimized", true); | 1553 RunPrintAndVerify("Control flow optimized", true); |
1530 } | 1554 } |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1860 data->DeleteRegisterAllocationZone(); | 1884 data->DeleteRegisterAllocationZone(); |
1861 } | 1885 } |
1862 | 1886 |
1863 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1887 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
1864 | 1888 |
1865 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1889 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
1866 | 1890 |
1867 } // namespace compiler | 1891 } // namespace compiler |
1868 } // namespace internal | 1892 } // namespace internal |
1869 } // namespace v8 | 1893 } // namespace v8 |
OLD | NEW |