| 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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 typed_lowering_flags |= JSTypedLowering::kDisableIntegerBinaryOpReduction; | 895 typed_lowering_flags |= JSTypedLowering::kDisableIntegerBinaryOpReduction; |
| 896 } | 896 } |
| 897 JSTypedLowering typed_lowering(&graph_reducer, data->info()->dependencies(), | 897 JSTypedLowering typed_lowering(&graph_reducer, data->info()->dependencies(), |
| 898 typed_lowering_flags, data->jsgraph(), | 898 typed_lowering_flags, data->jsgraph(), |
| 899 temp_zone); | 899 temp_zone); |
| 900 JSIntrinsicLowering intrinsic_lowering( | 900 JSIntrinsicLowering intrinsic_lowering( |
| 901 &graph_reducer, data->jsgraph(), | 901 &graph_reducer, data->jsgraph(), |
| 902 data->info()->is_deoptimization_enabled() | 902 data->info()->is_deoptimization_enabled() |
| 903 ? JSIntrinsicLowering::kDeoptimizationEnabled | 903 ? JSIntrinsicLowering::kDeoptimizationEnabled |
| 904 : JSIntrinsicLowering::kDeoptimizationDisabled); | 904 : JSIntrinsicLowering::kDeoptimizationDisabled); |
| 905 ValueNumberingReducer value_numbering(temp_zone, data->graph()->zone()); | |
| 906 SimplifiedOperatorReducer simple_reducer(&graph_reducer, data->jsgraph()); | 905 SimplifiedOperatorReducer simple_reducer(&graph_reducer, data->jsgraph()); |
| 907 CheckpointElimination checkpoint_elimination(&graph_reducer); | 906 CheckpointElimination checkpoint_elimination(&graph_reducer); |
| 908 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), | 907 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), |
| 909 data->common(), data->machine()); | 908 data->common(), data->machine()); |
| 910 AddReducer(data, &graph_reducer, &dead_code_elimination); | 909 AddReducer(data, &graph_reducer, &dead_code_elimination); |
| 911 AddReducer(data, &graph_reducer, &builtin_reducer); | 910 AddReducer(data, &graph_reducer, &builtin_reducer); |
| 912 if (data->info()->is_deoptimization_enabled()) { | 911 if (data->info()->is_deoptimization_enabled()) { |
| 913 AddReducer(data, &graph_reducer, &create_lowering); | 912 AddReducer(data, &graph_reducer, &create_lowering); |
| 914 } | 913 } |
| 915 AddReducer(data, &graph_reducer, &typed_lowering); | 914 AddReducer(data, &graph_reducer, &typed_lowering); |
| 916 AddReducer(data, &graph_reducer, &intrinsic_lowering); | 915 AddReducer(data, &graph_reducer, &intrinsic_lowering); |
| 917 AddReducer(data, &graph_reducer, &value_numbering); | |
| 918 AddReducer(data, &graph_reducer, &simple_reducer); | 916 AddReducer(data, &graph_reducer, &simple_reducer); |
| 919 AddReducer(data, &graph_reducer, &checkpoint_elimination); | 917 AddReducer(data, &graph_reducer, &checkpoint_elimination); |
| 920 AddReducer(data, &graph_reducer, &common_reducer); | 918 AddReducer(data, &graph_reducer, &common_reducer); |
| 921 graph_reducer.ReduceGraph(); | 919 graph_reducer.ReduceGraph(); |
| 922 } | 920 } |
| 923 }; | 921 }; |
| 924 | 922 |
| 925 | 923 |
| 926 struct EscapeAnalysisPhase { | 924 struct EscapeAnalysisPhase { |
| 927 static const char* phase_name() { return "escape analysis"; } | 925 static const char* phase_name() { return "escape analysis"; } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 void Run(PipelineData* data, Zone* temp_zone) { | 1043 void Run(PipelineData* data, Zone* temp_zone) { |
| 1046 StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone); | 1044 StoreStoreElimination store_store_elimination(data->jsgraph(), temp_zone); |
| 1047 store_store_elimination.Run(); | 1045 store_store_elimination.Run(); |
| 1048 } | 1046 } |
| 1049 }; | 1047 }; |
| 1050 | 1048 |
| 1051 struct LoadEliminationPhase { | 1049 struct LoadEliminationPhase { |
| 1052 static const char* phase_name() { return "load elimination"; } | 1050 static const char* phase_name() { return "load elimination"; } |
| 1053 | 1051 |
| 1054 void Run(PipelineData* data, Zone* temp_zone) { | 1052 void Run(PipelineData* data, Zone* temp_zone) { |
| 1055 // The memory optimizer requires the graphs to be trimmed, so trim now. | 1053 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
| 1056 GraphTrimmer trimmer(temp_zone, data->graph()); | 1054 RedundancyElimination redundancy_elimination(&graph_reducer, temp_zone); |
| 1057 NodeVector roots(temp_zone); | 1055 LoadElimination load_elimination(&graph_reducer, temp_zone); |
| 1058 data->jsgraph()->GetCachedNodes(&roots); | 1056 ValueNumberingReducer value_numbering(temp_zone, data->graph()->zone()); |
| 1059 trimmer.TrimGraph(roots.begin(), roots.end()); | 1057 AddReducer(data, &graph_reducer, &redundancy_elimination); |
| 1060 | 1058 AddReducer(data, &graph_reducer, &load_elimination); |
| 1061 // Eliminate redundant loads. | 1059 AddReducer(data, &graph_reducer, &value_numbering); |
| 1062 LoadElimination load_elimination(data->graph(), temp_zone); | 1060 graph_reducer.ReduceGraph(); |
| 1063 load_elimination.Run(); | |
| 1064 } | 1061 } |
| 1065 }; | 1062 }; |
| 1066 | 1063 |
| 1067 struct MemoryOptimizationPhase { | 1064 struct MemoryOptimizationPhase { |
| 1068 static const char* phase_name() { return "memory optimization"; } | 1065 static const char* phase_name() { return "memory optimization"; } |
| 1069 | 1066 |
| 1070 void Run(PipelineData* data, Zone* temp_zone) { | 1067 void Run(PipelineData* data, Zone* temp_zone) { |
| 1071 // The memory optimizer requires the graphs to be trimmed, so trim now. | 1068 // The memory optimizer requires the graphs to be trimmed, so trim now. |
| 1072 GraphTrimmer trimmer(temp_zone, data->graph()); | 1069 GraphTrimmer trimmer(temp_zone, data->graph()); |
| 1073 NodeVector roots(temp_zone); | 1070 NodeVector roots(temp_zone); |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 data->DeleteRegisterAllocationZone(); | 1864 data->DeleteRegisterAllocationZone(); |
| 1868 } | 1865 } |
| 1869 | 1866 |
| 1870 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1867 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
| 1871 | 1868 |
| 1872 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1869 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
| 1873 | 1870 |
| 1874 } // namespace compiler | 1871 } // namespace compiler |
| 1875 } // namespace internal | 1872 } // namespace internal |
| 1876 } // namespace v8 | 1873 } // namespace v8 |
| OLD | NEW |