| 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 JSOperatorBuilder javascript(zone()); | 173 JSGraph jsgraph(&graph, &common, &typer); |
| 174 MachineOperatorBuilder machine(zone()); | |
| 175 JSGraph jsgraph(&graph, &common, &javascript, &typer, &machine); | |
| 176 Node* context_node; | 174 Node* context_node; |
| 177 { | 175 { |
| 178 PhaseStats graph_builder_stats(info(), PhaseStats::CREATE_GRAPH, | 176 PhaseStats graph_builder_stats(info(), PhaseStats::CREATE_GRAPH, |
| 179 "graph builder"); | 177 "graph builder"); |
| 180 AstGraphBuilderWithPositions graph_builder(info(), &jsgraph, | 178 AstGraphBuilderWithPositions graph_builder(info(), &jsgraph, |
| 181 &source_positions); | 179 &source_positions); |
| 182 graph_builder.CreateGraph(); | 180 graph_builder.CreateGraph(); |
| 183 context_node = graph_builder.GetFunctionContext(); | 181 context_node = graph_builder.GetFunctionContext(); |
| 184 } | 182 } |
| 185 { | 183 { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 249 |
| 252 VerifyAndPrintGraph(&graph, "Lowered simplified"); | 250 VerifyAndPrintGraph(&graph, "Lowered simplified"); |
| 253 } | 251 } |
| 254 { | 252 { |
| 255 // Lower changes that have been inserted before. | 253 // Lower changes that have been inserted before. |
| 256 PhaseStats lowering_stats(info(), PhaseStats::OPTIMIZATION, | 254 PhaseStats lowering_stats(info(), PhaseStats::OPTIMIZATION, |
| 257 "change lowering"); | 255 "change lowering"); |
| 258 SourcePositionTable::Scope pos(&source_positions, | 256 SourcePositionTable::Scope pos(&source_positions, |
| 259 SourcePosition::Unknown()); | 257 SourcePosition::Unknown()); |
| 260 Linkage linkage(info()); | 258 Linkage linkage(info()); |
| 259 MachineOperatorBuilder machine(zone()); |
| 261 ValueNumberingReducer vn_reducer(zone()); | 260 ValueNumberingReducer vn_reducer(zone()); |
| 262 SimplifiedOperatorReducer simple_reducer(&jsgraph, &machine); | 261 SimplifiedOperatorReducer simple_reducer(&jsgraph, &machine); |
| 263 ChangeLowering lowering(&jsgraph, &linkage, &machine); | 262 ChangeLowering lowering(&jsgraph, &linkage, &machine); |
| 264 MachineOperatorReducer mach_reducer(&jsgraph); | 263 MachineOperatorReducer mach_reducer(&jsgraph); |
| 265 GraphReducer graph_reducer(&graph); | 264 GraphReducer graph_reducer(&graph); |
| 266 // 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. |
| 267 graph_reducer.AddReducer(&vn_reducer); | 266 graph_reducer.AddReducer(&vn_reducer); |
| 268 graph_reducer.AddReducer(&simple_reducer); | 267 graph_reducer.AddReducer(&simple_reducer); |
| 269 graph_reducer.AddReducer(&lowering); | 268 graph_reducer.AddReducer(&lowering); |
| 270 graph_reducer.AddReducer(&mach_reducer); | 269 graph_reducer.AddReducer(&mach_reducer); |
| 271 graph_reducer.ReduceGraph(); | 270 graph_reducer.ReduceGraph(); |
| 272 | 271 |
| 273 VerifyAndPrintGraph(&graph, "Lowered changes"); | 272 VerifyAndPrintGraph(&graph, "Lowered changes"); |
| 274 } | 273 } |
| 275 } | 274 } |
| 276 | 275 |
| 277 Handle<Code> code = Handle<Code>::null(); | 276 Handle<Code> code = Handle<Code>::null(); |
| 278 if (SupportedTarget()) { | 277 if (SupportedTarget()) { |
| 279 { | 278 { |
| 280 // Lower any remaining generic JSOperators. | 279 // Lower any remaining generic JSOperators. |
| 281 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, | 280 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, |
| 282 "generic lowering"); | 281 "generic lowering"); |
| 283 SourcePositionTable::Scope pos(&source_positions, | 282 SourcePositionTable::Scope pos(&source_positions, |
| 284 SourcePosition::Unknown()); | 283 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 |