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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 json_of << "\",\n\"phases\":["; | 538 json_of << "\",\n\"phases\":["; |
539 } | 539 } |
540 | 540 |
541 return pipeline_statistics; | 541 return pipeline_statistics; |
542 } | 542 } |
543 | 543 |
544 } // namespace | 544 } // namespace |
545 | 545 |
546 class PipelineCompilationJob final : public CompilationJob { | 546 class PipelineCompilationJob final : public CompilationJob { |
547 public: | 547 public: |
548 PipelineCompilationJob(ParseInfo* parse_info, Handle<JSFunction> function) | 548 PipelineCompilationJob(Isolate* isolate, Handle<JSFunction> function) |
549 // Note that the CompilationInfo is not initialized at the time we pass it | 549 // Note that the CompilationInfo is not initialized at the time we pass it |
550 // to the CompilationJob constructor, but it is not dereferenced there. | 550 // to the CompilationJob constructor, but it is not dereferenced there. |
551 : CompilationJob(parse_info->isolate(), &info_, "TurboFan"), | 551 : CompilationJob(isolate, &info_, "TurboFan"), |
552 parse_info_(parse_info), | 552 parse_info_(handle(function->shared())), |
553 zone_stats_(parse_info->isolate()->allocator()), | 553 zone_stats_(isolate->allocator()), |
554 info_(parse_info_.get()->zone(), parse_info_.get(), function), | 554 info_(parse_info_.zone(), &parse_info_, function), |
555 pipeline_statistics_(CreatePipelineStatistics(info(), &zone_stats_)), | 555 pipeline_statistics_(CreatePipelineStatistics(info(), &zone_stats_)), |
556 data_(&zone_stats_, info(), pipeline_statistics_.get()), | 556 data_(&zone_stats_, info(), pipeline_statistics_.get()), |
557 pipeline_(&data_), | 557 pipeline_(&data_), |
558 linkage_(nullptr) {} | 558 linkage_(nullptr) {} |
559 | 559 |
560 protected: | 560 protected: |
561 Status PrepareJobImpl() final; | 561 Status PrepareJobImpl() final; |
562 Status ExecuteJobImpl() final; | 562 Status ExecuteJobImpl() final; |
563 Status FinalizeJobImpl() final; | 563 Status FinalizeJobImpl() final; |
564 | 564 |
565 private: | 565 private: |
566 std::unique_ptr<ParseInfo> parse_info_; | 566 ParseInfo parse_info_; |
567 ZoneStats zone_stats_; | 567 ZoneStats zone_stats_; |
568 CompilationInfo info_; | 568 CompilationInfo info_; |
569 std::unique_ptr<PipelineStatistics> pipeline_statistics_; | 569 std::unique_ptr<PipelineStatistics> pipeline_statistics_; |
570 PipelineData data_; | 570 PipelineData data_; |
571 PipelineImpl pipeline_; | 571 PipelineImpl pipeline_; |
572 Linkage* linkage_; | 572 Linkage* linkage_; |
573 | 573 |
574 DISALLOW_COPY_AND_ASSIGN(PipelineCompilationJob); | 574 DISALLOW_COPY_AND_ASSIGN(PipelineCompilationJob); |
575 }; | 575 }; |
576 | 576 |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 json_of << "{\"function\":\"" << info->GetDebugName().get() | 1743 json_of << "{\"function\":\"" << info->GetDebugName().get() |
1744 << "\", \"source\":\"\",\n\"phases\":["; | 1744 << "\", \"source\":\"\",\n\"phases\":["; |
1745 } | 1745 } |
1746 // TODO(rossberg): Should this really be untyped? | 1746 // TODO(rossberg): Should this really be untyped? |
1747 pipeline.RunPrintAndVerify("Machine", true); | 1747 pipeline.RunPrintAndVerify("Machine", true); |
1748 | 1748 |
1749 return pipeline.ScheduleAndGenerateCode(call_descriptor); | 1749 return pipeline.ScheduleAndGenerateCode(call_descriptor); |
1750 } | 1750 } |
1751 | 1751 |
1752 // static | 1752 // static |
1753 CompilationJob* Pipeline::NewCompilationJob(Handle<JSFunction> function, | 1753 CompilationJob* Pipeline::NewCompilationJob(Handle<JSFunction> function) { |
1754 bool has_script) { | 1754 return new PipelineCompilationJob(function->GetIsolate(), function); |
1755 Handle<SharedFunctionInfo> shared = handle(function->shared()); | |
1756 ParseInfo* parse_info; | |
1757 if (!has_script) { | |
1758 parse_info = ParseInfo::AllocateWithoutScript(shared); | |
1759 } else { | |
1760 parse_info = new ParseInfo(shared); | |
1761 } | |
1762 return new PipelineCompilationJob(parse_info, function); | |
1763 } | 1755 } |
1764 | 1756 |
1765 // static | 1757 // static |
1766 CompilationJob* Pipeline::NewWasmCompilationJob( | 1758 CompilationJob* Pipeline::NewWasmCompilationJob( |
1767 CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor, | 1759 CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor, |
1768 SourcePositionTable* source_positions, | 1760 SourcePositionTable* source_positions, |
1769 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions, | 1761 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions, |
1770 bool allow_signalling_nan) { | 1762 bool allow_signalling_nan) { |
1771 return new PipelineWasmCompilationJob( | 1763 return new PipelineWasmCompilationJob( |
1772 info, jsgraph, descriptor, source_positions, protected_instructions, | 1764 info, jsgraph, descriptor, source_positions, protected_instructions, |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 data->DeleteRegisterAllocationZone(); | 2019 data->DeleteRegisterAllocationZone(); |
2028 } | 2020 } |
2029 | 2021 |
2030 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 2022 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
2031 | 2023 |
2032 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 2024 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
2033 | 2025 |
2034 } // namespace compiler | 2026 } // namespace compiler |
2035 } // namespace internal | 2027 } // namespace internal |
2036 } // namespace v8 | 2028 } // namespace v8 |
OLD | NEW |