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) | 140 Schedule* schedule, SourcePositionTable* source_positions) |
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_(new (info->zone()) SourcePositionTable(graph_)), | 147 source_positions_(source_positions), |
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 PipelineData data(&zone_stats, &info, graph, schedule); | 1644 SourcePositionTable source_positions(graph); |
| 1645 PipelineData data(&zone_stats, &info, graph, schedule, &source_positions); |
1645 std::unique_ptr<PipelineStatistics> pipeline_statistics; | 1646 std::unique_ptr<PipelineStatistics> pipeline_statistics; |
1646 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { | 1647 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { |
1647 pipeline_statistics.reset(new PipelineStatistics(&info, &zone_stats)); | 1648 pipeline_statistics.reset(new PipelineStatistics(&info, &zone_stats)); |
1648 pipeline_statistics->BeginPhaseKind("stub codegen"); | 1649 pipeline_statistics->BeginPhaseKind("stub codegen"); |
1649 } | 1650 } |
1650 | 1651 |
1651 PipelineImpl pipeline(&data); | 1652 PipelineImpl pipeline(&data); |
1652 DCHECK_NOT_NULL(data.schedule()); | 1653 DCHECK_NOT_NULL(data.schedule()); |
1653 | 1654 |
1654 if (FLAG_trace_turbo) { | 1655 if (FLAG_trace_turbo) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 // static | 1689 // static |
1689 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, | 1690 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, |
1690 Graph* graph, | 1691 Graph* graph, |
1691 Schedule* schedule) { | 1692 Schedule* schedule) { |
1692 CallDescriptor* call_descriptor = | 1693 CallDescriptor* call_descriptor = |
1693 Linkage::ComputeIncoming(info->zone(), info); | 1694 Linkage::ComputeIncoming(info->zone(), info); |
1694 return GenerateCodeForTesting(info, call_descriptor, graph, schedule); | 1695 return GenerateCodeForTesting(info, call_descriptor, graph, schedule); |
1695 } | 1696 } |
1696 | 1697 |
1697 // static | 1698 // static |
1698 Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info, | 1699 Handle<Code> Pipeline::GenerateCodeForTesting( |
1699 CallDescriptor* call_descriptor, | 1700 CompilationInfo* info, CallDescriptor* call_descriptor, Graph* graph, |
1700 Graph* graph, | 1701 Schedule* schedule, SourcePositionTable* source_positions) { |
1701 Schedule* schedule) { | |
1702 // Construct a pipeline for scheduling and code generation. | 1702 // Construct a pipeline for scheduling and code generation. |
1703 ZoneStats zone_stats(info->isolate()->allocator()); | 1703 ZoneStats zone_stats(info->isolate()->allocator()); |
1704 PipelineData data(&zone_stats, info, graph, schedule); | 1704 // TODO(wasm): Refactor code generation to check for non-existing source |
| 1705 // table, then remove this conditional allocation. |
| 1706 if (!source_positions) |
| 1707 source_positions = new (info->zone()) SourcePositionTable(graph); |
| 1708 PipelineData data(&zone_stats, info, graph, schedule, source_positions); |
1705 std::unique_ptr<PipelineStatistics> pipeline_statistics; | 1709 std::unique_ptr<PipelineStatistics> pipeline_statistics; |
1706 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { | 1710 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { |
1707 pipeline_statistics.reset(new PipelineStatistics(info, &zone_stats)); | 1711 pipeline_statistics.reset(new PipelineStatistics(info, &zone_stats)); |
1708 pipeline_statistics->BeginPhaseKind("test codegen"); | 1712 pipeline_statistics->BeginPhaseKind("test codegen"); |
1709 } | 1713 } |
1710 | 1714 |
1711 PipelineImpl pipeline(&data); | 1715 PipelineImpl pipeline(&data); |
1712 | 1716 |
1713 if (FLAG_trace_turbo) { | 1717 if (FLAG_trace_turbo) { |
1714 TurboJsonFile json_of(info, std::ios_base::trunc); | 1718 TurboJsonFile json_of(info, std::ios_base::trunc); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1980 data->DeleteRegisterAllocationZone(); | 1984 data->DeleteRegisterAllocationZone(); |
1981 } | 1985 } |
1982 | 1986 |
1983 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1987 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
1984 | 1988 |
1985 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1989 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
1986 | 1990 |
1987 } // namespace compiler | 1991 } // namespace compiler |
1988 } // namespace internal | 1992 } // namespace internal |
1989 } // namespace v8 | 1993 } // namespace v8 |
OLD | NEW |