| 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 <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 } | 379 } |
| 380 | 380 |
| 381 if (!pipeline_statistics.is_empty()) { | 381 if (!pipeline_statistics.is_empty()) { |
| 382 pipeline_statistics->BeginPhaseKind("lowering"); | 382 pipeline_statistics->BeginPhaseKind("lowering"); |
| 383 } | 383 } |
| 384 | 384 |
| 385 if (info()->is_typing_enabled()) { | 385 if (info()->is_typing_enabled()) { |
| 386 { | 386 { |
| 387 // Lower JSOperators where we can determine types. | 387 // Lower JSOperators where we can determine types. |
| 388 PhaseScope phase_scope(pipeline_statistics.get(), "typed lowering"); | 388 PhaseScope phase_scope(pipeline_statistics.get(), "typed lowering"); |
| 389 ZonePool::Scope zone_scope(data.zone_pool()); | |
| 390 SourcePositionTable::Scope pos(data.source_positions(), | 389 SourcePositionTable::Scope pos(data.source_positions(), |
| 391 SourcePosition::Unknown()); | 390 SourcePosition::Unknown()); |
| 392 ValueNumberingReducer vn_reducer(data.graph_zone()); | 391 ValueNumberingReducer vn_reducer(data.graph_zone()); |
| 393 JSTypedLowering lowering(data.jsgraph()); | 392 JSTypedLowering lowering(data.jsgraph()); |
| 394 SimplifiedOperatorReducer simple_reducer(data.jsgraph()); | 393 SimplifiedOperatorReducer simple_reducer(data.jsgraph()); |
| 395 GraphReducer graph_reducer(data.graph(), zone_scope.zone()); | 394 GraphReducer graph_reducer(data.graph()); |
| 396 graph_reducer.AddReducer(&vn_reducer); | 395 graph_reducer.AddReducer(&vn_reducer); |
| 397 graph_reducer.AddReducer(&lowering); | 396 graph_reducer.AddReducer(&lowering); |
| 398 graph_reducer.AddReducer(&simple_reducer); | 397 graph_reducer.AddReducer(&simple_reducer); |
| 399 graph_reducer.ReduceGraph(); | 398 graph_reducer.ReduceGraph(); |
| 400 | 399 |
| 401 VerifyAndPrintGraph(data.graph(), "Lowered typed"); | 400 VerifyAndPrintGraph(data.graph(), "Lowered typed"); |
| 402 } | 401 } |
| 403 { | 402 { |
| 404 // Lower simplified operators and insert changes. | 403 // Lower simplified operators and insert changes. |
| 405 PhaseScope phase_scope(pipeline_statistics.get(), "simplified lowering"); | 404 PhaseScope phase_scope(pipeline_statistics.get(), "simplified lowering"); |
| 406 ZonePool::Scope zone_scope(data.zone_pool()); | |
| 407 SourcePositionTable::Scope pos(data.source_positions(), | 405 SourcePositionTable::Scope pos(data.source_positions(), |
| 408 SourcePosition::Unknown()); | 406 SourcePosition::Unknown()); |
| 409 SimplifiedLowering lowering(data.jsgraph()); | 407 SimplifiedLowering lowering(data.jsgraph()); |
| 410 lowering.LowerAllNodes(); | 408 lowering.LowerAllNodes(); |
| 411 ValueNumberingReducer vn_reducer(data.graph_zone()); | 409 ValueNumberingReducer vn_reducer(data.graph_zone()); |
| 412 SimplifiedOperatorReducer simple_reducer(data.jsgraph()); | 410 SimplifiedOperatorReducer simple_reducer(data.jsgraph()); |
| 413 GraphReducer graph_reducer(data.graph(), zone_scope.zone()); | 411 GraphReducer graph_reducer(data.graph()); |
| 414 graph_reducer.AddReducer(&vn_reducer); | 412 graph_reducer.AddReducer(&vn_reducer); |
| 415 graph_reducer.AddReducer(&simple_reducer); | 413 graph_reducer.AddReducer(&simple_reducer); |
| 416 graph_reducer.ReduceGraph(); | 414 graph_reducer.ReduceGraph(); |
| 417 | 415 |
| 418 VerifyAndPrintGraph(data.graph(), "Lowered simplified"); | 416 VerifyAndPrintGraph(data.graph(), "Lowered simplified"); |
| 419 } | 417 } |
| 420 { | 418 { |
| 421 // Lower changes that have been inserted before. | 419 // Lower changes that have been inserted before. |
| 422 PhaseScope phase_scope(pipeline_statistics.get(), "change lowering"); | 420 PhaseScope phase_scope(pipeline_statistics.get(), "change lowering"); |
| 423 ZonePool::Scope zone_scope(data.zone_pool()); | |
| 424 SourcePositionTable::Scope pos(data.source_positions(), | 421 SourcePositionTable::Scope pos(data.source_positions(), |
| 425 SourcePosition::Unknown()); | 422 SourcePosition::Unknown()); |
| 426 Linkage linkage(data.graph_zone(), info()); | 423 Linkage linkage(data.graph_zone(), info()); |
| 427 ValueNumberingReducer vn_reducer(data.graph_zone()); | 424 ValueNumberingReducer vn_reducer(data.graph_zone()); |
| 428 SimplifiedOperatorReducer simple_reducer(data.jsgraph()); | 425 SimplifiedOperatorReducer simple_reducer(data.jsgraph()); |
| 429 ChangeLowering lowering(data.jsgraph(), &linkage); | 426 ChangeLowering lowering(data.jsgraph(), &linkage); |
| 430 MachineOperatorReducer mach_reducer(data.jsgraph()); | 427 MachineOperatorReducer mach_reducer(data.jsgraph()); |
| 431 GraphReducer graph_reducer(data.graph(), zone_scope.zone()); | 428 GraphReducer graph_reducer(data.graph()); |
| 432 // TODO(titzer): Figure out if we should run all reducers at once here. | 429 // TODO(titzer): Figure out if we should run all reducers at once here. |
| 433 graph_reducer.AddReducer(&vn_reducer); | 430 graph_reducer.AddReducer(&vn_reducer); |
| 434 graph_reducer.AddReducer(&simple_reducer); | 431 graph_reducer.AddReducer(&simple_reducer); |
| 435 graph_reducer.AddReducer(&lowering); | 432 graph_reducer.AddReducer(&lowering); |
| 436 graph_reducer.AddReducer(&mach_reducer); | 433 graph_reducer.AddReducer(&mach_reducer); |
| 437 graph_reducer.ReduceGraph(); | 434 graph_reducer.ReduceGraph(); |
| 438 | 435 |
| 439 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. | 436 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. |
| 440 VerifyAndPrintGraph(data.graph(), "Lowered changes", true); | 437 VerifyAndPrintGraph(data.graph(), "Lowered changes", true); |
| 441 } | 438 } |
| 442 | 439 |
| 443 { | 440 { |
| 444 PhaseScope phase_scope(pipeline_statistics.get(), | 441 PhaseScope phase_scope(pipeline_statistics.get(), |
| 445 "late control reduction"); | 442 "late control reduction"); |
| 446 SourcePositionTable::Scope pos(data.source_positions(), | 443 SourcePositionTable::Scope pos(data.source_positions(), |
| 447 SourcePosition::Unknown()); | 444 SourcePosition::Unknown()); |
| 448 ZonePool::Scope zone_scope(data.zone_pool()); | 445 ZonePool::Scope zone_scope(data.zone_pool()); |
| 449 ControlReducer::ReduceGraph(zone_scope.zone(), data.jsgraph(), | 446 ControlReducer::ReduceGraph(zone_scope.zone(), data.jsgraph(), |
| 450 data.common()); | 447 data.common()); |
| 451 | 448 |
| 452 VerifyAndPrintGraph(data.graph(), "Late Control reduced"); | 449 VerifyAndPrintGraph(data.graph(), "Late Control reduced"); |
| 453 } | 450 } |
| 454 } | 451 } |
| 455 | 452 |
| 456 { | 453 { |
| 457 // Lower any remaining generic JSOperators. | 454 // Lower any remaining generic JSOperators. |
| 458 PhaseScope phase_scope(pipeline_statistics.get(), "generic lowering"); | 455 PhaseScope phase_scope(pipeline_statistics.get(), "generic lowering"); |
| 459 ZonePool::Scope zone_scope(data.zone_pool()); | |
| 460 SourcePositionTable::Scope pos(data.source_positions(), | 456 SourcePositionTable::Scope pos(data.source_positions(), |
| 461 SourcePosition::Unknown()); | 457 SourcePosition::Unknown()); |
| 462 JSGenericLowering generic(info(), data.jsgraph()); | 458 JSGenericLowering generic(info(), data.jsgraph()); |
| 463 SelectLowering select(data.jsgraph()->graph(), data.jsgraph()->common()); | 459 SelectLowering select(data.jsgraph()->graph(), data.jsgraph()->common()); |
| 464 GraphReducer graph_reducer(data.graph(), zone_scope.zone()); | 460 GraphReducer graph_reducer(data.graph()); |
| 465 graph_reducer.AddReducer(&generic); | 461 graph_reducer.AddReducer(&generic); |
| 466 graph_reducer.AddReducer(&select); | 462 graph_reducer.AddReducer(&select); |
| 467 graph_reducer.ReduceGraph(); | 463 graph_reducer.ReduceGraph(); |
| 468 | 464 |
| 469 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. | 465 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. |
| 470 VerifyAndPrintGraph(data.graph(), "Lowered generic", true); | 466 VerifyAndPrintGraph(data.graph(), "Lowered generic", true); |
| 471 } | 467 } |
| 472 | 468 |
| 473 if (!pipeline_statistics.is_empty()) { | 469 if (!pipeline_statistics.is_empty()) { |
| 474 pipeline_statistics->BeginPhaseKind("block building"); | 470 pipeline_statistics->BeginPhaseKind("block building"); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 } | 648 } |
| 653 | 649 |
| 654 | 650 |
| 655 void Pipeline::TearDown() { | 651 void Pipeline::TearDown() { |
| 656 InstructionOperand::TearDownCaches(); | 652 InstructionOperand::TearDownCaches(); |
| 657 } | 653 } |
| 658 | 654 |
| 659 } // namespace compiler | 655 } // namespace compiler |
| 660 } // namespace internal | 656 } // namespace internal |
| 661 } // namespace v8 | 657 } // namespace v8 |
| OLD | NEW |