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

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

Issue 1200983004: Revert of [turbofan] Run DeadCodeElimination together with the advanced reducers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/js-intrinsic-lowering.cc ('k') | src/compiler/verifier.cc » ('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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 Reducer* const reducer_; 400 Reducer* const reducer_;
401 SourcePositionTable* const table_; 401 SourcePositionTable* const table_;
402 402
403 DISALLOW_COPY_AND_ASSIGN(SourcePositionWrapper); 403 DISALLOW_COPY_AND_ASSIGN(SourcePositionWrapper);
404 }; 404 };
405 405
406 406
407 class JSGraphReducer final : public GraphReducer { 407 class JSGraphReducer final : public GraphReducer {
408 public: 408 public:
409 JSGraphReducer(JSGraph* jsgraph, Zone* zone) 409 JSGraphReducer(JSGraph* jsgraph, Zone* zone)
410 : GraphReducer(zone, jsgraph->graph(), jsgraph->Dead()) {} 410 : GraphReducer(zone, jsgraph->graph(), jsgraph->TheHoleConstant(),
411 jsgraph->Dead()) {}
411 ~JSGraphReducer() final {} 412 ~JSGraphReducer() final {}
412 }; 413 };
413 414
414 415
415 void AddReducer(PipelineData* data, GraphReducer* graph_reducer, 416 void AddReducer(PipelineData* data, GraphReducer* graph_reducer,
416 Reducer* reducer) { 417 Reducer* reducer) {
417 if (data->info()->is_source_positions_enabled()) { 418 if (data->info()->is_source_positions_enabled()) {
418 void* const buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper)); 419 void* const buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper));
419 SourcePositionWrapper* const wrapper = 420 SourcePositionWrapper* const wrapper =
420 new (buffer) SourcePositionWrapper(reducer, data->source_positions()); 421 new (buffer) SourcePositionWrapper(reducer, data->source_positions());
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 graph_reducer.ReduceGraph(); 558 graph_reducer.ReduceGraph();
558 } 559 }
559 }; 560 };
560 561
561 562
562 struct TypedLoweringPhase { 563 struct TypedLoweringPhase {
563 static const char* phase_name() { return "typed lowering"; } 564 static const char* phase_name() { return "typed lowering"; }
564 565
565 void Run(PipelineData* data, Zone* temp_zone) { 566 void Run(PipelineData* data, Zone* temp_zone) {
566 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 567 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
567 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
568 data->common());
569 LoadElimination load_elimination(&graph_reducer); 568 LoadElimination load_elimination(&graph_reducer);
570 JSBuiltinReducer builtin_reducer(&graph_reducer, data->jsgraph()); 569 JSBuiltinReducer builtin_reducer(&graph_reducer, data->jsgraph());
571 JSTypedLowering typed_lowering(&graph_reducer, data->jsgraph(), temp_zone); 570 JSTypedLowering typed_lowering(&graph_reducer, data->jsgraph(), temp_zone);
572 JSIntrinsicLowering intrinsic_lowering( 571 JSIntrinsicLowering intrinsic_lowering(
573 &graph_reducer, data->jsgraph(), 572 &graph_reducer, data->jsgraph(),
574 data->info()->is_deoptimization_enabled() 573 data->info()->is_deoptimization_enabled()
575 ? JSIntrinsicLowering::kDeoptimizationEnabled 574 ? JSIntrinsicLowering::kDeoptimizationEnabled
576 : JSIntrinsicLowering::kDeoptimizationDisabled); 575 : JSIntrinsicLowering::kDeoptimizationDisabled);
577 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), 576 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
578 data->common(), data->machine()); 577 data->common(), data->machine());
579 AddReducer(data, &graph_reducer, &dead_code_elimination);
580 AddReducer(data, &graph_reducer, &builtin_reducer); 578 AddReducer(data, &graph_reducer, &builtin_reducer);
581 AddReducer(data, &graph_reducer, &typed_lowering); 579 AddReducer(data, &graph_reducer, &typed_lowering);
582 AddReducer(data, &graph_reducer, &intrinsic_lowering); 580 AddReducer(data, &graph_reducer, &intrinsic_lowering);
583 AddReducer(data, &graph_reducer, &load_elimination); 581 AddReducer(data, &graph_reducer, &load_elimination);
584 AddReducer(data, &graph_reducer, &common_reducer); 582 AddReducer(data, &graph_reducer, &common_reducer);
585 graph_reducer.ReduceGraph(); 583 graph_reducer.ReduceGraph();
586 } 584 }
587 }; 585 };
588 586
589 587
590 struct SimplifiedLoweringPhase { 588 struct SimplifiedLoweringPhase {
591 static const char* phase_name() { return "simplified lowering"; } 589 static const char* phase_name() { return "simplified lowering"; }
592 590
593 void Run(PipelineData* data, Zone* temp_zone) { 591 void Run(PipelineData* data, Zone* temp_zone) {
594 SimplifiedLowering lowering(data->jsgraph(), temp_zone, 592 SimplifiedLowering lowering(data->jsgraph(), temp_zone,
595 data->source_positions()); 593 data->source_positions());
596 lowering.LowerAllNodes(); 594 lowering.LowerAllNodes();
597 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 595 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
598 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
599 data->common());
600 ValueNumberingReducer vn_reducer(temp_zone); 596 ValueNumberingReducer vn_reducer(temp_zone);
601 MachineOperatorReducer machine_reducer(data->jsgraph()); 597 MachineOperatorReducer machine_reducer(data->jsgraph());
602 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), 598 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
603 data->common(), data->machine()); 599 data->common(), data->machine());
604 AddReducer(data, &graph_reducer, &dead_code_elimination);
605 AddReducer(data, &graph_reducer, &vn_reducer); 600 AddReducer(data, &graph_reducer, &vn_reducer);
606 AddReducer(data, &graph_reducer, &machine_reducer); 601 AddReducer(data, &graph_reducer, &machine_reducer);
607 AddReducer(data, &graph_reducer, &common_reducer); 602 AddReducer(data, &graph_reducer, &common_reducer);
608 graph_reducer.ReduceGraph(); 603 graph_reducer.ReduceGraph();
609 } 604 }
610 }; 605 };
611 606
612 607
613 struct ControlFlowOptimizationPhase { 608 struct ControlFlowOptimizationPhase {
614 static const char* phase_name() { return "control flow optimization"; } 609 static const char* phase_name() { return "control flow optimization"; }
615 610
616 void Run(PipelineData* data, Zone* temp_zone) { 611 void Run(PipelineData* data, Zone* temp_zone) {
617 ControlFlowOptimizer optimizer(data->graph(), data->common(), 612 ControlFlowOptimizer optimizer(data->graph(), data->common(),
618 data->machine(), temp_zone); 613 data->machine(), temp_zone);
619 optimizer.Optimize(); 614 optimizer.Optimize();
620 } 615 }
621 }; 616 };
622 617
623 618
624 struct ChangeLoweringPhase { 619 struct ChangeLoweringPhase {
625 static const char* phase_name() { return "change lowering"; } 620 static const char* phase_name() { return "change lowering"; }
626 621
627 void Run(PipelineData* data, Zone* temp_zone) { 622 void Run(PipelineData* data, Zone* temp_zone) {
628 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 623 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
629 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
630 data->common());
631 ValueNumberingReducer vn_reducer(temp_zone); 624 ValueNumberingReducer vn_reducer(temp_zone);
632 ChangeLowering lowering(data->jsgraph()); 625 ChangeLowering lowering(data->jsgraph());
633 MachineOperatorReducer machine_reducer(data->jsgraph()); 626 MachineOperatorReducer machine_reducer(data->jsgraph());
634 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), 627 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
635 data->common(), data->machine()); 628 data->common(), data->machine());
636 AddReducer(data, &graph_reducer, &dead_code_elimination);
637 AddReducer(data, &graph_reducer, &vn_reducer); 629 AddReducer(data, &graph_reducer, &vn_reducer);
638 AddReducer(data, &graph_reducer, &lowering); 630 AddReducer(data, &graph_reducer, &lowering);
639 AddReducer(data, &graph_reducer, &machine_reducer); 631 AddReducer(data, &graph_reducer, &machine_reducer);
640 AddReducer(data, &graph_reducer, &common_reducer); 632 AddReducer(data, &graph_reducer, &common_reducer);
641 graph_reducer.ReduceGraph(); 633 graph_reducer.ReduceGraph();
642 } 634 }
643 }; 635 };
636
637
638 struct LateControlReductionPhase {
639 static const char* phase_name() { return "late control reduction"; }
640 void Run(PipelineData* data, Zone* temp_zone) {
641 GraphReducer graph_reducer(temp_zone, data->graph());
642 DeadCodeElimination dce(&graph_reducer, data->graph(), data->common());
643 CommonOperatorReducer common(&graph_reducer, data->graph(), data->common(),
644 data->machine());
645 graph_reducer.AddReducer(&dce);
646 graph_reducer.AddReducer(&common);
647 graph_reducer.ReduceGraph();
648 }
649 };
644 650
645 651
646 struct EarlyGraphTrimmingPhase { 652 struct EarlyGraphTrimmingPhase {
647 static const char* phase_name() { return "early graph trimming"; } 653 static const char* phase_name() { return "early graph trimming"; }
648 void Run(PipelineData* data, Zone* temp_zone) { 654 void Run(PipelineData* data, Zone* temp_zone) {
649 GraphTrimmer trimmer(temp_zone, data->graph()); 655 GraphTrimmer trimmer(temp_zone, data->graph());
650 NodeVector roots(temp_zone); 656 NodeVector roots(temp_zone);
651 data->jsgraph()->GetCachedNodes(&roots); 657 data->jsgraph()->GetCachedNodes(&roots);
652 trimmer.TrimGraph(roots.begin(), roots.end()); 658 trimmer.TrimGraph(roots.begin(), roots.end());
653 } 659 }
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 tcf << AsC1VRegisterAllocationData("CodeGen", 1357 tcf << AsC1VRegisterAllocationData("CodeGen",
1352 data->register_allocation_data()); 1358 data->register_allocation_data());
1353 } 1359 }
1354 1360
1355 data->DeleteRegisterAllocationZone(); 1361 data->DeleteRegisterAllocationZone();
1356 } 1362 }
1357 1363
1358 } // namespace compiler 1364 } // namespace compiler
1359 } // namespace internal 1365 } // namespace internal
1360 } // namespace v8 1366 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-intrinsic-lowering.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698