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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 javascript_(jsgraph->javascript()), | 130 javascript_(jsgraph->javascript()), |
131 jsgraph_(jsgraph), | 131 jsgraph_(jsgraph), |
132 instruction_zone_scope_(zone_stats_, ZONE_NAME), | 132 instruction_zone_scope_(zone_stats_, ZONE_NAME), |
133 instruction_zone_(instruction_zone_scope_.zone()), | 133 instruction_zone_(instruction_zone_scope_.zone()), |
134 register_allocation_zone_scope_(zone_stats_, ZONE_NAME), | 134 register_allocation_zone_scope_(zone_stats_, ZONE_NAME), |
135 register_allocation_zone_(register_allocation_zone_scope_.zone()), | 135 register_allocation_zone_(register_allocation_zone_scope_.zone()), |
136 protected_instructions_(protected_instructions) {} | 136 protected_instructions_(protected_instructions) {} |
137 | 137 |
138 // For machine graph testing entry point. | 138 // For machine graph testing entry point. |
139 PipelineData(ZoneStats* zone_stats, CompilationInfo* info, Graph* graph, | 139 PipelineData(ZoneStats* zone_stats, CompilationInfo* info, Graph* graph, |
140 Schedule* schedule, SourcePositionTable* source_positions) | 140 Schedule* schedule) |
141 : isolate_(info->isolate()), | 141 : isolate_(info->isolate()), |
142 info_(info), | 142 info_(info), |
143 debug_name_(info_->GetDebugName()), | 143 debug_name_(info_->GetDebugName()), |
144 zone_stats_(zone_stats), | 144 zone_stats_(zone_stats), |
145 graph_zone_scope_(zone_stats_, ZONE_NAME), | 145 graph_zone_scope_(zone_stats_, ZONE_NAME), |
146 graph_(graph), | 146 graph_(graph), |
147 source_positions_(source_positions), | 147 source_positions_(new (info->zone()) SourcePositionTable(graph_)), |
148 schedule_(schedule), | 148 schedule_(schedule), |
149 instruction_zone_scope_(zone_stats_, ZONE_NAME), | 149 instruction_zone_scope_(zone_stats_, ZONE_NAME), |
150 instruction_zone_(instruction_zone_scope_.zone()), | 150 instruction_zone_(instruction_zone_scope_.zone()), |
151 register_allocation_zone_scope_(zone_stats_, ZONE_NAME), | 151 register_allocation_zone_scope_(zone_stats_, ZONE_NAME), |
152 register_allocation_zone_(register_allocation_zone_scope_.zone()) {} | 152 register_allocation_zone_(register_allocation_zone_scope_.zone()) {} |
153 | 153 |
154 // For register allocation testing entry point. | 154 // For register allocation testing entry point. |
155 PipelineData(ZoneStats* zone_stats, CompilationInfo* info, | 155 PipelineData(ZoneStats* zone_stats, CompilationInfo* info, |
156 InstructionSequence* sequence) | 156 InstructionSequence* sequence) |
157 : isolate_(info->isolate()), | 157 : isolate_(info->isolate()), |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate, | 1634 Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate, |
1635 CallDescriptor* call_descriptor, | 1635 CallDescriptor* call_descriptor, |
1636 Graph* graph, Schedule* schedule, | 1636 Graph* graph, Schedule* schedule, |
1637 Code::Flags flags, | 1637 Code::Flags flags, |
1638 const char* debug_name) { | 1638 const char* debug_name) { |
1639 CompilationInfo info(CStrVector(debug_name), isolate, graph->zone(), flags); | 1639 CompilationInfo info(CStrVector(debug_name), isolate, graph->zone(), flags); |
1640 if (isolate->serializer_enabled()) info.PrepareForSerializing(); | 1640 if (isolate->serializer_enabled()) info.PrepareForSerializing(); |
1641 | 1641 |
1642 // Construct a pipeline for scheduling and code generation. | 1642 // Construct a pipeline for scheduling and code generation. |
1643 ZoneStats zone_stats(isolate->allocator()); | 1643 ZoneStats zone_stats(isolate->allocator()); |
1644 SourcePositionTable source_positions(graph); | 1644 PipelineData data(&zone_stats, &info, graph, schedule); |
1645 PipelineData data(&zone_stats, &info, graph, schedule, &source_positions); | |
1646 std::unique_ptr<PipelineStatistics> pipeline_statistics; | 1645 std::unique_ptr<PipelineStatistics> pipeline_statistics; |
1647 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { | 1646 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { |
1648 pipeline_statistics.reset(new PipelineStatistics(&info, &zone_stats)); | 1647 pipeline_statistics.reset(new PipelineStatistics(&info, &zone_stats)); |
1649 pipeline_statistics->BeginPhaseKind("stub codegen"); | 1648 pipeline_statistics->BeginPhaseKind("stub codegen"); |
1650 } | 1649 } |
1651 | 1650 |
1652 PipelineImpl pipeline(&data); | 1651 PipelineImpl pipeline(&data); |
1653 DCHECK_NOT_NULL(data.schedule()); | 1652 DCHECK_NOT_NULL(data.schedule()); |
1654 | 1653 |
1655 if (FLAG_trace_turbo) { | 1654 if (FLAG_trace_turbo) { |
(...skipping 27 matching lines...) Expand all Loading... |
1683 // static | 1682 // static |
1684 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, | 1683 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, |
1685 Graph* graph, | 1684 Graph* graph, |
1686 Schedule* schedule) { | 1685 Schedule* schedule) { |
1687 CallDescriptor* call_descriptor = | 1686 CallDescriptor* call_descriptor = |
1688 Linkage::ComputeIncoming(info->zone(), info); | 1687 Linkage::ComputeIncoming(info->zone(), info); |
1689 return GenerateCodeForTesting(info, call_descriptor, graph, schedule); | 1688 return GenerateCodeForTesting(info, call_descriptor, graph, schedule); |
1690 } | 1689 } |
1691 | 1690 |
1692 // static | 1691 // static |
1693 Handle<Code> Pipeline::GenerateCodeForTesting( | 1692 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, |
1694 CompilationInfo* info, CallDescriptor* call_descriptor, Graph* graph, | 1693 CallDescriptor* call_descriptor, |
1695 Schedule* schedule, SourcePositionTable* source_positions) { | 1694 Graph* graph, |
| 1695 Schedule* schedule) { |
1696 // Construct a pipeline for scheduling and code generation. | 1696 // Construct a pipeline for scheduling and code generation. |
1697 ZoneStats zone_stats(info->isolate()->allocator()); | 1697 ZoneStats zone_stats(info->isolate()->allocator()); |
1698 // TODO(wasm): Refactor code generation to check for non-existing source | 1698 PipelineData data(&zone_stats, info, graph, schedule); |
1699 // table, then remove this conditional allocation. | |
1700 if (!source_positions) | |
1701 source_positions = new (info->zone()) SourcePositionTable(graph); | |
1702 PipelineData data(&zone_stats, info, graph, schedule, source_positions); | |
1703 std::unique_ptr<PipelineStatistics> pipeline_statistics; | 1699 std::unique_ptr<PipelineStatistics> pipeline_statistics; |
1704 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { | 1700 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { |
1705 pipeline_statistics.reset(new PipelineStatistics(info, &zone_stats)); | 1701 pipeline_statistics.reset(new PipelineStatistics(info, &zone_stats)); |
1706 pipeline_statistics->BeginPhaseKind("test codegen"); | 1702 pipeline_statistics->BeginPhaseKind("test codegen"); |
1707 } | 1703 } |
1708 | 1704 |
1709 PipelineImpl pipeline(&data); | 1705 PipelineImpl pipeline(&data); |
1710 | 1706 |
1711 if (FLAG_trace_turbo) { | 1707 if (FLAG_trace_turbo) { |
1712 TurboJsonFile json_of(info, std::ios_base::trunc); | 1708 TurboJsonFile json_of(info, std::ios_base::trunc); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 data->DeleteRegisterAllocationZone(); | 1974 data->DeleteRegisterAllocationZone(); |
1979 } | 1975 } |
1980 | 1976 |
1981 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1977 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
1982 | 1978 |
1983 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1979 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
1984 | 1980 |
1985 } // namespace compiler | 1981 } // namespace compiler |
1986 } // namespace internal | 1982 } // namespace internal |
1987 } // namespace v8 | 1983 } // namespace v8 |
OLD | NEW |