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 "src/base/platform/elapsed-timer.h" | 7 #include "src/base/platform/elapsed-timer.h" |
8 #include "src/compiler/ast-graph-builder.h" | 8 #include "src/compiler/ast-graph-builder.h" |
9 #include "src/compiler/change-lowering.h" | 9 #include "src/compiler/change-lowering.h" |
10 #include "src/compiler/code-generator.h" | 10 #include "src/compiler/code-generator.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 // Build the graph. | 164 // Build the graph. |
165 Graph graph(zone()); | 165 Graph graph(zone()); |
166 SourcePositionTable source_positions(&graph); | 166 SourcePositionTable source_positions(&graph); |
167 source_positions.AddDecorator(); | 167 source_positions.AddDecorator(); |
168 // TODO(turbofan): there is no need to type anything during initial graph | 168 // TODO(turbofan): there is no need to type anything during initial graph |
169 // construction. This is currently only needed for the node cache, which the | 169 // construction. This is currently only needed for the node cache, which the |
170 // typer could sweep over later. | 170 // typer could sweep over later. |
171 Typer typer(zone()); | 171 Typer typer(zone()); |
| 172 MachineOperatorBuilder machine; |
172 CommonOperatorBuilder common(zone()); | 173 CommonOperatorBuilder common(zone()); |
173 JSGraph jsgraph(&graph, &common, &typer); | 174 JSGraph jsgraph(&graph, &common, &typer); |
174 Node* context_node; | 175 Node* context_node; |
175 { | 176 { |
176 PhaseStats graph_builder_stats(info(), PhaseStats::CREATE_GRAPH, | 177 PhaseStats graph_builder_stats(info(), PhaseStats::CREATE_GRAPH, |
177 "graph builder"); | 178 "graph builder"); |
178 AstGraphBuilderWithPositions graph_builder(info(), &jsgraph, | 179 AstGraphBuilderWithPositions graph_builder(info(), &jsgraph, |
179 &source_positions); | 180 &source_positions); |
180 graph_builder.CreateGraph(); | 181 graph_builder.CreateGraph(); |
181 context_node = graph_builder.GetFunctionContext(); | 182 context_node = graph_builder.GetFunctionContext(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 250 |
250 VerifyAndPrintGraph(&graph, "Lowered simplified"); | 251 VerifyAndPrintGraph(&graph, "Lowered simplified"); |
251 } | 252 } |
252 { | 253 { |
253 // Lower changes that have been inserted before. | 254 // Lower changes that have been inserted before. |
254 PhaseStats lowering_stats(info(), PhaseStats::OPTIMIZATION, | 255 PhaseStats lowering_stats(info(), PhaseStats::OPTIMIZATION, |
255 "change lowering"); | 256 "change lowering"); |
256 SourcePositionTable::Scope pos(&source_positions, | 257 SourcePositionTable::Scope pos(&source_positions, |
257 SourcePosition::Unknown()); | 258 SourcePosition::Unknown()); |
258 Linkage linkage(info()); | 259 Linkage linkage(info()); |
259 MachineOperatorBuilder machine(zone()); | |
260 ValueNumberingReducer vn_reducer(zone()); | 260 ValueNumberingReducer vn_reducer(zone()); |
261 SimplifiedOperatorReducer simple_reducer(&jsgraph, &machine); | 261 SimplifiedOperatorReducer simple_reducer(&jsgraph, &machine); |
262 ChangeLowering lowering(&jsgraph, &linkage, &machine); | 262 ChangeLowering lowering(&jsgraph, &linkage, &machine); |
263 MachineOperatorReducer mach_reducer(&jsgraph); | 263 MachineOperatorReducer mach_reducer(&jsgraph); |
264 GraphReducer graph_reducer(&graph); | 264 GraphReducer graph_reducer(&graph); |
265 // TODO(titzer): Figure out if we should run all reducers at once here. | 265 // TODO(titzer): Figure out if we should run all reducers at once here. |
266 graph_reducer.AddReducer(&vn_reducer); | 266 graph_reducer.AddReducer(&vn_reducer); |
267 graph_reducer.AddReducer(&simple_reducer); | 267 graph_reducer.AddReducer(&simple_reducer); |
268 graph_reducer.AddReducer(&lowering); | 268 graph_reducer.AddReducer(&lowering); |
269 graph_reducer.AddReducer(&mach_reducer); | 269 graph_reducer.AddReducer(&mach_reducer); |
270 graph_reducer.ReduceGraph(); | 270 graph_reducer.ReduceGraph(); |
271 | 271 |
272 VerifyAndPrintGraph(&graph, "Lowered changes"); | 272 VerifyAndPrintGraph(&graph, "Lowered changes"); |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 Handle<Code> code = Handle<Code>::null(); | 276 Handle<Code> code = Handle<Code>::null(); |
277 if (SupportedTarget()) { | 277 if (SupportedTarget()) { |
278 { | 278 { |
279 // Lower any remaining generic JSOperators. | 279 // Lower any remaining generic JSOperators. |
280 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, | 280 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, |
281 "generic lowering"); | 281 "generic lowering"); |
282 SourcePositionTable::Scope pos(&source_positions, | 282 SourcePositionTable::Scope pos(&source_positions, |
283 SourcePosition::Unknown()); | 283 SourcePosition::Unknown()); |
284 MachineOperatorBuilder machine(zone()); | |
285 JSGenericLowering lowering(info(), &jsgraph, &machine); | 284 JSGenericLowering lowering(info(), &jsgraph, &machine); |
286 GraphReducer graph_reducer(&graph); | 285 GraphReducer graph_reducer(&graph); |
287 graph_reducer.AddReducer(&lowering); | 286 graph_reducer.AddReducer(&lowering); |
288 graph_reducer.ReduceGraph(); | 287 graph_reducer.ReduceGraph(); |
289 | 288 |
290 VerifyAndPrintGraph(&graph, "Lowered generic"); | 289 VerifyAndPrintGraph(&graph, "Lowered generic"); |
291 } | 290 } |
292 | 291 |
293 { | 292 { |
294 // Compute a schedule. | 293 // Compute a schedule. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 } | 400 } |
402 | 401 |
403 | 402 |
404 void Pipeline::TearDown() { | 403 void Pipeline::TearDown() { |
405 InstructionOperand::TearDownCaches(); | 404 InstructionOperand::TearDownCaches(); |
406 } | 405 } |
407 | 406 |
408 } // namespace compiler | 407 } // namespace compiler |
409 } // namespace internal | 408 } // namespace internal |
410 } // namespace v8 | 409 } // namespace v8 |
OLD | NEW |