Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: src/compiler/pipeline.cc

Issue 2183033002: [turbofan] Run JSGenericLowering as separate phase. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 }; 966 };
967 967
968 struct LoopExitEliminationPhase { 968 struct LoopExitEliminationPhase {
969 static const char* phase_name() { return "loop exit elimination"; } 969 static const char* phase_name() { return "loop exit elimination"; }
970 970
971 void Run(PipelineData* data, Zone* temp_zone) { 971 void Run(PipelineData* data, Zone* temp_zone) {
972 LoopPeeler::EliminateLoopExits(data->graph(), temp_zone); 972 LoopPeeler::EliminateLoopExits(data->graph(), temp_zone);
973 } 973 }
974 }; 974 };
975 975
976 struct GenericLoweringPhase {
977 static const char* phase_name() { return "generic lowering"; }
978
979 void Run(PipelineData* data, Zone* temp_zone) {
980 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
981 JSGenericLowering generic_lowering(data->jsgraph());
982 AddReducer(data, &graph_reducer, &generic_lowering);
983 graph_reducer.ReduceGraph();
984 }
985 };
986
976 struct EarlyOptimizationPhase { 987 struct EarlyOptimizationPhase {
977 static const char* phase_name() { return "early optimization"; } 988 static const char* phase_name() { return "early optimization"; }
978 989
979 void Run(PipelineData* data, Zone* temp_zone) { 990 void Run(PipelineData* data, Zone* temp_zone) {
980 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 991 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
981 JSGenericLowering generic_lowering(data->jsgraph());
982 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), 992 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
983 data->common()); 993 data->common());
984 SimplifiedOperatorReducer simple_reducer(&graph_reducer, data->jsgraph()); 994 SimplifiedOperatorReducer simple_reducer(&graph_reducer, data->jsgraph());
985 RedundancyElimination redundancy_elimination(&graph_reducer, temp_zone); 995 RedundancyElimination redundancy_elimination(&graph_reducer, temp_zone);
986 ValueNumberingReducer value_numbering(temp_zone, data->graph()->zone()); 996 ValueNumberingReducer value_numbering(temp_zone, data->graph()->zone());
987 MachineOperatorReducer machine_reducer(data->jsgraph()); 997 MachineOperatorReducer machine_reducer(data->jsgraph());
988 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), 998 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
989 data->common(), data->machine()); 999 data->common(), data->machine());
990 AddReducer(data, &graph_reducer, &dead_code_elimination); 1000 AddReducer(data, &graph_reducer, &dead_code_elimination);
991 AddReducer(data, &graph_reducer, &simple_reducer); 1001 AddReducer(data, &graph_reducer, &simple_reducer);
992 AddReducer(data, &graph_reducer, &redundancy_elimination); 1002 AddReducer(data, &graph_reducer, &redundancy_elimination);
993 AddReducer(data, &graph_reducer, &generic_lowering);
994 AddReducer(data, &graph_reducer, &value_numbering); 1003 AddReducer(data, &graph_reducer, &value_numbering);
995 AddReducer(data, &graph_reducer, &machine_reducer); 1004 AddReducer(data, &graph_reducer, &machine_reducer);
996 AddReducer(data, &graph_reducer, &common_reducer); 1005 AddReducer(data, &graph_reducer, &common_reducer);
997 graph_reducer.ReduceGraph(); 1006 graph_reducer.ReduceGraph();
998 } 1007 }
999 }; 1008 };
1000 1009
1001 struct ControlFlowOptimizationPhase { 1010 struct ControlFlowOptimizationPhase {
1002 static const char* phase_name() { return "control flow optimization"; } 1011 static const char* phase_name() { return "control flow optimization"; }
1003 1012
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 // selection due to the way we handle truncations; if we'd want to look 1509 // selection due to the way we handle truncations; if we'd want to look
1501 // at types afterwards we'd essentially need to re-type (large portions 1510 // at types afterwards we'd essentially need to re-type (large portions
1502 // of) the graph. 1511 // of) the graph.
1503 // 1512 //
1504 // In order to catch bugs related to type access after this point we remove 1513 // In order to catch bugs related to type access after this point we remove
1505 // the types from the nodes at this point (currently only in Debug builds). 1514 // the types from the nodes at this point (currently only in Debug builds).
1506 Run<UntyperPhase>(); 1515 Run<UntyperPhase>();
1507 RunPrintAndVerify("Untyped", true); 1516 RunPrintAndVerify("Untyped", true);
1508 #endif 1517 #endif
1509 1518
1510 // Run early optimization pass. 1519 // Run generic lowering pass.
1511 Run<EarlyOptimizationPhase>(); 1520 Run<GenericLoweringPhase>();
1512 RunPrintAndVerify("Early optimized", true); 1521 RunPrintAndVerify("Generic lowering", true);
1513 1522
1514 data->EndPhaseKind(); 1523 data->EndPhaseKind();
1515 1524
1516 return true; 1525 return true;
1517 } 1526 }
1518 1527
1519 bool PipelineImpl::OptimizeGraph(Linkage* linkage) { 1528 bool PipelineImpl::OptimizeGraph(Linkage* linkage) {
1520 PipelineData* data = this->data_; 1529 PipelineData* data = this->data_;
1521 1530
1522 data->BeginPhaseKind("block building"); 1531 data->BeginPhaseKind("block building");
1523 1532
1533 // Run early optimization pass.
1534 Run<EarlyOptimizationPhase>();
1535 RunPrintAndVerify("Early optimized", true);
1536
1524 Run<EffectControlLinearizationPhase>(); 1537 Run<EffectControlLinearizationPhase>();
1525 RunPrintAndVerify("Effect and control linearized", true); 1538 RunPrintAndVerify("Effect and control linearized", true);
1526 1539
1527 if (FLAG_turbo_store_elimination) { 1540 if (FLAG_turbo_store_elimination) {
1528 Run<StoreStoreEliminationPhase>(); 1541 Run<StoreStoreEliminationPhase>();
1529 RunPrintAndVerify("Store-store elimination", true); 1542 RunPrintAndVerify("Store-store elimination", true);
1530 } 1543 }
1531 1544
1532 // Optimize control flow. 1545 // Optimize control flow.
1533 if (FLAG_turbo_cf_optimization) { 1546 if (FLAG_turbo_cf_optimization) {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 data->DeleteRegisterAllocationZone(); 1879 data->DeleteRegisterAllocationZone();
1867 } 1880 }
1868 1881
1869 CompilationInfo* PipelineImpl::info() const { return data_->info(); } 1882 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
1870 1883
1871 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } 1884 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
1872 1885
1873 } // namespace compiler 1886 } // namespace compiler
1874 } // namespace internal 1887 } // namespace internal
1875 } // namespace v8 1888 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698