Chromium Code Reviews| 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 struct CommonOperatorReducerPhase { | |
| 1036 static const char* phase_name() { return "common operator reducer"; } | |
| 1037 | |
| 1038 void Run(PipelineData* data, Zone* temp_zone) { | |
| 1039 // Run the common operator reducer. | |
| 1040 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | |
| 1041 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), | |
| 1042 data->common()); | |
| 1043 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), | |
| 1044 data->common(), data->machine()); | |
| 1045 AddReducer(data, &graph_reducer, &dead_code_elimination); | |
| 1046 AddReducer(data, &graph_reducer, &common_reducer); | |
| 1047 graph_reducer.ReduceGraph(); | |
| 1048 } | |
| 1049 }; | |
| 1050 | |
| 1035 struct StoreStoreEliminationPhase { | 1051 struct StoreStoreEliminationPhase { |
| 1036 static const char* phase_name() { return "Store-store elimination"; } | 1052 static const char* phase_name() { return "store-store elimination"; } |
| 1037 | 1053 |
| 1038 void Run(PipelineData* data, Zone* temp_zone) { | 1054 void Run(PipelineData* data, Zone* temp_zone) { |
| 1039 StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone); | 1055 GraphTrimmer(temp_zone, data->graph()).TrimGraph(); |
| 1040 store_store_elimination.Run(); | 1056 |
| 1057 StoreStoreElimination::Run(data->jsgraph(), temp_zone); | |
| 1041 } | 1058 } |
| 1042 }; | 1059 }; |
| 1043 | 1060 |
| 1044 struct LoadEliminationPhase { | 1061 struct LoadEliminationPhase { |
| 1045 static const char* phase_name() { return "load elimination"; } | 1062 static const char* phase_name() { return "load elimination"; } |
| 1046 | 1063 |
| 1047 void Run(PipelineData* data, Zone* temp_zone) { | 1064 void Run(PipelineData* data, Zone* temp_zone) { |
| 1048 // The memory optimizer requires the graphs to be trimmed, so trim now. | 1065 // The memory optimizer requires the graphs to be trimmed, so trim now. |
| 1049 GraphTrimmer trimmer(temp_zone, data->graph()); | 1066 GraphTrimmer trimmer(temp_zone, data->graph()); |
| 1050 NodeVector roots(temp_zone); | 1067 NodeVector roots(temp_zone); |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1511 } | 1528 } |
| 1512 | 1529 |
| 1513 bool PipelineImpl::OptimizeGraph(Linkage* linkage) { | 1530 bool PipelineImpl::OptimizeGraph(Linkage* linkage) { |
| 1514 PipelineData* data = this->data_; | 1531 PipelineData* data = this->data_; |
| 1515 | 1532 |
| 1516 data->BeginPhaseKind("block building"); | 1533 data->BeginPhaseKind("block building"); |
| 1517 | 1534 |
| 1518 Run<EffectControlLinearizationPhase>(); | 1535 Run<EffectControlLinearizationPhase>(); |
| 1519 RunPrintAndVerify("Effect and control linearized", true); | 1536 RunPrintAndVerify("Effect and control linearized", true); |
| 1520 | 1537 |
| 1538 Run<CommonOperatorReducerPhase>(); | |
|
Jarin
2016/07/20 11:43:33
Just curious - why is this necessary? (I assume it
bgeron
2016/07/20 16:27:16
To eliminate dead conditional deopts. This is done
| |
| 1539 RunPrintAndVerify("Common operator reducer", true); | |
| 1540 | |
| 1521 if (FLAG_turbo_store_elimination) { | 1541 if (FLAG_turbo_store_elimination) { |
| 1522 Run<StoreStoreEliminationPhase>(); | 1542 Run<StoreStoreEliminationPhase>(); |
| 1523 RunPrintAndVerify("Store-store elimination", true); | 1543 RunPrintAndVerify("Store-store elimination", true); |
| 1524 } | 1544 } |
| 1525 | 1545 |
| 1526 // Optimize control flow. | 1546 // Optimize control flow. |
| 1527 if (FLAG_turbo_cf_optimization) { | 1547 if (FLAG_turbo_cf_optimization) { |
| 1528 Run<ControlFlowOptimizationPhase>(); | 1548 Run<ControlFlowOptimizationPhase>(); |
| 1529 RunPrintAndVerify("Control flow optimized", true); | 1549 RunPrintAndVerify("Control flow optimized", true); |
| 1530 } | 1550 } |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1860 data->DeleteRegisterAllocationZone(); | 1880 data->DeleteRegisterAllocationZone(); |
| 1861 } | 1881 } |
| 1862 | 1882 |
| 1863 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1883 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
| 1864 | 1884 |
| 1865 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1885 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
| 1866 | 1886 |
| 1867 } // namespace compiler | 1887 } // namespace compiler |
| 1868 } // namespace internal | 1888 } // namespace internal |
| 1869 } // namespace v8 | 1889 } // namespace v8 |
| OLD | NEW |