| 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 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 GraphTrimmer trimmer(temp_zone, data->graph()); | 1168 GraphTrimmer trimmer(temp_zone, data->graph()); |
| 1169 NodeVector roots(temp_zone); | 1169 NodeVector roots(temp_zone); |
| 1170 if (data->jsgraph()) { | 1170 if (data->jsgraph()) { |
| 1171 data->jsgraph()->GetCachedNodes(&roots); | 1171 data->jsgraph()->GetCachedNodes(&roots); |
| 1172 } | 1172 } |
| 1173 trimmer.TrimGraph(roots.begin(), roots.end()); | 1173 trimmer.TrimGraph(roots.begin(), roots.end()); |
| 1174 } | 1174 } |
| 1175 }; | 1175 }; |
| 1176 | 1176 |
| 1177 | 1177 |
| 1178 struct StressLoopPeelingPhase { | |
| 1179 static const char* phase_name() { return "stress loop peeling"; } | |
| 1180 | |
| 1181 void Run(PipelineData* data, Zone* temp_zone) { | |
| 1182 // Peel the first outer loop for testing. | |
| 1183 // TODO(titzer): peel all loops? the N'th loop? Innermost loops? | |
| 1184 LoopTree* loop_tree = LoopFinder::BuildLoopTree(data->graph(), temp_zone); | |
| 1185 if (loop_tree != nullptr && loop_tree->outer_loops().size() > 0) { | |
| 1186 LoopPeeler::Peel(data->graph(), data->common(), loop_tree, | |
| 1187 loop_tree->outer_loops()[0], temp_zone); | |
| 1188 } | |
| 1189 } | |
| 1190 }; | |
| 1191 | |
| 1192 | |
| 1193 struct ComputeSchedulePhase { | 1178 struct ComputeSchedulePhase { |
| 1194 static const char* phase_name() { return "scheduling"; } | 1179 static const char* phase_name() { return "scheduling"; } |
| 1195 | 1180 |
| 1196 void Run(PipelineData* data, Zone* temp_zone) { | 1181 void Run(PipelineData* data, Zone* temp_zone) { |
| 1197 Schedule* schedule = Scheduler::ComputeSchedule( | 1182 Schedule* schedule = Scheduler::ComputeSchedule( |
| 1198 temp_zone, data->graph(), data->info()->is_splitting_enabled() | 1183 temp_zone, data->graph(), data->info()->is_splitting_enabled() |
| 1199 ? Scheduler::kSplitNodes | 1184 ? Scheduler::kSplitNodes |
| 1200 : Scheduler::kNoFlags); | 1185 : Scheduler::kNoFlags); |
| 1201 if (FLAG_turbo_verify) ScheduleVerifier::Run(schedule); | 1186 if (FLAG_turbo_verify) ScheduleVerifier::Run(schedule); |
| 1202 data->set_schedule(schedule); | 1187 data->set_schedule(schedule); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 RunPrintAndVerify("Lowered typed"); | 1513 RunPrintAndVerify("Lowered typed"); |
| 1529 | 1514 |
| 1530 if (data->info()->is_loop_peeling_enabled()) { | 1515 if (data->info()->is_loop_peeling_enabled()) { |
| 1531 Run<LoopPeelingPhase>(); | 1516 Run<LoopPeelingPhase>(); |
| 1532 RunPrintAndVerify("Loops peeled", true); | 1517 RunPrintAndVerify("Loops peeled", true); |
| 1533 } else { | 1518 } else { |
| 1534 Run<LoopExitEliminationPhase>(); | 1519 Run<LoopExitEliminationPhase>(); |
| 1535 RunPrintAndVerify("Loop exits eliminated", true); | 1520 RunPrintAndVerify("Loop exits eliminated", true); |
| 1536 } | 1521 } |
| 1537 | 1522 |
| 1538 if (FLAG_turbo_stress_loop_peeling) { | |
| 1539 Run<StressLoopPeelingPhase>(); | |
| 1540 RunPrintAndVerify("Loop peeled"); | |
| 1541 } | |
| 1542 | |
| 1543 if (!info()->shared_info()->asm_function()) { | 1523 if (!info()->shared_info()->asm_function()) { |
| 1544 if (FLAG_turbo_load_elimination) { | 1524 if (FLAG_turbo_load_elimination) { |
| 1545 Run<LoadEliminationPhase>(); | 1525 Run<LoadEliminationPhase>(); |
| 1546 RunPrintAndVerify("Load eliminated"); | 1526 RunPrintAndVerify("Load eliminated"); |
| 1547 } | 1527 } |
| 1548 | 1528 |
| 1549 if (FLAG_turbo_escape) { | 1529 if (FLAG_turbo_escape) { |
| 1550 Run<EscapeAnalysisPhase>(); | 1530 Run<EscapeAnalysisPhase>(); |
| 1551 if (data->compilation_failed()) { | 1531 if (data->compilation_failed()) { |
| 1552 info()->AbortOptimization(kCyclicObjectStateDetectedInEscapeAnalysis); | 1532 info()->AbortOptimization(kCyclicObjectStateDetectedInEscapeAnalysis); |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1999 data->DeleteRegisterAllocationZone(); | 1979 data->DeleteRegisterAllocationZone(); |
| 2000 } | 1980 } |
| 2001 | 1981 |
| 2002 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1982 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
| 2003 | 1983 |
| 2004 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1984 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
| 2005 | 1985 |
| 2006 } // namespace compiler | 1986 } // namespace compiler |
| 2007 } // namespace internal | 1987 } // namespace internal |
| 2008 } // namespace v8 | 1988 } // namespace v8 |
| OLD | NEW |