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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 } | 543 } |
544 | 544 |
545 } // namespace | 545 } // namespace |
546 | 546 |
547 class PipelineCompilationJob final : public CompilationJob { | 547 class PipelineCompilationJob final : public CompilationJob { |
548 public: | 548 public: |
549 PipelineCompilationJob(Isolate* isolate, Handle<JSFunction> function) | 549 PipelineCompilationJob(Isolate* isolate, Handle<JSFunction> function) |
550 // Note that the CompilationInfo is not initialized at the time we pass it | 550 // Note that the CompilationInfo is not initialized at the time we pass it |
551 // to the CompilationJob constructor, but it is not dereferenced there. | 551 // to the CompilationJob constructor, but it is not dereferenced there. |
552 : CompilationJob(isolate, &info_, "TurboFan"), | 552 : CompilationJob(isolate, &info_, "TurboFan"), |
553 zone_(isolate->allocator(), ZONE_NAME), | 553 parse_info_(handle(function->shared())), |
554 zone_stats_(isolate->allocator()), | 554 zone_stats_(isolate->allocator()), |
555 parse_info_(&zone_, handle(function->shared())), | |
556 info_(&parse_info_, function), | 555 info_(&parse_info_, function), |
557 pipeline_statistics_(CreatePipelineStatistics(info(), &zone_stats_)), | 556 pipeline_statistics_(CreatePipelineStatistics(info(), &zone_stats_)), |
558 data_(&zone_stats_, info(), pipeline_statistics_.get()), | 557 data_(&zone_stats_, info(), pipeline_statistics_.get()), |
559 pipeline_(&data_), | 558 pipeline_(&data_), |
560 linkage_(nullptr) {} | 559 linkage_(nullptr) {} |
561 | 560 |
562 protected: | 561 protected: |
563 Status PrepareJobImpl() final; | 562 Status PrepareJobImpl() final; |
564 Status ExecuteJobImpl() final; | 563 Status ExecuteJobImpl() final; |
565 Status FinalizeJobImpl() final; | 564 Status FinalizeJobImpl() final; |
566 | 565 |
567 private: | 566 private: |
568 Zone zone_; | 567 ParseInfo parse_info_; |
569 ZoneStats zone_stats_; | 568 ZoneStats zone_stats_; |
570 ParseInfo parse_info_; | |
571 CompilationInfo info_; | 569 CompilationInfo info_; |
572 std::unique_ptr<PipelineStatistics> pipeline_statistics_; | 570 std::unique_ptr<PipelineStatistics> pipeline_statistics_; |
573 PipelineData data_; | 571 PipelineData data_; |
574 PipelineImpl pipeline_; | 572 PipelineImpl pipeline_; |
575 Linkage* linkage_; | 573 Linkage* linkage_; |
576 | 574 |
577 DISALLOW_COPY_AND_ASSIGN(PipelineCompilationJob); | 575 DISALLOW_COPY_AND_ASSIGN(PipelineCompilationJob); |
578 }; | 576 }; |
579 | 577 |
580 PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl() { | 578 PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl() { |
(...skipping 16 matching lines...) Expand all Loading... |
597 if (FLAG_inline_accessors) { | 595 if (FLAG_inline_accessors) { |
598 info()->MarkAsAccessorInliningEnabled(); | 596 info()->MarkAsAccessorInliningEnabled(); |
599 } | 597 } |
600 } | 598 } |
601 if (!info()->is_optimizing_from_bytecode()) { | 599 if (!info()->is_optimizing_from_bytecode()) { |
602 if (!Compiler::EnsureDeoptimizationSupport(info())) return FAILED; | 600 if (!Compiler::EnsureDeoptimizationSupport(info())) return FAILED; |
603 } else if (FLAG_turbo_inlining) { | 601 } else if (FLAG_turbo_inlining) { |
604 info()->MarkAsInliningEnabled(); | 602 info()->MarkAsInliningEnabled(); |
605 } | 603 } |
606 | 604 |
607 linkage_ = new (&zone_) Linkage(Linkage::ComputeIncoming(&zone_, info())); | 605 linkage_ = new (info()->zone()) |
| 606 Linkage(Linkage::ComputeIncoming(info()->zone(), info())); |
608 | 607 |
609 if (!pipeline_.CreateGraph()) { | 608 if (!pipeline_.CreateGraph()) { |
610 if (isolate()->has_pending_exception()) return FAILED; // Stack overflowed. | 609 if (isolate()->has_pending_exception()) return FAILED; // Stack overflowed. |
611 return AbortOptimization(kGraphBuildingFailed); | 610 return AbortOptimization(kGraphBuildingFailed); |
612 } | 611 } |
613 | 612 |
614 return SUCCEEDED; | 613 return SUCCEEDED; |
615 } | 614 } |
616 | 615 |
617 PipelineCompilationJob::Status PipelineCompilationJob::ExecuteJobImpl() { | 616 PipelineCompilationJob::Status PipelineCompilationJob::ExecuteJobImpl() { |
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2014 data->DeleteRegisterAllocationZone(); | 2013 data->DeleteRegisterAllocationZone(); |
2015 } | 2014 } |
2016 | 2015 |
2017 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 2016 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
2018 | 2017 |
2019 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 2018 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
2020 | 2019 |
2021 } // namespace compiler | 2020 } // namespace compiler |
2022 } // namespace internal | 2021 } // namespace internal |
2023 } // namespace v8 | 2022 } // namespace v8 |
OLD | NEW |