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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 Linkage linkage_; | 595 Linkage linkage_; |
596 }; | 596 }; |
597 | 597 |
598 PipelineWasmCompilationJob::Status | 598 PipelineWasmCompilationJob::Status |
599 PipelineWasmCompilationJob::CreateGraphImpl() { | 599 PipelineWasmCompilationJob::CreateGraphImpl() { |
600 return SUCCEEDED; | 600 return SUCCEEDED; |
601 } | 601 } |
602 | 602 |
603 PipelineWasmCompilationJob::Status | 603 PipelineWasmCompilationJob::Status |
604 PipelineWasmCompilationJob::OptimizeGraphImpl() { | 604 PipelineWasmCompilationJob::OptimizeGraphImpl() { |
| 605 if (FLAG_trace_turbo) { |
| 606 FILE* json_file = OpenVisualizerLogFile(info(), nullptr, "json", "w+"); |
| 607 if (json_file != nullptr) { |
| 608 OFStream json_of(json_file); |
| 609 json_of << "{\"function\":\"" << info()->GetDebugName().get() |
| 610 << "\", \"source\":\"\",\n\"phases\":["; |
| 611 fclose(json_file); |
| 612 } |
| 613 } |
| 614 |
| 615 pipeline_.RunPrintAndVerify("Machine", true); |
| 616 |
605 if (!pipeline_.ScheduleAndSelectInstructions(&linkage_)) return FAILED; | 617 if (!pipeline_.ScheduleAndSelectInstructions(&linkage_)) return FAILED; |
606 return SUCCEEDED; | 618 return SUCCEEDED; |
607 } | 619 } |
608 | 620 |
609 PipelineWasmCompilationJob::Status | 621 PipelineWasmCompilationJob::Status |
610 PipelineWasmCompilationJob::GenerateCodeImpl() { | 622 PipelineWasmCompilationJob::GenerateCodeImpl() { |
611 pipeline_.GenerateCode(&linkage_); | 623 pipeline_.GenerateCode(&linkage_); |
612 return SUCCEEDED; | 624 return SUCCEEDED; |
613 } | 625 } |
614 | 626 |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 // Construct a pipeline for scheduling and code generation. | 1457 // Construct a pipeline for scheduling and code generation. |
1446 ZonePool zone_pool(info->isolate()->allocator()); | 1458 ZonePool zone_pool(info->isolate()->allocator()); |
1447 PipelineData data(&zone_pool, info, graph, schedule); | 1459 PipelineData data(&zone_pool, info, graph, schedule); |
1448 base::SmartPointer<PipelineStatistics> pipeline_statistics; | 1460 base::SmartPointer<PipelineStatistics> pipeline_statistics; |
1449 if (FLAG_turbo_stats) { | 1461 if (FLAG_turbo_stats) { |
1450 pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool)); | 1462 pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool)); |
1451 pipeline_statistics->BeginPhaseKind("test codegen"); | 1463 pipeline_statistics->BeginPhaseKind("test codegen"); |
1452 } | 1464 } |
1453 | 1465 |
1454 Pipeline pipeline(&data); | 1466 Pipeline pipeline(&data); |
1455 if (data.schedule() == nullptr) { | 1467 |
1456 // TODO(rossberg): Should this really be untyped? | 1468 if (FLAG_trace_turbo) { |
1457 pipeline.RunPrintAndVerify("Machine", true); | 1469 FILE* json_file = OpenVisualizerLogFile(info, nullptr, "json", "w+"); |
| 1470 if (json_file != nullptr) { |
| 1471 OFStream json_of(json_file); |
| 1472 json_of << "{\"function\":\"" << info->GetDebugName().get() |
| 1473 << "\", \"source\":\"\",\n\"phases\":["; |
| 1474 fclose(json_file); |
| 1475 } |
1458 } | 1476 } |
| 1477 // TODO(rossberg): Should this really be untyped? |
| 1478 pipeline.RunPrintAndVerify("Machine", true); |
1459 | 1479 |
1460 return pipeline.ScheduleAndGenerateCode(call_descriptor); | 1480 return pipeline.ScheduleAndGenerateCode(call_descriptor); |
1461 } | 1481 } |
1462 | 1482 |
1463 // static | 1483 // static |
1464 OptimizedCompileJob* Pipeline::NewCompilationJob(CompilationInfo* info) { | 1484 OptimizedCompileJob* Pipeline::NewCompilationJob(CompilationInfo* info) { |
1465 return new PipelineCompilationJob(info); | 1485 return new PipelineCompilationJob(info); |
1466 } | 1486 } |
1467 | 1487 |
1468 // static | 1488 // static |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 data->DeleteRegisterAllocationZone(); | 1718 data->DeleteRegisterAllocationZone(); |
1699 } | 1719 } |
1700 | 1720 |
1701 CompilationInfo* Pipeline::info() const { return data_->info(); } | 1721 CompilationInfo* Pipeline::info() const { return data_->info(); } |
1702 | 1722 |
1703 Isolate* Pipeline::isolate() const { return info()->isolate(); } | 1723 Isolate* Pipeline::isolate() const { return info()->isolate(); } |
1704 | 1724 |
1705 } // namespace compiler | 1725 } // namespace compiler |
1706 } // namespace internal | 1726 } // namespace internal |
1707 } // namespace v8 | 1727 } // namespace v8 |
OLD | NEW |