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