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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 CommonOperatorBuilder common(zone()); | 172 CommonOperatorBuilder common(zone()); |
173 JSGraph jsgraph(&graph, &common, &typer); | 173 JSOperatorBuilder javascript(zone()); |
| 174 MachineOperatorBuilder machine(zone()); |
| 175 JSGraph jsgraph(&graph, &common, &javascript, &typer, &machine); |
174 Node* context_node; | 176 Node* context_node; |
175 { | 177 { |
176 PhaseStats graph_builder_stats(info(), PhaseStats::CREATE_GRAPH, | 178 PhaseStats graph_builder_stats(info(), PhaseStats::CREATE_GRAPH, |
177 "graph builder"); | 179 "graph builder"); |
178 AstGraphBuilderWithPositions graph_builder(info(), &jsgraph, | 180 AstGraphBuilderWithPositions graph_builder(info(), &jsgraph, |
179 &source_positions); | 181 &source_positions); |
180 graph_builder.CreateGraph(); | 182 graph_builder.CreateGraph(); |
181 context_node = graph_builder.GetFunctionContext(); | 183 context_node = graph_builder.GetFunctionContext(); |
182 } | 184 } |
183 { | 185 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 251 |
250 VerifyAndPrintGraph(&graph, "Lowered simplified"); | 252 VerifyAndPrintGraph(&graph, "Lowered simplified"); |
251 } | 253 } |
252 { | 254 { |
253 // Lower changes that have been inserted before. | 255 // Lower changes that have been inserted before. |
254 PhaseStats lowering_stats(info(), PhaseStats::OPTIMIZATION, | 256 PhaseStats lowering_stats(info(), PhaseStats::OPTIMIZATION, |
255 "change lowering"); | 257 "change lowering"); |
256 SourcePositionTable::Scope pos(&source_positions, | 258 SourcePositionTable::Scope pos(&source_positions, |
257 SourcePosition::Unknown()); | 259 SourcePosition::Unknown()); |
258 Linkage linkage(info()); | 260 Linkage linkage(info()); |
259 MachineOperatorBuilder machine(zone()); | |
260 ValueNumberingReducer vn_reducer(zone()); | 261 ValueNumberingReducer vn_reducer(zone()); |
261 SimplifiedOperatorReducer simple_reducer(&jsgraph, &machine); | 262 SimplifiedOperatorReducer simple_reducer(&jsgraph, &machine); |
262 ChangeLowering lowering(&jsgraph, &linkage, &machine); | 263 ChangeLowering lowering(&jsgraph, &linkage, &machine); |
263 MachineOperatorReducer mach_reducer(&jsgraph); | 264 MachineOperatorReducer mach_reducer(&jsgraph); |
264 GraphReducer graph_reducer(&graph); | 265 GraphReducer graph_reducer(&graph); |
265 // TODO(titzer): Figure out if we should run all reducers at once here. | 266 // TODO(titzer): Figure out if we should run all reducers at once here. |
266 graph_reducer.AddReducer(&vn_reducer); | 267 graph_reducer.AddReducer(&vn_reducer); |
267 graph_reducer.AddReducer(&simple_reducer); | 268 graph_reducer.AddReducer(&simple_reducer); |
268 graph_reducer.AddReducer(&lowering); | 269 graph_reducer.AddReducer(&lowering); |
269 graph_reducer.AddReducer(&mach_reducer); | 270 graph_reducer.AddReducer(&mach_reducer); |
270 graph_reducer.ReduceGraph(); | 271 graph_reducer.ReduceGraph(); |
271 | 272 |
272 VerifyAndPrintGraph(&graph, "Lowered changes"); | 273 VerifyAndPrintGraph(&graph, "Lowered changes"); |
273 } | 274 } |
274 } | 275 } |
275 | 276 |
276 Handle<Code> code = Handle<Code>::null(); | 277 Handle<Code> code = Handle<Code>::null(); |
277 if (SupportedTarget()) { | 278 if (SupportedTarget()) { |
278 { | 279 { |
279 // Lower any remaining generic JSOperators. | 280 // Lower any remaining generic JSOperators. |
280 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, | 281 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, |
281 "generic lowering"); | 282 "generic lowering"); |
282 SourcePositionTable::Scope pos(&source_positions, | 283 SourcePositionTable::Scope pos(&source_positions, |
283 SourcePosition::Unknown()); | 284 SourcePosition::Unknown()); |
284 MachineOperatorBuilder machine(zone()); | |
285 JSGenericLowering lowering(info(), &jsgraph, &machine); | 285 JSGenericLowering lowering(info(), &jsgraph, &machine); |
286 GraphReducer graph_reducer(&graph); | 286 GraphReducer graph_reducer(&graph); |
287 graph_reducer.AddReducer(&lowering); | 287 graph_reducer.AddReducer(&lowering); |
288 graph_reducer.ReduceGraph(); | 288 graph_reducer.ReduceGraph(); |
289 | 289 |
290 VerifyAndPrintGraph(&graph, "Lowered generic"); | 290 VerifyAndPrintGraph(&graph, "Lowered generic"); |
291 } | 291 } |
292 | 292 |
293 { | 293 { |
294 // Compute a schedule. | 294 // Compute a schedule. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 } | 401 } |
402 | 402 |
403 | 403 |
404 void Pipeline::TearDown() { | 404 void Pipeline::TearDown() { |
405 InstructionOperand::TearDownCaches(); | 405 InstructionOperand::TearDownCaches(); |
406 } | 406 } |
407 | 407 |
408 } // namespace compiler | 408 } // namespace compiler |
409 } // namespace internal | 409 } // namespace internal |
410 } // namespace v8 | 410 } // namespace v8 |
OLD | NEW |