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