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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 RegisterWeakObjectsInOptimizedCode(code); | 633 RegisterWeakObjectsInOptimizedCode(code); |
634 } | 634 } |
635 return SUCCEEDED; | 635 return SUCCEEDED; |
636 } | 636 } |
637 | 637 |
638 class PipelineWasmCompilationJob final : public CompilationJob { | 638 class PipelineWasmCompilationJob final : public CompilationJob { |
639 public: | 639 public: |
640 explicit PipelineWasmCompilationJob( | 640 explicit PipelineWasmCompilationJob( |
641 CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor, | 641 CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor, |
642 SourcePositionTable* source_positions, | 642 SourcePositionTable* source_positions, |
643 ZoneVector<trap_handler::ProtectedInstructionData>* protected_insts) | 643 ZoneVector<trap_handler::ProtectedInstructionData>* protected_insts, |
| 644 bool allow_signalling_nan) |
644 : CompilationJob(info->isolate(), info, "TurboFan", | 645 : CompilationJob(info->isolate(), info, "TurboFan", |
645 State::kReadyToExecute), | 646 State::kReadyToExecute), |
646 zone_stats_(info->isolate()->allocator()), | 647 zone_stats_(info->isolate()->allocator()), |
647 data_(&zone_stats_, info, jsgraph, source_positions, protected_insts), | 648 data_(&zone_stats_, info, jsgraph, source_positions, protected_insts), |
648 pipeline_(&data_), | 649 pipeline_(&data_), |
649 linkage_(descriptor) {} | 650 linkage_(descriptor), |
| 651 allow_signalling_nan_(allow_signalling_nan) {} |
650 | 652 |
651 protected: | 653 protected: |
652 Status PrepareJobImpl() final; | 654 Status PrepareJobImpl() final; |
653 Status ExecuteJobImpl() final; | 655 Status ExecuteJobImpl() final; |
654 Status FinalizeJobImpl() final; | 656 Status FinalizeJobImpl() final; |
655 | 657 |
656 private: | 658 private: |
657 ZoneStats zone_stats_; | 659 ZoneStats zone_stats_; |
658 PipelineData data_; | 660 PipelineData data_; |
659 PipelineImpl pipeline_; | 661 PipelineImpl pipeline_; |
660 Linkage linkage_; | 662 Linkage linkage_; |
| 663 bool allow_signalling_nan_; |
661 }; | 664 }; |
662 | 665 |
663 PipelineWasmCompilationJob::Status | 666 PipelineWasmCompilationJob::Status |
664 PipelineWasmCompilationJob::PrepareJobImpl() { | 667 PipelineWasmCompilationJob::PrepareJobImpl() { |
665 UNREACHABLE(); // Prepare should always be skipped for WasmCompilationJob. | 668 UNREACHABLE(); // Prepare should always be skipped for WasmCompilationJob. |
666 return SUCCEEDED; | 669 return SUCCEEDED; |
667 } | 670 } |
668 | 671 |
669 PipelineWasmCompilationJob::Status | 672 PipelineWasmCompilationJob::Status |
670 PipelineWasmCompilationJob::ExecuteJobImpl() { | 673 PipelineWasmCompilationJob::ExecuteJobImpl() { |
671 if (FLAG_trace_turbo) { | 674 if (FLAG_trace_turbo) { |
672 TurboJsonFile json_of(info(), std::ios_base::trunc); | 675 TurboJsonFile json_of(info(), std::ios_base::trunc); |
673 json_of << "{\"function\":\"" << info()->GetDebugName().get() | 676 json_of << "{\"function\":\"" << info()->GetDebugName().get() |
674 << "\", \"source\":\"\",\n\"phases\":["; | 677 << "\", \"source\":\"\",\n\"phases\":["; |
675 } | 678 } |
676 | 679 |
677 pipeline_.RunPrintAndVerify("Machine", true); | 680 pipeline_.RunPrintAndVerify("Machine", true); |
678 if (FLAG_wasm_opt) { | 681 if (FLAG_wasm_opt) { |
679 PipelineData* data = &data_; | 682 PipelineData* data = &data_; |
680 PipelineRunScope scope(data, "WASM optimization"); | 683 PipelineRunScope scope(data, "WASM optimization"); |
681 JSGraphReducer graph_reducer(data->jsgraph(), scope.zone()); | 684 JSGraphReducer graph_reducer(data->jsgraph(), scope.zone()); |
682 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), | 685 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), |
683 data->common()); | 686 data->common()); |
684 ValueNumberingReducer value_numbering(scope.zone(), data->graph()->zone()); | 687 ValueNumberingReducer value_numbering(scope.zone(), data->graph()->zone()); |
685 MachineOperatorReducer machine_reducer(data->jsgraph()); | 688 MachineOperatorReducer machine_reducer(data->jsgraph(), |
| 689 allow_signalling_nan_); |
686 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), | 690 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), |
687 data->common(), data->machine()); | 691 data->common(), data->machine()); |
688 AddReducer(data, &graph_reducer, &dead_code_elimination); | 692 AddReducer(data, &graph_reducer, &dead_code_elimination); |
689 AddReducer(data, &graph_reducer, &value_numbering); | 693 AddReducer(data, &graph_reducer, &value_numbering); |
690 AddReducer(data, &graph_reducer, &machine_reducer); | 694 AddReducer(data, &graph_reducer, &machine_reducer); |
691 AddReducer(data, &graph_reducer, &common_reducer); | 695 AddReducer(data, &graph_reducer, &common_reducer); |
692 graph_reducer.ReduceGraph(); | 696 graph_reducer.ReduceGraph(); |
693 pipeline_.RunPrintAndVerify("Optimized Machine", true); | 697 pipeline_.RunPrintAndVerify("Optimized Machine", true); |
694 } | 698 } |
695 | 699 |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1742 | 1746 |
1743 // static | 1747 // static |
1744 CompilationJob* Pipeline::NewCompilationJob(Handle<JSFunction> function) { | 1748 CompilationJob* Pipeline::NewCompilationJob(Handle<JSFunction> function) { |
1745 return new PipelineCompilationJob(function->GetIsolate(), function); | 1749 return new PipelineCompilationJob(function->GetIsolate(), function); |
1746 } | 1750 } |
1747 | 1751 |
1748 // static | 1752 // static |
1749 CompilationJob* Pipeline::NewWasmCompilationJob( | 1753 CompilationJob* Pipeline::NewWasmCompilationJob( |
1750 CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor, | 1754 CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor, |
1751 SourcePositionTable* source_positions, | 1755 SourcePositionTable* source_positions, |
1752 ZoneVector<trap_handler::ProtectedInstructionData>* | 1756 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions, |
1753 protected_instructions) { | 1757 bool allow_signalling_nan) { |
1754 return new PipelineWasmCompilationJob( | 1758 return new PipelineWasmCompilationJob( |
1755 info, jsgraph, descriptor, source_positions, protected_instructions); | 1759 info, jsgraph, descriptor, source_positions, protected_instructions, |
| 1760 allow_signalling_nan); |
1756 } | 1761 } |
1757 | 1762 |
1758 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config, | 1763 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config, |
1759 InstructionSequence* sequence, | 1764 InstructionSequence* sequence, |
1760 bool run_verifier) { | 1765 bool run_verifier) { |
1761 CompilationInfo info(ArrayVector("testing"), sequence->isolate(), | 1766 CompilationInfo info(ArrayVector("testing"), sequence->isolate(), |
1762 sequence->zone(), Code::ComputeFlags(Code::STUB)); | 1767 sequence->zone(), Code::ComputeFlags(Code::STUB)); |
1763 ZoneStats zone_stats(sequence->isolate()->allocator()); | 1768 ZoneStats zone_stats(sequence->isolate()->allocator()); |
1764 PipelineData data(&zone_stats, &info, sequence); | 1769 PipelineData data(&zone_stats, &info, sequence); |
1765 PipelineImpl pipeline(&data); | 1770 PipelineImpl pipeline(&data); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 data->DeleteRegisterAllocationZone(); | 2014 data->DeleteRegisterAllocationZone(); |
2010 } | 2015 } |
2011 | 2016 |
2012 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 2017 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
2013 | 2018 |
2014 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 2019 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
2015 | 2020 |
2016 } // namespace compiler | 2021 } // namespace compiler |
2017 } // namespace internal | 2022 } // namespace internal |
2018 } // namespace v8 | 2023 } // namespace v8 |
OLD | NEW |