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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 fixed_frame_size = descriptor->CalculateFixedFrameSize(); | 295 fixed_frame_size = descriptor->CalculateFixedFrameSize(); |
296 } | 296 } |
297 frame_ = new (instruction_zone()) Frame(fixed_frame_size); | 297 frame_ = new (instruction_zone()) Frame(fixed_frame_size); |
298 } | 298 } |
299 | 299 |
300 void InitializeRegisterAllocationData(const RegisterConfiguration* config, | 300 void InitializeRegisterAllocationData(const RegisterConfiguration* config, |
301 CallDescriptor* descriptor) { | 301 CallDescriptor* descriptor) { |
302 DCHECK(register_allocation_data_ == nullptr); | 302 DCHECK(register_allocation_data_ == nullptr); |
303 register_allocation_data_ = new (register_allocation_zone()) | 303 register_allocation_data_ = new (register_allocation_zone()) |
304 RegisterAllocationData(config, register_allocation_zone(), frame(), | 304 RegisterAllocationData(config, register_allocation_zone(), frame(), |
305 sequence(), debug_name_.get()); | 305 sequence(), debug_name()); |
306 } | 306 } |
307 | 307 |
308 void BeginPhaseKind(const char* phase_kind_name) { | 308 void BeginPhaseKind(const char* phase_kind_name) { |
309 if (pipeline_statistics() != nullptr) { | 309 if (pipeline_statistics() != nullptr) { |
310 pipeline_statistics()->BeginPhaseKind(phase_kind_name); | 310 pipeline_statistics()->BeginPhaseKind(phase_kind_name); |
311 } | 311 } |
312 } | 312 } |
313 | 313 |
314 void EndPhaseKind() { | 314 void EndPhaseKind() { |
315 if (pipeline_statistics() != nullptr) { | 315 if (pipeline_statistics() != nullptr) { |
316 pipeline_statistics()->EndPhaseKind(); | 316 pipeline_statistics()->EndPhaseKind(); |
317 } | 317 } |
318 } | 318 } |
319 | 319 |
| 320 const char* debug_name() const { return debug_name_.get(); } |
| 321 |
320 private: | 322 private: |
321 Isolate* const isolate_; | 323 Isolate* const isolate_; |
322 CompilationInfo* const info_; | 324 CompilationInfo* const info_; |
323 std::unique_ptr<char[]> debug_name_; | 325 std::unique_ptr<char[]> debug_name_; |
324 Zone* outer_zone_ = nullptr; | 326 Zone* outer_zone_ = nullptr; |
325 ZoneStats* const zone_stats_; | 327 ZoneStats* const zone_stats_; |
326 PipelineStatistics* pipeline_statistics_ = nullptr; | 328 PipelineStatistics* pipeline_statistics_ = nullptr; |
327 bool compilation_failed_ = false; | 329 bool compilation_failed_ = false; |
328 bool verify_graph_ = false; | 330 bool verify_graph_ = false; |
329 Handle<Code> code_ = Handle<Code>::null(); | 331 Handle<Code> code_ = Handle<Code>::null(); |
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 } | 1755 } |
1754 if (data->schedule() == nullptr) Run<ComputeSchedulePhase>(); | 1756 if (data->schedule() == nullptr) Run<ComputeSchedulePhase>(); |
1755 TraceSchedule(data->info(), data->schedule()); | 1757 TraceSchedule(data->info(), data->schedule()); |
1756 | 1758 |
1757 if (FLAG_turbo_profiling) { | 1759 if (FLAG_turbo_profiling) { |
1758 data->set_profiler_data(BasicBlockInstrumentor::Instrument( | 1760 data->set_profiler_data(BasicBlockInstrumentor::Instrument( |
1759 info(), data->graph(), data->schedule())); | 1761 info(), data->graph(), data->schedule())); |
1760 } | 1762 } |
1761 | 1763 |
1762 bool verify_stub_graph = data->verify_graph(); | 1764 bool verify_stub_graph = data->verify_graph(); |
1763 if (verify_stub_graph || (FLAG_turbo_verify_machine_graph != nullptr && | 1765 if (verify_stub_graph || |
1764 (!strcmp(FLAG_turbo_verify_machine_graph, "*") || | 1766 (FLAG_turbo_verify_machine_graph != nullptr && |
1765 !strcmp(FLAG_turbo_verify_machine_graph, | 1767 (!strcmp(FLAG_turbo_verify_machine_graph, "*") || |
1766 data->info()->GetDebugName().get())))) { | 1768 !strcmp(FLAG_turbo_verify_machine_graph, data->debug_name())))) { |
1767 if (FLAG_trace_csa_verify) { | 1769 if (FLAG_trace_csa_verify) { |
1768 AllowHandleDereference allow_deref; | 1770 AllowHandleDereference allow_deref; |
1769 CompilationInfo* info = data->info(); | 1771 CompilationInfo* info = data->info(); |
1770 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); | 1772 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); |
1771 OFStream os(tracing_scope.file()); | 1773 OFStream os(tracing_scope.file()); |
1772 os << "--------------------------------------------------\n" | 1774 os << "--------------------------------------------------\n" |
1773 << "--- Verifying " << info->GetDebugName().get() | 1775 << "--- Verifying " << data->debug_name() << " generated by TurboFan\n" |
1774 << " generated by TurboFan\n" | |
1775 << "--------------------------------------------------\n" | 1776 << "--------------------------------------------------\n" |
1776 << *data->schedule() | 1777 << *data->schedule() |
1777 << "--------------------------------------------------\n" | 1778 << "--------------------------------------------------\n" |
1778 << "--- End of " << info->GetDebugName().get() | 1779 << "--- End of " << data->debug_name() << " generated by TurboFan\n" |
1779 << " generated by TurboFan\n" | |
1780 << "--------------------------------------------------\n"; | 1780 << "--------------------------------------------------\n"; |
1781 } | 1781 } |
1782 Zone temp_zone(data->isolate()->allocator(), ZONE_NAME); | 1782 Zone temp_zone(data->isolate()->allocator(), ZONE_NAME); |
1783 MachineGraphVerifier::Run(data->graph(), data->schedule(), linkage, | 1783 MachineGraphVerifier::Run(data->graph(), data->schedule(), linkage, |
1784 data->info()->IsStub(), &temp_zone); | 1784 data->info()->IsStub(), data->debug_name(), |
| 1785 &temp_zone); |
1785 } | 1786 } |
1786 | 1787 |
1787 data->InitializeInstructionSequence(call_descriptor); | 1788 data->InitializeInstructionSequence(call_descriptor); |
1788 | 1789 |
1789 data->InitializeFrameData(call_descriptor); | 1790 data->InitializeFrameData(call_descriptor); |
1790 // Select and schedule instructions covering the scheduled graph. | 1791 // Select and schedule instructions covering the scheduled graph. |
1791 Run<InstructionSelectionPhase>(linkage); | 1792 Run<InstructionSelectionPhase>(linkage); |
1792 if (data->compilation_failed()) { | 1793 if (data->compilation_failed()) { |
1793 info()->AbortOptimization(kCodeGenerationFailed); | 1794 info()->AbortOptimization(kCodeGenerationFailed); |
1794 data->EndPhaseKind(); | 1795 data->EndPhaseKind(); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 data->DeleteRegisterAllocationZone(); | 1983 data->DeleteRegisterAllocationZone(); |
1983 } | 1984 } |
1984 | 1985 |
1985 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1986 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
1986 | 1987 |
1987 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1988 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
1988 | 1989 |
1989 } // namespace compiler | 1990 } // namespace compiler |
1990 } // namespace internal | 1991 } // namespace internal |
1991 } // namespace v8 | 1992 } // namespace v8 |
OLD | NEW |