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 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 // Remove dead->live edges from the graph. | 1295 // Remove dead->live edges from the graph. |
1296 Run<EarlyGraphTrimmingPhase>(); | 1296 Run<EarlyGraphTrimmingPhase>(); |
1297 RunPrintAndVerify("Early trimmed", true); | 1297 RunPrintAndVerify("Early trimmed", true); |
1298 | 1298 |
1299 if (FLAG_print_turbo_replay) { | 1299 if (FLAG_print_turbo_replay) { |
1300 // Print a replay of the initial graph. | 1300 // Print a replay of the initial graph. |
1301 GraphReplayPrinter::PrintReplay(data->graph()); | 1301 GraphReplayPrinter::PrintReplay(data->graph()); |
1302 } | 1302 } |
1303 | 1303 |
1304 // Type the graph. | 1304 // Type the graph. |
1305 Typer typer(isolate(), data->graph(), info()->is_deoptimization_enabled() | 1305 base::SmartPointer<Typer> typer; |
1306 ? Typer::kDeoptimizationEnabled | 1306 typer.Reset(new Typer(isolate(), data->graph(), |
1307 : Typer::kNoFlags, | 1307 info()->is_deoptimization_enabled() |
1308 info()->dependencies()); | 1308 ? Typer::kDeoptimizationEnabled |
1309 Run<TyperPhase>(&typer); | 1309 : Typer::kNoFlags, |
| 1310 info()->dependencies())); |
| 1311 Run<TyperPhase>(typer.get()); |
1310 RunPrintAndVerify("Typed"); | 1312 RunPrintAndVerify("Typed"); |
1311 | 1313 |
1312 BeginPhaseKind("lowering"); | 1314 BeginPhaseKind("lowering"); |
1313 | 1315 |
1314 // Lower JSOperators where we can determine types. | 1316 // Lower JSOperators where we can determine types. |
1315 Run<TypedLoweringPhase>(); | 1317 Run<TypedLoweringPhase>(); |
1316 RunPrintAndVerify("Lowered typed"); | 1318 RunPrintAndVerify("Lowered typed"); |
1317 | 1319 |
1318 if (FLAG_turbo_stress_loop_peeling) { | 1320 if (FLAG_turbo_stress_loop_peeling) { |
1319 Run<StressLoopPeelingPhase>(); | 1321 Run<StressLoopPeelingPhase>(); |
1320 RunPrintAndVerify("Loop peeled"); | 1322 RunPrintAndVerify("Loop peeled"); |
1321 } | 1323 } |
1322 | 1324 |
1323 if (FLAG_experimental_turbo_escape) { | 1325 if (FLAG_experimental_turbo_escape) { |
1324 Run<EscapeAnalysisPhase>(); | 1326 Run<EscapeAnalysisPhase>(); |
1325 RunPrintAndVerify("Escape Analysed"); | 1327 RunPrintAndVerify("Escape Analysed"); |
1326 } | 1328 } |
1327 | 1329 |
1328 // Select representations. | 1330 // Select representations. |
1329 Run<RepresentationSelectionPhase>(); | 1331 Run<RepresentationSelectionPhase>(); |
1330 RunPrintAndVerify("Representations selected"); | 1332 RunPrintAndVerify("Representations selected"); |
1331 | 1333 |
1332 // Run early optimization pass. | 1334 // Run early optimization pass. |
1333 Run<EarlyOptimizationPhase>(); | 1335 Run<EarlyOptimizationPhase>(); |
1334 RunPrintAndVerify("Early optimized"); | 1336 RunPrintAndVerify("Early optimized"); |
1335 | 1337 |
| 1338 Run<EffectControlLinearizationPhase>(); |
| 1339 RunPrintAndVerify("Effect and control linearized"); |
| 1340 |
| 1341 Run<BranchEliminationPhase>(); |
| 1342 RunPrintAndVerify("Branch conditions eliminated"); |
| 1343 |
| 1344 // Optimize control flow. |
| 1345 if (FLAG_turbo_cf_optimization) { |
| 1346 Run<ControlFlowOptimizationPhase>(); |
| 1347 RunPrintAndVerify("Control flow optimized"); |
| 1348 } |
| 1349 |
| 1350 // Lower changes that have been inserted before. |
| 1351 Run<LateOptimizationPhase>(); |
| 1352 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. |
| 1353 RunPrintAndVerify("Late optimized", true); |
| 1354 |
| 1355 // Kill the Typer and thereby uninstall the decorator (if any). |
| 1356 typer.Reset(nullptr); |
| 1357 |
1336 EndPhaseKind(); | 1358 EndPhaseKind(); |
1337 | 1359 |
1338 return true; | 1360 return true; |
1339 } | 1361 } |
1340 | 1362 |
1341 bool Pipeline::OptimizeGraph(Linkage* linkage) { | 1363 bool Pipeline::OptimizeGraph(Linkage* linkage) { |
1342 PipelineData* data = this->data_; | 1364 PipelineData* data = this->data_; |
1343 | 1365 |
1344 BeginPhaseKind("block building"); | 1366 BeginPhaseKind("block building"); |
1345 | 1367 |
1346 Run<EffectControlLinearizationPhase>(); | |
1347 RunPrintAndVerify("Effect and control linearized", true); | |
1348 | |
1349 Run<BranchEliminationPhase>(); | |
1350 RunPrintAndVerify("Branch conditions eliminated", true); | |
1351 | |
1352 // Optimize control flow. | |
1353 if (FLAG_turbo_cf_optimization) { | |
1354 Run<ControlFlowOptimizationPhase>(); | |
1355 RunPrintAndVerify("Control flow optimized", true); | |
1356 } | |
1357 | |
1358 // Lower changes that have been inserted before. | |
1359 Run<LateOptimizationPhase>(); | |
1360 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. | |
1361 RunPrintAndVerify("Late optimized", true); | |
1362 | |
1363 Run<LateGraphTrimmingPhase>(); | 1368 Run<LateGraphTrimmingPhase>(); |
1364 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. | 1369 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. |
1365 RunPrintAndVerify("Late trimmed", true); | 1370 RunPrintAndVerify("Late trimmed", true); |
1366 | 1371 |
1367 data->source_positions()->RemoveDecorator(); | 1372 data->source_positions()->RemoveDecorator(); |
1368 | 1373 |
1369 return ScheduleAndSelectInstructions(linkage); | 1374 return ScheduleAndSelectInstructions(linkage); |
1370 } | 1375 } |
1371 | 1376 |
1372 Handle<Code> Pipeline::GenerateCode() { | 1377 Handle<Code> Pipeline::GenerateCode() { |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 data->DeleteRegisterAllocationZone(); | 1698 data->DeleteRegisterAllocationZone(); |
1694 } | 1699 } |
1695 | 1700 |
1696 CompilationInfo* Pipeline::info() const { return data_->info(); } | 1701 CompilationInfo* Pipeline::info() const { return data_->info(); } |
1697 | 1702 |
1698 Isolate* Pipeline::isolate() const { return info()->isolate(); } | 1703 Isolate* Pipeline::isolate() const { return info()->isolate(); } |
1699 | 1704 |
1700 } // namespace compiler | 1705 } // namespace compiler |
1701 } // namespace internal | 1706 } // namespace internal |
1702 } // namespace v8 | 1707 } // namespace v8 |
OLD | NEW |