Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: src/compiler/pipeline.cc

Issue 2401173002: Version 5.6.1.1 (cherry-pick) (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/move-optimizer.cc ('k') | src/compiler/pipeline-statistics.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 #include "src/compiler/simplified-lowering.h" 63 #include "src/compiler/simplified-lowering.h"
64 #include "src/compiler/simplified-operator-reducer.h" 64 #include "src/compiler/simplified-operator-reducer.h"
65 #include "src/compiler/simplified-operator.h" 65 #include "src/compiler/simplified-operator.h"
66 #include "src/compiler/store-store-elimination.h" 66 #include "src/compiler/store-store-elimination.h"
67 #include "src/compiler/tail-call-optimization.h" 67 #include "src/compiler/tail-call-optimization.h"
68 #include "src/compiler/type-hint-analyzer.h" 68 #include "src/compiler/type-hint-analyzer.h"
69 #include "src/compiler/typed-optimization.h" 69 #include "src/compiler/typed-optimization.h"
70 #include "src/compiler/typer.h" 70 #include "src/compiler/typer.h"
71 #include "src/compiler/value-numbering-reducer.h" 71 #include "src/compiler/value-numbering-reducer.h"
72 #include "src/compiler/verifier.h" 72 #include "src/compiler/verifier.h"
73 #include "src/compiler/zone-stats.h" 73 #include "src/compiler/zone-pool.h"
74 #include "src/isolate-inl.h" 74 #include "src/isolate-inl.h"
75 #include "src/ostreams.h" 75 #include "src/ostreams.h"
76 #include "src/parsing/parse-info.h" 76 #include "src/parsing/parse-info.h"
77 #include "src/register-configuration.h" 77 #include "src/register-configuration.h"
78 #include "src/type-info.h" 78 #include "src/type-info.h"
79 #include "src/utils.h" 79 #include "src/utils.h"
80 80
81 namespace v8 { 81 namespace v8 {
82 namespace internal { 82 namespace internal {
83 namespace compiler { 83 namespace compiler {
84 84
85 class PipelineData { 85 class PipelineData {
86 public: 86 public:
87 // For main entry point. 87 // For main entry point.
88 PipelineData(ZoneStats* zone_stats, CompilationInfo* info, 88 PipelineData(ZonePool* zone_pool, CompilationInfo* info,
89 PipelineStatistics* pipeline_statistics) 89 PipelineStatistics* pipeline_statistics)
90 : isolate_(info->isolate()), 90 : isolate_(info->isolate()),
91 info_(info), 91 info_(info),
92 debug_name_(info_->GetDebugName()), 92 debug_name_(info_->GetDebugName()),
93 outer_zone_(info_->zone()), 93 outer_zone_(info_->zone()),
94 zone_stats_(zone_stats), 94 zone_pool_(zone_pool),
95 pipeline_statistics_(pipeline_statistics), 95 pipeline_statistics_(pipeline_statistics),
96 graph_zone_scope_(zone_stats_), 96 graph_zone_scope_(zone_pool_),
97 graph_zone_(graph_zone_scope_.zone()), 97 graph_zone_(graph_zone_scope_.zone()),
98 instruction_zone_scope_(zone_stats_), 98 instruction_zone_scope_(zone_pool_),
99 instruction_zone_(instruction_zone_scope_.zone()), 99 instruction_zone_(instruction_zone_scope_.zone()),
100 register_allocation_zone_scope_(zone_stats_), 100 register_allocation_zone_scope_(zone_pool_),
101 register_allocation_zone_(register_allocation_zone_scope_.zone()) { 101 register_allocation_zone_(register_allocation_zone_scope_.zone()) {
102 PhaseScope scope(pipeline_statistics, "init pipeline data"); 102 PhaseScope scope(pipeline_statistics, "init pipeline data");
103 graph_ = new (graph_zone_) Graph(graph_zone_); 103 graph_ = new (graph_zone_) Graph(graph_zone_);
104 source_positions_ = new (graph_zone_) SourcePositionTable(graph_); 104 source_positions_ = new (graph_zone_) SourcePositionTable(graph_);
105 simplified_ = new (graph_zone_) SimplifiedOperatorBuilder(graph_zone_); 105 simplified_ = new (graph_zone_) SimplifiedOperatorBuilder(graph_zone_);
106 machine_ = new (graph_zone_) MachineOperatorBuilder( 106 machine_ = new (graph_zone_) MachineOperatorBuilder(
107 graph_zone_, MachineType::PointerRepresentation(), 107 graph_zone_, MachineType::PointerRepresentation(),
108 InstructionSelector::SupportedMachineOperatorFlags(), 108 InstructionSelector::SupportedMachineOperatorFlags(),
109 InstructionSelector::AlignmentRequirements()); 109 InstructionSelector::AlignmentRequirements());
110 common_ = new (graph_zone_) CommonOperatorBuilder(graph_zone_); 110 common_ = new (graph_zone_) CommonOperatorBuilder(graph_zone_);
111 javascript_ = new (graph_zone_) JSOperatorBuilder(graph_zone_); 111 javascript_ = new (graph_zone_) JSOperatorBuilder(graph_zone_);
112 jsgraph_ = new (graph_zone_) 112 jsgraph_ = new (graph_zone_)
113 JSGraph(isolate_, graph_, common_, javascript_, simplified_, machine_); 113 JSGraph(isolate_, graph_, common_, javascript_, simplified_, machine_);
114 } 114 }
115 115
116 // For WASM compile entry point. 116 // For WASM compile entry point.
117 PipelineData(ZoneStats* zone_stats, CompilationInfo* info, Graph* graph, 117 PipelineData(ZonePool* zone_pool, CompilationInfo* info, Graph* graph,
118 SourcePositionTable* source_positions) 118 SourcePositionTable* source_positions)
119 : isolate_(info->isolate()), 119 : isolate_(info->isolate()),
120 info_(info), 120 info_(info),
121 debug_name_(info_->GetDebugName()), 121 debug_name_(info_->GetDebugName()),
122 zone_stats_(zone_stats), 122 zone_pool_(zone_pool),
123 graph_zone_scope_(zone_stats_), 123 graph_zone_scope_(zone_pool_),
124 graph_(graph), 124 graph_(graph),
125 source_positions_(source_positions), 125 source_positions_(source_positions),
126 instruction_zone_scope_(zone_stats_), 126 instruction_zone_scope_(zone_pool_),
127 instruction_zone_(instruction_zone_scope_.zone()), 127 instruction_zone_(instruction_zone_scope_.zone()),
128 register_allocation_zone_scope_(zone_stats_), 128 register_allocation_zone_scope_(zone_pool_),
129 register_allocation_zone_(register_allocation_zone_scope_.zone()) {} 129 register_allocation_zone_(register_allocation_zone_scope_.zone()) {}
130 130
131 // For machine graph testing entry point. 131 // For machine graph testing entry point.
132 PipelineData(ZoneStats* zone_stats, CompilationInfo* info, Graph* graph, 132 PipelineData(ZonePool* zone_pool, CompilationInfo* info, Graph* graph,
133 Schedule* schedule) 133 Schedule* schedule)
134 : isolate_(info->isolate()), 134 : isolate_(info->isolate()),
135 info_(info), 135 info_(info),
136 debug_name_(info_->GetDebugName()), 136 debug_name_(info_->GetDebugName()),
137 zone_stats_(zone_stats), 137 zone_pool_(zone_pool),
138 graph_zone_scope_(zone_stats_), 138 graph_zone_scope_(zone_pool_),
139 graph_(graph), 139 graph_(graph),
140 source_positions_(new (info->zone()) SourcePositionTable(graph_)), 140 source_positions_(new (info->zone()) SourcePositionTable(graph_)),
141 schedule_(schedule), 141 schedule_(schedule),
142 instruction_zone_scope_(zone_stats_), 142 instruction_zone_scope_(zone_pool_),
143 instruction_zone_(instruction_zone_scope_.zone()), 143 instruction_zone_(instruction_zone_scope_.zone()),
144 register_allocation_zone_scope_(zone_stats_), 144 register_allocation_zone_scope_(zone_pool_),
145 register_allocation_zone_(register_allocation_zone_scope_.zone()) {} 145 register_allocation_zone_(register_allocation_zone_scope_.zone()) {}
146 146
147 // For register allocation testing entry point. 147 // For register allocation testing entry point.
148 PipelineData(ZoneStats* zone_stats, CompilationInfo* info, 148 PipelineData(ZonePool* zone_pool, CompilationInfo* info,
149 InstructionSequence* sequence) 149 InstructionSequence* sequence)
150 : isolate_(info->isolate()), 150 : isolate_(info->isolate()),
151 info_(info), 151 info_(info),
152 debug_name_(info_->GetDebugName()), 152 debug_name_(info_->GetDebugName()),
153 zone_stats_(zone_stats), 153 zone_pool_(zone_pool),
154 graph_zone_scope_(zone_stats_), 154 graph_zone_scope_(zone_pool_),
155 instruction_zone_scope_(zone_stats_), 155 instruction_zone_scope_(zone_pool_),
156 instruction_zone_(sequence->zone()), 156 instruction_zone_(sequence->zone()),
157 sequence_(sequence), 157 sequence_(sequence),
158 register_allocation_zone_scope_(zone_stats_), 158 register_allocation_zone_scope_(zone_pool_),
159 register_allocation_zone_(register_allocation_zone_scope_.zone()) {} 159 register_allocation_zone_(register_allocation_zone_scope_.zone()) {}
160 160
161 ~PipelineData() { 161 ~PipelineData() {
162 DeleteRegisterAllocationZone(); 162 DeleteRegisterAllocationZone();
163 DeleteInstructionZone(); 163 DeleteInstructionZone();
164 DeleteGraphZone(); 164 DeleteGraphZone();
165 } 165 }
166 166
167 Isolate* isolate() const { return isolate_; } 167 Isolate* isolate() const { return isolate_; }
168 CompilationInfo* info() const { return info_; } 168 CompilationInfo* info() const { return info_; }
169 ZoneStats* zone_stats() const { return zone_stats_; } 169 ZonePool* zone_pool() const { return zone_pool_; }
170 PipelineStatistics* pipeline_statistics() { return pipeline_statistics_; } 170 PipelineStatistics* pipeline_statistics() { return pipeline_statistics_; }
171 bool compilation_failed() const { return compilation_failed_; } 171 bool compilation_failed() const { return compilation_failed_; }
172 void set_compilation_failed() { compilation_failed_ = true; } 172 void set_compilation_failed() { compilation_failed_ = true; }
173 Handle<Code> code() { return code_; } 173 Handle<Code> code() { return code_; }
174 void set_code(Handle<Code> code) { 174 void set_code(Handle<Code> code) {
175 DCHECK(code_.is_null()); 175 DCHECK(code_.is_null());
176 code_ = code; 176 code_ = code;
177 } 177 }
178 178
179 // RawMachineAssembler generally produces graphs which cannot be verified. 179 // RawMachineAssembler generally produces graphs which cannot be verified.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 if (pipeline_statistics() != nullptr) { 306 if (pipeline_statistics() != nullptr) {
307 pipeline_statistics()->EndPhaseKind(); 307 pipeline_statistics()->EndPhaseKind();
308 } 308 }
309 } 309 }
310 310
311 private: 311 private:
312 Isolate* const isolate_; 312 Isolate* const isolate_;
313 CompilationInfo* const info_; 313 CompilationInfo* const info_;
314 std::unique_ptr<char[]> debug_name_; 314 std::unique_ptr<char[]> debug_name_;
315 Zone* outer_zone_ = nullptr; 315 Zone* outer_zone_ = nullptr;
316 ZoneStats* const zone_stats_; 316 ZonePool* const zone_pool_;
317 PipelineStatistics* pipeline_statistics_ = nullptr; 317 PipelineStatistics* pipeline_statistics_ = nullptr;
318 bool compilation_failed_ = false; 318 bool compilation_failed_ = false;
319 Handle<Code> code_ = Handle<Code>::null(); 319 Handle<Code> code_ = Handle<Code>::null();
320 320
321 // All objects in the following group of fields are allocated in graph_zone_. 321 // All objects in the following group of fields are allocated in graph_zone_.
322 // They are all set to nullptr when the graph_zone_ is destroyed. 322 // They are all set to nullptr when the graph_zone_ is destroyed.
323 ZoneStats::Scope graph_zone_scope_; 323 ZonePool::Scope graph_zone_scope_;
324 Zone* graph_zone_ = nullptr; 324 Zone* graph_zone_ = nullptr;
325 Graph* graph_ = nullptr; 325 Graph* graph_ = nullptr;
326 SourcePositionTable* source_positions_ = nullptr; 326 SourcePositionTable* source_positions_ = nullptr;
327 LoopAssignmentAnalysis* loop_assignment_ = nullptr; 327 LoopAssignmentAnalysis* loop_assignment_ = nullptr;
328 TypeHintAnalysis* type_hint_analysis_ = nullptr; 328 TypeHintAnalysis* type_hint_analysis_ = nullptr;
329 SimplifiedOperatorBuilder* simplified_ = nullptr; 329 SimplifiedOperatorBuilder* simplified_ = nullptr;
330 MachineOperatorBuilder* machine_ = nullptr; 330 MachineOperatorBuilder* machine_ = nullptr;
331 CommonOperatorBuilder* common_ = nullptr; 331 CommonOperatorBuilder* common_ = nullptr;
332 JSOperatorBuilder* javascript_ = nullptr; 332 JSOperatorBuilder* javascript_ = nullptr;
333 JSGraph* jsgraph_ = nullptr; 333 JSGraph* jsgraph_ = nullptr;
334 Schedule* schedule_ = nullptr; 334 Schedule* schedule_ = nullptr;
335 335
336 // All objects in the following group of fields are allocated in 336 // All objects in the following group of fields are allocated in
337 // instruction_zone_. They are all set to nullptr when the instruction_zone_ 337 // instruction_zone_. They are all set to nullptr when the instruction_zone_
338 // is 338 // is
339 // destroyed. 339 // destroyed.
340 ZoneStats::Scope instruction_zone_scope_; 340 ZonePool::Scope instruction_zone_scope_;
341 Zone* instruction_zone_; 341 Zone* instruction_zone_;
342 InstructionSequence* sequence_ = nullptr; 342 InstructionSequence* sequence_ = nullptr;
343 Frame* frame_ = nullptr; 343 Frame* frame_ = nullptr;
344 344
345 // All objects in the following group of fields are allocated in 345 // All objects in the following group of fields are allocated in
346 // register_allocation_zone_. They are all set to nullptr when the zone is 346 // register_allocation_zone_. They are all set to nullptr when the zone is
347 // destroyed. 347 // destroyed.
348 ZoneStats::Scope register_allocation_zone_scope_; 348 ZonePool::Scope register_allocation_zone_scope_;
349 Zone* register_allocation_zone_; 349 Zone* register_allocation_zone_;
350 RegisterAllocationData* register_allocation_data_ = nullptr; 350 RegisterAllocationData* register_allocation_data_ = nullptr;
351 351
352 // Basic block profiling support. 352 // Basic block profiling support.
353 BasicBlockProfiler::Data* profiler_data_ = nullptr; 353 BasicBlockProfiler::Data* profiler_data_ = nullptr;
354 354
355 // Source position output for --trace-turbo. 355 // Source position output for --trace-turbo.
356 std::string source_position_output_; 356 std::string source_position_output_;
357 357
358 int CalculateFixedFrameSize(CallDescriptor* descriptor) { 358 int CalculateFixedFrameSize(CallDescriptor* descriptor) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 511 }
512 } 512 }
513 513
514 514
515 class PipelineRunScope { 515 class PipelineRunScope {
516 public: 516 public:
517 PipelineRunScope(PipelineData* data, const char* phase_name) 517 PipelineRunScope(PipelineData* data, const char* phase_name)
518 : phase_scope_( 518 : phase_scope_(
519 phase_name == nullptr ? nullptr : data->pipeline_statistics(), 519 phase_name == nullptr ? nullptr : data->pipeline_statistics(),
520 phase_name), 520 phase_name),
521 zone_scope_(data->zone_stats()) {} 521 zone_scope_(data->zone_pool()) {}
522 522
523 Zone* zone() { return zone_scope_.zone(); } 523 Zone* zone() { return zone_scope_.zone(); }
524 524
525 private: 525 private:
526 PhaseScope phase_scope_; 526 PhaseScope phase_scope_;
527 ZoneStats::Scope zone_scope_; 527 ZonePool::Scope zone_scope_;
528 }; 528 };
529 529
530 PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info, 530 PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info,
531 ZoneStats* zone_stats) { 531 ZonePool* zone_pool) {
532 PipelineStatistics* pipeline_statistics = nullptr; 532 PipelineStatistics* pipeline_statistics = nullptr;
533 533
534 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { 534 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) {
535 pipeline_statistics = new PipelineStatistics(info, zone_stats); 535 pipeline_statistics = new PipelineStatistics(info, zone_pool);
536 pipeline_statistics->BeginPhaseKind("initializing"); 536 pipeline_statistics->BeginPhaseKind("initializing");
537 } 537 }
538 538
539 if (FLAG_trace_turbo) { 539 if (FLAG_trace_turbo) {
540 TurboJsonFile json_of(info, std::ios_base::trunc); 540 TurboJsonFile json_of(info, std::ios_base::trunc);
541 Handle<Script> script = info->script(); 541 Handle<Script> script = info->script();
542 std::unique_ptr<char[]> function_name = info->GetDebugName(); 542 std::unique_ptr<char[]> function_name = info->GetDebugName();
543 int pos = info->shared_info()->start_position(); 543 int pos = info->shared_info()->start_position();
544 json_of << "{\"function\":\"" << function_name.get() 544 json_of << "{\"function\":\"" << function_name.get()
545 << "\", \"sourcePosition\":" << pos << ", \"source\":\""; 545 << "\", \"sourcePosition\":" << pos << ", \"source\":\"";
(...skipping 16 matching lines...) Expand all
562 562
563 } // namespace 563 } // namespace
564 564
565 class PipelineCompilationJob final : public CompilationJob { 565 class PipelineCompilationJob final : public CompilationJob {
566 public: 566 public:
567 PipelineCompilationJob(Isolate* isolate, Handle<JSFunction> function) 567 PipelineCompilationJob(Isolate* isolate, Handle<JSFunction> function)
568 // Note that the CompilationInfo is not initialized at the time we pass it 568 // Note that the CompilationInfo is not initialized at the time we pass it
569 // to the CompilationJob constructor, but it is not dereferenced there. 569 // to the CompilationJob constructor, but it is not dereferenced there.
570 : CompilationJob(isolate, &info_, "TurboFan"), 570 : CompilationJob(isolate, &info_, "TurboFan"),
571 zone_(isolate->allocator()), 571 zone_(isolate->allocator()),
572 zone_stats_(isolate->allocator()), 572 zone_pool_(isolate->allocator()),
573 parse_info_(&zone_, function), 573 parse_info_(&zone_, function),
574 info_(&parse_info_, function), 574 info_(&parse_info_, function),
575 pipeline_statistics_(CreatePipelineStatistics(info(), &zone_stats_)), 575 pipeline_statistics_(CreatePipelineStatistics(info(), &zone_pool_)),
576 data_(&zone_stats_, info(), pipeline_statistics_.get()), 576 data_(&zone_pool_, info(), pipeline_statistics_.get()),
577 pipeline_(&data_), 577 pipeline_(&data_),
578 linkage_(nullptr) {} 578 linkage_(nullptr) {}
579 579
580 protected: 580 protected:
581 Status PrepareJobImpl() final; 581 Status PrepareJobImpl() final;
582 Status ExecuteJobImpl() final; 582 Status ExecuteJobImpl() final;
583 Status FinalizeJobImpl() final; 583 Status FinalizeJobImpl() final;
584 584
585 private: 585 private:
586 Zone zone_; 586 Zone zone_;
587 ZoneStats zone_stats_; 587 ZonePool zone_pool_;
588 ParseInfo parse_info_; 588 ParseInfo parse_info_;
589 CompilationInfo info_; 589 CompilationInfo info_;
590 std::unique_ptr<PipelineStatistics> pipeline_statistics_; 590 std::unique_ptr<PipelineStatistics> pipeline_statistics_;
591 PipelineData data_; 591 PipelineData data_;
592 PipelineImpl pipeline_; 592 PipelineImpl pipeline_;
593 Linkage* linkage_; 593 Linkage* linkage_;
594 594
595 DISALLOW_COPY_AND_ASSIGN(PipelineCompilationJob); 595 DISALLOW_COPY_AND_ASSIGN(PipelineCompilationJob);
596 }; 596 };
597 597
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 return SUCCEEDED; 655 return SUCCEEDED;
656 } 656 }
657 657
658 class PipelineWasmCompilationJob final : public CompilationJob { 658 class PipelineWasmCompilationJob final : public CompilationJob {
659 public: 659 public:
660 explicit PipelineWasmCompilationJob(CompilationInfo* info, Graph* graph, 660 explicit PipelineWasmCompilationJob(CompilationInfo* info, Graph* graph,
661 CallDescriptor* descriptor, 661 CallDescriptor* descriptor,
662 SourcePositionTable* source_positions) 662 SourcePositionTable* source_positions)
663 : CompilationJob(info->isolate(), info, "TurboFan", 663 : CompilationJob(info->isolate(), info, "TurboFan",
664 State::kReadyToExecute), 664 State::kReadyToExecute),
665 zone_stats_(info->isolate()->allocator()), 665 zone_pool_(info->isolate()->allocator()),
666 data_(&zone_stats_, info, graph, source_positions), 666 data_(&zone_pool_, info, graph, source_positions),
667 pipeline_(&data_), 667 pipeline_(&data_),
668 linkage_(descriptor) {} 668 linkage_(descriptor) {}
669 669
670 protected: 670 protected:
671 Status PrepareJobImpl() final; 671 Status PrepareJobImpl() final;
672 Status ExecuteJobImpl() final; 672 Status ExecuteJobImpl() final;
673 Status FinalizeJobImpl() final; 673 Status FinalizeJobImpl() final;
674 674
675 private: 675 private:
676 ZoneStats zone_stats_; 676 ZonePool zone_pool_;
677 PipelineData data_; 677 PipelineData data_;
678 PipelineImpl pipeline_; 678 PipelineImpl pipeline_;
679 Linkage linkage_; 679 Linkage linkage_;
680 }; 680 };
681 681
682 PipelineWasmCompilationJob::Status 682 PipelineWasmCompilationJob::Status
683 PipelineWasmCompilationJob::PrepareJobImpl() { 683 PipelineWasmCompilationJob::PrepareJobImpl() {
684 UNREACHABLE(); // Prepare should always be skipped for WasmCompilationJob. 684 UNREACHABLE(); // Prepare should always be skipped for WasmCompilationJob.
685 return SUCCEEDED; 685 return SUCCEEDED;
686 } 686 }
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 1664
1665 Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate, 1665 Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate,
1666 CallDescriptor* call_descriptor, 1666 CallDescriptor* call_descriptor,
1667 Graph* graph, Schedule* schedule, 1667 Graph* graph, Schedule* schedule,
1668 Code::Flags flags, 1668 Code::Flags flags,
1669 const char* debug_name) { 1669 const char* debug_name) {
1670 CompilationInfo info(CStrVector(debug_name), isolate, graph->zone(), flags); 1670 CompilationInfo info(CStrVector(debug_name), isolate, graph->zone(), flags);
1671 if (isolate->serializer_enabled()) info.PrepareForSerializing(); 1671 if (isolate->serializer_enabled()) info.PrepareForSerializing();
1672 1672
1673 // Construct a pipeline for scheduling and code generation. 1673 // Construct a pipeline for scheduling and code generation.
1674 ZoneStats zone_stats(isolate->allocator()); 1674 ZonePool zone_pool(isolate->allocator());
1675 PipelineData data(&zone_stats, &info, graph, schedule); 1675 PipelineData data(&zone_pool, &info, graph, schedule);
1676 std::unique_ptr<PipelineStatistics> pipeline_statistics; 1676 std::unique_ptr<PipelineStatistics> pipeline_statistics;
1677 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { 1677 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) {
1678 pipeline_statistics.reset(new PipelineStatistics(&info, &zone_stats)); 1678 pipeline_statistics.reset(new PipelineStatistics(&info, &zone_pool));
1679 pipeline_statistics->BeginPhaseKind("stub codegen"); 1679 pipeline_statistics->BeginPhaseKind("stub codegen");
1680 } 1680 }
1681 1681
1682 PipelineImpl pipeline(&data); 1682 PipelineImpl pipeline(&data);
1683 DCHECK_NOT_NULL(data.schedule()); 1683 DCHECK_NOT_NULL(data.schedule());
1684 1684
1685 if (FLAG_trace_turbo) { 1685 if (FLAG_trace_turbo) {
1686 { 1686 {
1687 TurboJsonFile json_of(&info, std::ios_base::trunc); 1687 TurboJsonFile json_of(&info, std::ios_base::trunc);
1688 json_of << "{\"function\":\"" << info.GetDebugName().get() 1688 json_of << "{\"function\":\"" << info.GetDebugName().get()
1689 << "\", \"source\":\"\",\n\"phases\":["; 1689 << "\", \"source\":\"\",\n\"phases\":[";
1690 } 1690 }
1691 pipeline.Run<PrintGraphPhase>("Machine"); 1691 pipeline.Run<PrintGraphPhase>("Machine");
1692 } 1692 }
1693 1693
1694 pipeline.Run<VerifyGraphPhase>(false, true); 1694 pipeline.Run<VerifyGraphPhase>(false, true);
1695 return pipeline.ScheduleAndGenerateCode(call_descriptor); 1695 return pipeline.ScheduleAndGenerateCode(call_descriptor);
1696 } 1696 }
1697 1697
1698 // static 1698 // static
1699 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info) { 1699 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info) {
1700 ZoneStats zone_stats(info->isolate()->allocator()); 1700 ZonePool zone_pool(info->isolate()->allocator());
1701 std::unique_ptr<PipelineStatistics> pipeline_statistics( 1701 std::unique_ptr<PipelineStatistics> pipeline_statistics(
1702 CreatePipelineStatistics(info, &zone_stats)); 1702 CreatePipelineStatistics(info, &zone_pool));
1703 PipelineData data(&zone_stats, info, pipeline_statistics.get()); 1703 PipelineData data(&zone_pool, info, pipeline_statistics.get());
1704 PipelineImpl pipeline(&data); 1704 PipelineImpl pipeline(&data);
1705 1705
1706 Linkage linkage(Linkage::ComputeIncoming(data.instruction_zone(), info)); 1706 Linkage linkage(Linkage::ComputeIncoming(data.instruction_zone(), info));
1707 1707
1708 if (!pipeline.CreateGraph()) return Handle<Code>::null(); 1708 if (!pipeline.CreateGraph()) return Handle<Code>::null();
1709 if (!pipeline.OptimizeGraph(&linkage)) return Handle<Code>::null(); 1709 if (!pipeline.OptimizeGraph(&linkage)) return Handle<Code>::null();
1710 return pipeline.GenerateCode(&linkage); 1710 return pipeline.GenerateCode(&linkage);
1711 } 1711 }
1712 1712
1713 // static 1713 // static
1714 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, 1714 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
1715 Graph* graph, 1715 Graph* graph,
1716 Schedule* schedule) { 1716 Schedule* schedule) {
1717 CallDescriptor* call_descriptor = 1717 CallDescriptor* call_descriptor =
1718 Linkage::ComputeIncoming(info->zone(), info); 1718 Linkage::ComputeIncoming(info->zone(), info);
1719 return GenerateCodeForTesting(info, call_descriptor, graph, schedule); 1719 return GenerateCodeForTesting(info, call_descriptor, graph, schedule);
1720 } 1720 }
1721 1721
1722 // static 1722 // static
1723 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, 1723 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
1724 CallDescriptor* call_descriptor, 1724 CallDescriptor* call_descriptor,
1725 Graph* graph, 1725 Graph* graph,
1726 Schedule* schedule) { 1726 Schedule* schedule) {
1727 // Construct a pipeline for scheduling and code generation. 1727 // Construct a pipeline for scheduling and code generation.
1728 ZoneStats zone_stats(info->isolate()->allocator()); 1728 ZonePool zone_pool(info->isolate()->allocator());
1729 PipelineData data(&zone_stats, info, graph, schedule); 1729 PipelineData data(&zone_pool, info, graph, schedule);
1730 std::unique_ptr<PipelineStatistics> pipeline_statistics; 1730 std::unique_ptr<PipelineStatistics> pipeline_statistics;
1731 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { 1731 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) {
1732 pipeline_statistics.reset(new PipelineStatistics(info, &zone_stats)); 1732 pipeline_statistics.reset(new PipelineStatistics(info, &zone_pool));
1733 pipeline_statistics->BeginPhaseKind("test codegen"); 1733 pipeline_statistics->BeginPhaseKind("test codegen");
1734 } 1734 }
1735 1735
1736 PipelineImpl pipeline(&data); 1736 PipelineImpl pipeline(&data);
1737 1737
1738 if (FLAG_trace_turbo) { 1738 if (FLAG_trace_turbo) {
1739 TurboJsonFile json_of(info, std::ios_base::trunc); 1739 TurboJsonFile json_of(info, std::ios_base::trunc);
1740 json_of << "{\"function\":\"" << info->GetDebugName().get() 1740 json_of << "{\"function\":\"" << info->GetDebugName().get()
1741 << "\", \"source\":\"\",\n\"phases\":["; 1741 << "\", \"source\":\"\",\n\"phases\":[";
1742 } 1742 }
(...skipping 14 matching lines...) Expand all
1757 SourcePositionTable* source_positions) { 1757 SourcePositionTable* source_positions) {
1758 return new PipelineWasmCompilationJob(info, graph, descriptor, 1758 return new PipelineWasmCompilationJob(info, graph, descriptor,
1759 source_positions); 1759 source_positions);
1760 } 1760 }
1761 1761
1762 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config, 1762 bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config,
1763 InstructionSequence* sequence, 1763 InstructionSequence* sequence,
1764 bool run_verifier) { 1764 bool run_verifier) {
1765 CompilationInfo info(ArrayVector("testing"), sequence->isolate(), 1765 CompilationInfo info(ArrayVector("testing"), sequence->isolate(),
1766 sequence->zone(), Code::ComputeFlags(Code::STUB)); 1766 sequence->zone(), Code::ComputeFlags(Code::STUB));
1767 ZoneStats zone_stats(sequence->isolate()->allocator()); 1767 ZonePool zone_pool(sequence->isolate()->allocator());
1768 PipelineData data(&zone_stats, &info, sequence); 1768 PipelineData data(&zone_pool, &info, sequence);
1769 PipelineImpl pipeline(&data); 1769 PipelineImpl pipeline(&data);
1770 pipeline.data_->InitializeFrameData(nullptr); 1770 pipeline.data_->InitializeFrameData(nullptr);
1771 pipeline.AllocateRegisters(config, nullptr, run_verifier); 1771 pipeline.AllocateRegisters(config, nullptr, run_verifier);
1772 return !data.compilation_failed(); 1772 return !data.compilation_failed();
1773 } 1773 }
1774 1774
1775 bool PipelineImpl::ScheduleAndSelectInstructions(Linkage* linkage) { 1775 bool PipelineImpl::ScheduleAndSelectInstructions(Linkage* linkage) {
1776 CallDescriptor* call_descriptor = linkage->GetIncomingDescriptor(); 1776 CallDescriptor* call_descriptor = linkage->GetIncomingDescriptor();
1777 PipelineData* data = this->data_; 1777 PipelineData* data = this->data_;
1778 1778
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 data->DeleteRegisterAllocationZone(); 1990 data->DeleteRegisterAllocationZone();
1991 } 1991 }
1992 1992
1993 CompilationInfo* PipelineImpl::info() const { return data_->info(); } 1993 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
1994 1994
1995 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } 1995 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
1996 1996
1997 } // namespace compiler 1997 } // namespace compiler
1998 } // namespace internal 1998 } // namespace internal
1999 } // namespace v8 1999 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/move-optimizer.cc ('k') | src/compiler/pipeline-statistics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698