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