| 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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 }; | 972 }; |
| 973 | 973 |
| 974 struct LoopExitEliminationPhase { | 974 struct LoopExitEliminationPhase { |
| 975 static const char* phase_name() { return "loop exit elimination"; } | 975 static const char* phase_name() { return "loop exit elimination"; } |
| 976 | 976 |
| 977 void Run(PipelineData* data, Zone* temp_zone) { | 977 void Run(PipelineData* data, Zone* temp_zone) { |
| 978 LoopPeeler::EliminateLoopExits(data->graph(), temp_zone); | 978 LoopPeeler::EliminateLoopExits(data->graph(), temp_zone); |
| 979 } | 979 } |
| 980 }; | 980 }; |
| 981 | 981 |
| 982 struct GenericLoweringPrepPhase { |
| 983 static const char* phase_name() { return "generic lowering prep"; } |
| 984 |
| 985 void Run(PipelineData* data, Zone* temp_zone) { |
| 986 // Make sure we cache these code stubs. |
| 987 data->jsgraph()->CEntryStubConstant(1); |
| 988 data->jsgraph()->CEntryStubConstant(2); |
| 989 data->jsgraph()->CEntryStubConstant(3); |
| 990 } |
| 991 }; |
| 992 |
| 982 struct GenericLoweringPhase { | 993 struct GenericLoweringPhase { |
| 983 static const char* phase_name() { return "generic lowering"; } | 994 static const char* phase_name() { return "generic lowering"; } |
| 984 | 995 |
| 985 void Run(PipelineData* data, Zone* temp_zone) { | 996 void Run(PipelineData* data, Zone* temp_zone) { |
| 986 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); | 997 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); |
| 987 JSGenericLowering generic_lowering(data->jsgraph()); | 998 JSGenericLowering generic_lowering(data->jsgraph()); |
| 988 AddReducer(data, &graph_reducer, &generic_lowering); | 999 AddReducer(data, &graph_reducer, &generic_lowering); |
| 989 graph_reducer.ReduceGraph(); | 1000 graph_reducer.ReduceGraph(); |
| 990 } | 1001 } |
| 991 }; | 1002 }; |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1558 // selection due to the way we handle truncations; if we'd want to look | 1569 // selection due to the way we handle truncations; if we'd want to look |
| 1559 // at types afterwards we'd essentially need to re-type (large portions | 1570 // at types afterwards we'd essentially need to re-type (large portions |
| 1560 // of) the graph. | 1571 // of) the graph. |
| 1561 // | 1572 // |
| 1562 // In order to catch bugs related to type access after this point we remove | 1573 // In order to catch bugs related to type access after this point we remove |
| 1563 // the types from the nodes at this point (currently only in Debug builds). | 1574 // the types from the nodes at this point (currently only in Debug builds). |
| 1564 Run<UntyperPhase>(); | 1575 Run<UntyperPhase>(); |
| 1565 RunPrintAndVerify("Untyped", true); | 1576 RunPrintAndVerify("Untyped", true); |
| 1566 #endif | 1577 #endif |
| 1567 | 1578 |
| 1568 // Run generic lowering pass. | 1579 // Do some hacky things to prepare generic lowering. |
| 1569 Run<GenericLoweringPhase>(); | 1580 Run<GenericLoweringPrepPhase>(); |
| 1570 RunPrintAndVerify("Generic lowering", true); | |
| 1571 | 1581 |
| 1572 data->EndPhaseKind(); | 1582 data->EndPhaseKind(); |
| 1573 | 1583 |
| 1574 return true; | 1584 return true; |
| 1575 } | 1585 } |
| 1576 | 1586 |
| 1577 bool PipelineImpl::OptimizeGraph(Linkage* linkage) { | 1587 bool PipelineImpl::OptimizeGraph(Linkage* linkage) { |
| 1578 PipelineData* data = this->data_; | 1588 PipelineData* data = this->data_; |
| 1579 | 1589 |
| 1590 // Run generic lowering pass. |
| 1591 Run<GenericLoweringPhase>(); |
| 1592 RunPrintAndVerify("Generic lowering", true); |
| 1593 |
| 1580 data->BeginPhaseKind("block building"); | 1594 data->BeginPhaseKind("block building"); |
| 1581 | 1595 |
| 1582 // Run early optimization pass. | 1596 // Run early optimization pass. |
| 1583 Run<EarlyOptimizationPhase>(); | 1597 Run<EarlyOptimizationPhase>(); |
| 1584 RunPrintAndVerify("Early optimized", true); | 1598 RunPrintAndVerify("Early optimized", true); |
| 1585 | 1599 |
| 1586 Run<EffectControlLinearizationPhase>(); | 1600 Run<EffectControlLinearizationPhase>(); |
| 1587 RunPrintAndVerify("Effect and control linearized", true); | 1601 RunPrintAndVerify("Effect and control linearized", true); |
| 1588 | 1602 |
| 1589 Run<DeadCodeEliminationPhase>(); | 1603 Run<DeadCodeEliminationPhase>(); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 data->DeleteRegisterAllocationZone(); | 1993 data->DeleteRegisterAllocationZone(); |
| 1980 } | 1994 } |
| 1981 | 1995 |
| 1982 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1996 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
| 1983 | 1997 |
| 1984 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1998 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
| 1985 | 1999 |
| 1986 } // namespace compiler | 2000 } // namespace compiler |
| 1987 } // namespace internal | 2001 } // namespace internal |
| 1988 } // namespace v8 | 2002 } // namespace v8 |
| OLD | NEW |