Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: src/compiler/pipeline.cc

Issue 1109763002: [turbofan] Treat uninitialized source positions as unknown. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/source-position.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/adapters.h" 10 #include "src/base/adapters.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 data->set_compilation_failed(); 481 data->set_compilation_failed();
482 } 482 }
483 } 483 }
484 }; 484 };
485 485
486 486
487 struct ContextSpecializerPhase { 487 struct ContextSpecializerPhase {
488 static const char* phase_name() { return "context specializing"; } 488 static const char* phase_name() { return "context specializing"; }
489 489
490 void Run(PipelineData* data, Zone* temp_zone) { 490 void Run(PipelineData* data, Zone* temp_zone) {
491 SourcePositionTable::Scope pos(data->source_positions(),
492 SourcePosition::Unknown());
493 JSContextSpecializer spec(data->jsgraph()); 491 JSContextSpecializer spec(data->jsgraph());
494 GraphReducer graph_reducer(data->graph(), temp_zone); 492 GraphReducer graph_reducer(data->graph(), temp_zone);
495 AddReducer(data, &graph_reducer, &spec); 493 AddReducer(data, &graph_reducer, &spec);
496 graph_reducer.ReduceGraph(); 494 graph_reducer.ReduceGraph();
497 } 495 }
498 }; 496 };
499 497
500 498
501 struct InliningPhase { 499 struct InliningPhase {
502 static const char* phase_name() { return "inlining"; } 500 static const char* phase_name() { return "inlining"; }
503 501
504 void Run(PipelineData* data, Zone* temp_zone) { 502 void Run(PipelineData* data, Zone* temp_zone) {
505 SourcePositionTable::Scope pos(data->source_positions(),
506 SourcePosition::Unknown());
507 GraphReducer graph_reducer(data->graph(), temp_zone); 503 GraphReducer graph_reducer(data->graph(), temp_zone);
508 JSInliner inliner(&graph_reducer, data->info()->is_inlining_enabled() 504 JSInliner inliner(&graph_reducer, data->info()->is_inlining_enabled()
509 ? JSInliner::kGeneralInlining 505 ? JSInliner::kGeneralInlining
510 : JSInliner::kBuiltinsInlining, 506 : JSInliner::kBuiltinsInlining,
511 temp_zone, data->info(), data->jsgraph()); 507 temp_zone, data->info(), data->jsgraph());
512 AddReducer(data, &graph_reducer, &inliner); 508 AddReducer(data, &graph_reducer, &inliner);
513 graph_reducer.ReduceGraph(); 509 graph_reducer.ReduceGraph();
514 } 510 }
515 }; 511 };
516 512
517 513
518 struct TyperPhase { 514 struct TyperPhase {
519 static const char* phase_name() { return "typer"; } 515 static const char* phase_name() { return "typer"; }
520 516
521 void Run(PipelineData* data, Zone* temp_zone) { data->typer()->Run(); } 517 void Run(PipelineData* data, Zone* temp_zone) { data->typer()->Run(); }
522 }; 518 };
523 519
524 520
525 struct OsrDeconstructionPhase { 521 struct OsrDeconstructionPhase {
526 static const char* phase_name() { return "OSR deconstruction"; } 522 static const char* phase_name() { return "OSR deconstruction"; }
527 523
528 void Run(PipelineData* data, Zone* temp_zone) { 524 void Run(PipelineData* data, Zone* temp_zone) {
529 SourcePositionTable::Scope pos(data->source_positions(),
530 SourcePosition::Unknown());
531 OsrHelper osr_helper(data->info()); 525 OsrHelper osr_helper(data->info());
532 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone); 526 osr_helper.Deconstruct(data->jsgraph(), data->common(), temp_zone);
533 } 527 }
534 }; 528 };
535 529
536 530
537 struct JSTypeFeedbackPhase { 531 struct JSTypeFeedbackPhase {
538 static const char* phase_name() { return "type feedback specializing"; } 532 static const char* phase_name() { return "type feedback specializing"; }
539 533
540 void Run(PipelineData* data, Zone* temp_zone) { 534 void Run(PipelineData* data, Zone* temp_zone) {
541 SourcePositionTable::Scope pos(data->source_positions(),
542 SourcePosition::Unknown());
543 Handle<Context> native_context(data->info()->context()->native_context()); 535 Handle<Context> native_context(data->info()->context()->native_context());
544 TypeFeedbackOracle oracle(data->isolate(), temp_zone, 536 TypeFeedbackOracle oracle(data->isolate(), temp_zone,
545 data->info()->unoptimized_code(), 537 data->info()->unoptimized_code(),
546 data->info()->feedback_vector(), native_context); 538 data->info()->feedback_vector(), native_context);
547 GraphReducer graph_reducer(data->graph(), temp_zone); 539 GraphReducer graph_reducer(data->graph(), temp_zone);
548 Handle<GlobalObject> global_object = Handle<GlobalObject>::null(); 540 Handle<GlobalObject> global_object = Handle<GlobalObject>::null();
549 if (data->info()->has_global_object()) { 541 if (data->info()->has_global_object()) {
550 global_object = 542 global_object =
551 Handle<GlobalObject>(data->info()->global_object(), data->isolate()); 543 Handle<GlobalObject>(data->info()->global_object(), data->isolate());
552 } 544 }
553 // TODO(titzer): introduce a specialization mode/flags enum to control 545 // TODO(titzer): introduce a specialization mode/flags enum to control
554 // specializing to the global object here. 546 // specializing to the global object here.
555 JSTypeFeedbackSpecializer specializer( 547 JSTypeFeedbackSpecializer specializer(
556 data->jsgraph(), data->js_type_feedback(), &oracle, global_object, 548 data->jsgraph(), data->js_type_feedback(), &oracle, global_object,
557 data->info()->dependencies()); 549 data->info()->dependencies());
558 AddReducer(data, &graph_reducer, &specializer); 550 AddReducer(data, &graph_reducer, &specializer);
559 graph_reducer.ReduceGraph(); 551 graph_reducer.ReduceGraph();
560 } 552 }
561 }; 553 };
562 554
563 555
564 struct TypedLoweringPhase { 556 struct TypedLoweringPhase {
565 static const char* phase_name() { return "typed lowering"; } 557 static const char* phase_name() { return "typed lowering"; }
566 558
567 void Run(PipelineData* data, Zone* temp_zone) { 559 void Run(PipelineData* data, Zone* temp_zone) {
568 SourcePositionTable::Scope pos(data->source_positions(),
569 SourcePosition::Unknown());
570 LoadElimination load_elimination; 560 LoadElimination load_elimination;
571 JSBuiltinReducer builtin_reducer(data->jsgraph()); 561 JSBuiltinReducer builtin_reducer(data->jsgraph());
572 JSTypedLowering typed_lowering(data->jsgraph(), temp_zone); 562 JSTypedLowering typed_lowering(data->jsgraph(), temp_zone);
573 JSIntrinsicLowering intrinsic_lowering(data->jsgraph()); 563 JSIntrinsicLowering intrinsic_lowering(data->jsgraph());
574 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); 564 SimplifiedOperatorReducer simple_reducer(data->jsgraph());
575 CommonOperatorReducer common_reducer(data->jsgraph()); 565 CommonOperatorReducer common_reducer(data->jsgraph());
576 GraphReducer graph_reducer(data->graph(), temp_zone); 566 GraphReducer graph_reducer(data->graph(), temp_zone);
577 AddReducer(data, &graph_reducer, &builtin_reducer); 567 AddReducer(data, &graph_reducer, &builtin_reducer);
578 AddReducer(data, &graph_reducer, &typed_lowering); 568 AddReducer(data, &graph_reducer, &typed_lowering);
579 AddReducer(data, &graph_reducer, &intrinsic_lowering); 569 AddReducer(data, &graph_reducer, &intrinsic_lowering);
580 AddReducer(data, &graph_reducer, &load_elimination); 570 AddReducer(data, &graph_reducer, &load_elimination);
581 AddReducer(data, &graph_reducer, &simple_reducer); 571 AddReducer(data, &graph_reducer, &simple_reducer);
582 AddReducer(data, &graph_reducer, &common_reducer); 572 AddReducer(data, &graph_reducer, &common_reducer);
583 graph_reducer.ReduceGraph(); 573 graph_reducer.ReduceGraph();
584 } 574 }
585 }; 575 };
586 576
587 577
588 struct SimplifiedLoweringPhase { 578 struct SimplifiedLoweringPhase {
589 static const char* phase_name() { return "simplified lowering"; } 579 static const char* phase_name() { return "simplified lowering"; }
590 580
591 void Run(PipelineData* data, Zone* temp_zone) { 581 void Run(PipelineData* data, Zone* temp_zone) {
592 SourcePositionTable::Scope pos(data->source_positions(),
593 SourcePosition::Unknown());
594 SimplifiedLowering lowering(data->jsgraph(), temp_zone, 582 SimplifiedLowering lowering(data->jsgraph(), temp_zone,
595 data->source_positions()); 583 data->source_positions());
596 lowering.LowerAllNodes(); 584 lowering.LowerAllNodes();
597 ValueNumberingReducer vn_reducer(temp_zone); 585 ValueNumberingReducer vn_reducer(temp_zone);
598 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); 586 SimplifiedOperatorReducer simple_reducer(data->jsgraph());
599 MachineOperatorReducer machine_reducer(data->jsgraph()); 587 MachineOperatorReducer machine_reducer(data->jsgraph());
600 CommonOperatorReducer common_reducer(data->jsgraph()); 588 CommonOperatorReducer common_reducer(data->jsgraph());
601 GraphReducer graph_reducer(data->graph(), temp_zone); 589 GraphReducer graph_reducer(data->graph(), temp_zone);
602 AddReducer(data, &graph_reducer, &vn_reducer); 590 AddReducer(data, &graph_reducer, &vn_reducer);
603 AddReducer(data, &graph_reducer, &simple_reducer); 591 AddReducer(data, &graph_reducer, &simple_reducer);
604 AddReducer(data, &graph_reducer, &machine_reducer); 592 AddReducer(data, &graph_reducer, &machine_reducer);
605 AddReducer(data, &graph_reducer, &common_reducer); 593 AddReducer(data, &graph_reducer, &common_reducer);
606 graph_reducer.ReduceGraph(); 594 graph_reducer.ReduceGraph();
607 } 595 }
608 }; 596 };
609 597
610 598
611 struct ControlFlowOptimizationPhase { 599 struct ControlFlowOptimizationPhase {
612 static const char* phase_name() { return "control flow optimization"; } 600 static const char* phase_name() { return "control flow optimization"; }
613 601
614 void Run(PipelineData* data, Zone* temp_zone) { 602 void Run(PipelineData* data, Zone* temp_zone) {
615 SourcePositionTable::Scope pos(data->source_positions(),
616 SourcePosition::Unknown());
617 ControlFlowOptimizer optimizer(data->jsgraph(), temp_zone); 603 ControlFlowOptimizer optimizer(data->jsgraph(), temp_zone);
618 optimizer.Optimize(); 604 optimizer.Optimize();
619 } 605 }
620 }; 606 };
621 607
622 608
623 struct ChangeLoweringPhase { 609 struct ChangeLoweringPhase {
624 static const char* phase_name() { return "change lowering"; } 610 static const char* phase_name() { return "change lowering"; }
625 611
626 void Run(PipelineData* data, Zone* temp_zone) { 612 void Run(PipelineData* data, Zone* temp_zone) {
627 SourcePositionTable::Scope pos(data->source_positions(),
628 SourcePosition::Unknown());
629 ValueNumberingReducer vn_reducer(temp_zone); 613 ValueNumberingReducer vn_reducer(temp_zone);
630 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); 614 SimplifiedOperatorReducer simple_reducer(data->jsgraph());
631 ChangeLowering lowering(data->jsgraph()); 615 ChangeLowering lowering(data->jsgraph());
632 MachineOperatorReducer machine_reducer(data->jsgraph()); 616 MachineOperatorReducer machine_reducer(data->jsgraph());
633 CommonOperatorReducer common_reducer(data->jsgraph()); 617 CommonOperatorReducer common_reducer(data->jsgraph());
634 GraphReducer graph_reducer(data->graph(), temp_zone); 618 GraphReducer graph_reducer(data->graph(), temp_zone);
635 AddReducer(data, &graph_reducer, &vn_reducer); 619 AddReducer(data, &graph_reducer, &vn_reducer);
636 AddReducer(data, &graph_reducer, &simple_reducer); 620 AddReducer(data, &graph_reducer, &simple_reducer);
637 AddReducer(data, &graph_reducer, &lowering); 621 AddReducer(data, &graph_reducer, &lowering);
638 AddReducer(data, &graph_reducer, &machine_reducer); 622 AddReducer(data, &graph_reducer, &machine_reducer);
639 AddReducer(data, &graph_reducer, &common_reducer); 623 AddReducer(data, &graph_reducer, &common_reducer);
640 graph_reducer.ReduceGraph(); 624 graph_reducer.ReduceGraph();
641 } 625 }
642 }; 626 };
643 627
644 628
645 struct EarlyControlReductionPhase { 629 struct EarlyControlReductionPhase {
646 static const char* phase_name() { return "early control reduction"; } 630 static const char* phase_name() { return "early control reduction"; }
647 void Run(PipelineData* data, Zone* temp_zone) { 631 void Run(PipelineData* data, Zone* temp_zone) {
648 SourcePositionTable::Scope pos(data->source_positions(),
649 SourcePosition::Unknown());
650 ControlReducer::ReduceGraph(temp_zone, data->jsgraph(), 0); 632 ControlReducer::ReduceGraph(temp_zone, data->jsgraph(), 0);
651 } 633 }
652 }; 634 };
653 635
654 636
655 struct LateControlReductionPhase { 637 struct LateControlReductionPhase {
656 static const char* phase_name() { return "late control reduction"; } 638 static const char* phase_name() { return "late control reduction"; }
657 void Run(PipelineData* data, Zone* temp_zone) { 639 void Run(PipelineData* data, Zone* temp_zone) {
658 SourcePositionTable::Scope pos(data->source_positions(),
659 SourcePosition::Unknown());
660 ControlReducer::ReduceGraph(temp_zone, data->jsgraph(), 0); 640 ControlReducer::ReduceGraph(temp_zone, data->jsgraph(), 0);
661 } 641 }
662 }; 642 };
663 643
664 644
665 struct StressLoopPeelingPhase { 645 struct StressLoopPeelingPhase {
666 static const char* phase_name() { return "stress loop peeling"; } 646 static const char* phase_name() { return "stress loop peeling"; }
667 647
668 void Run(PipelineData* data, Zone* temp_zone) { 648 void Run(PipelineData* data, Zone* temp_zone) {
669 SourcePositionTable::Scope pos(data->source_positions(),
670 SourcePosition::Unknown());
671 // Peel the first outer loop for testing. 649 // Peel the first outer loop for testing.
672 // TODO(titzer): peel all loops? the N'th loop? Innermost loops? 650 // TODO(titzer): peel all loops? the N'th loop? Innermost loops?
673 LoopTree* loop_tree = LoopFinder::BuildLoopTree(data->graph(), temp_zone); 651 LoopTree* loop_tree = LoopFinder::BuildLoopTree(data->graph(), temp_zone);
674 if (loop_tree != NULL && loop_tree->outer_loops().size() > 0) { 652 if (loop_tree != NULL && loop_tree->outer_loops().size() > 0) {
675 LoopPeeler::Peel(data->graph(), data->common(), loop_tree, 653 LoopPeeler::Peel(data->graph(), data->common(), loop_tree,
676 loop_tree->outer_loops()[0], temp_zone); 654 loop_tree->outer_loops()[0], temp_zone);
677 } 655 }
678 } 656 }
679 }; 657 };
680 658
681 659
682 struct GenericLoweringPhase { 660 struct GenericLoweringPhase {
683 static const char* phase_name() { return "generic lowering"; } 661 static const char* phase_name() { return "generic lowering"; }
684 662
685 void Run(PipelineData* data, Zone* temp_zone) { 663 void Run(PipelineData* data, Zone* temp_zone) {
686 SourcePositionTable::Scope pos(data->source_positions(),
687 SourcePosition::Unknown());
688 JSGenericLowering generic(data->info()->is_typing_enabled(), 664 JSGenericLowering generic(data->info()->is_typing_enabled(),
689 data->jsgraph()); 665 data->jsgraph());
690 SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common()); 666 SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common());
691 TailCallOptimization tco(data->common(), data->graph()); 667 TailCallOptimization tco(data->common(), data->graph());
692 GraphReducer graph_reducer(data->graph(), temp_zone); 668 GraphReducer graph_reducer(data->graph(), temp_zone);
693 AddReducer(data, &graph_reducer, &generic); 669 AddReducer(data, &graph_reducer, &generic);
694 AddReducer(data, &graph_reducer, &select); 670 AddReducer(data, &graph_reducer, &select);
695 // TODO(turbofan): TCO is currently limited to stubs. 671 // TODO(turbofan): TCO is currently limited to stubs.
696 if (data->info()->IsStub()) AddReducer(data, &graph_reducer, &tco); 672 if (data->info()->IsStub()) AddReducer(data, &graph_reducer, &tco);
697 graph_reducer.ReduceGraph(); 673 graph_reducer.ReduceGraph();
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 tcf << AsC1VRegisterAllocationData("CodeGen", 1323 tcf << AsC1VRegisterAllocationData("CodeGen",
1348 data->register_allocation_data()); 1324 data->register_allocation_data());
1349 } 1325 }
1350 1326
1351 data->DeleteRegisterAllocationZone(); 1327 data->DeleteRegisterAllocationZone();
1352 } 1328 }
1353 1329
1354 } // namespace compiler 1330 } // namespace compiler
1355 } // namespace internal 1331 } // namespace internal
1356 } // namespace v8 1332 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/source-position.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698