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