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

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

Issue 1198923002: [turbofan] Run DeadCodeElimination as part of the generic lowering phase. (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 | « no previous file | no next file » | 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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 DeadCodeElimination dce(&graph_reducer, data->graph(), data->common()); 644 DeadCodeElimination dce(&graph_reducer, data->graph(), data->common());
645 CommonOperatorReducer common(&graph_reducer, data->graph(), data->common(), 645 CommonOperatorReducer common(&graph_reducer, data->graph(), data->common(),
646 data->machine()); 646 data->machine());
647 graph_reducer.AddReducer(&dce); 647 graph_reducer.AddReducer(&dce);
648 graph_reducer.AddReducer(&common); 648 graph_reducer.AddReducer(&common);
649 graph_reducer.ReduceGraph(); 649 graph_reducer.ReduceGraph();
650 } 650 }
651 }; 651 };
652 652
653 653
654 struct LateControlReductionPhase {
655 static const char* phase_name() { return "late control reduction"; }
656 void Run(PipelineData* data, Zone* temp_zone) {
657 GraphReducer graph_reducer(temp_zone, data->graph());
658 DeadCodeElimination dce(&graph_reducer, data->graph(), data->common());
659 CommonOperatorReducer common(&graph_reducer, data->graph(), data->common(),
660 data->machine());
661 graph_reducer.AddReducer(&dce);
662 graph_reducer.AddReducer(&common);
663 graph_reducer.ReduceGraph();
664 }
665 };
666
667
668 struct EarlyGraphTrimmingPhase { 654 struct EarlyGraphTrimmingPhase {
669 static const char* phase_name() { return "early graph trimming"; } 655 static const char* phase_name() { return "early graph trimming"; }
670 void Run(PipelineData* data, Zone* temp_zone) { 656 void Run(PipelineData* data, Zone* temp_zone) {
671 GraphTrimmer trimmer(temp_zone, data->graph()); 657 GraphTrimmer trimmer(temp_zone, data->graph());
672 NodeVector roots(temp_zone); 658 NodeVector roots(temp_zone);
673 data->jsgraph()->GetCachedNodes(&roots); 659 data->jsgraph()->GetCachedNodes(&roots);
674 trimmer.TrimGraph(roots.begin(), roots.end()); 660 trimmer.TrimGraph(roots.begin(), roots.end());
675 } 661 }
676 }; 662 };
677 663
(...skipping 21 matching lines...) Expand all
699 loop_tree->outer_loops()[0], temp_zone); 685 loop_tree->outer_loops()[0], temp_zone);
700 } 686 }
701 } 687 }
702 }; 688 };
703 689
704 690
705 struct GenericLoweringPhase { 691 struct GenericLoweringPhase {
706 static const char* phase_name() { return "generic lowering"; } 692 static const char* phase_name() { return "generic lowering"; }
707 693
708 void Run(PipelineData* data, Zone* temp_zone) { 694 void Run(PipelineData* data, Zone* temp_zone) {
709 JSGenericLowering generic(data->info()->is_typing_enabled(), 695 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
710 data->jsgraph()); 696 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
711 SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common()); 697 data->common());
698 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
699 data->common(), data->machine());
700 JSGenericLowering generic_lowering(data->info()->is_typing_enabled(),
701 data->jsgraph());
702 SelectLowering select_lowering(data->jsgraph()->graph(),
703 data->jsgraph()->common());
712 TailCallOptimization tco(data->common(), data->graph()); 704 TailCallOptimization tco(data->common(), data->graph());
713 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 705 AddReducer(data, &graph_reducer, &dead_code_elimination);
714 AddReducer(data, &graph_reducer, &generic); 706 AddReducer(data, &graph_reducer, &common_reducer);
715 AddReducer(data, &graph_reducer, &select); 707 AddReducer(data, &graph_reducer, &generic_lowering);
708 AddReducer(data, &graph_reducer, &select_lowering);
716 // TODO(turbofan): TCO is currently limited to stubs. 709 // TODO(turbofan): TCO is currently limited to stubs.
717 if (data->info()->IsStub()) AddReducer(data, &graph_reducer, &tco); 710 if (data->info()->IsStub()) AddReducer(data, &graph_reducer, &tco);
718 graph_reducer.ReduceGraph(); 711 graph_reducer.ReduceGraph();
719 } 712 }
720 }; 713 };
721 714
722 715
723 struct ComputeSchedulePhase { 716 struct ComputeSchedulePhase {
724 static const char* phase_name() { return "scheduling"; } 717 static const char* phase_name() { return "scheduling"; }
725 718
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 // Optimize control flow. 1099 // Optimize control flow.
1107 if (FLAG_turbo_cf_optimization) { 1100 if (FLAG_turbo_cf_optimization) {
1108 Run<ControlFlowOptimizationPhase>(); 1101 Run<ControlFlowOptimizationPhase>();
1109 RunPrintAndVerify("Control flow optimized"); 1102 RunPrintAndVerify("Control flow optimized");
1110 } 1103 }
1111 1104
1112 // Lower changes that have been inserted before. 1105 // Lower changes that have been inserted before.
1113 Run<ChangeLoweringPhase>(); 1106 Run<ChangeLoweringPhase>();
1114 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 1107 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
1115 RunPrintAndVerify("Lowered changes", true); 1108 RunPrintAndVerify("Lowered changes", true);
1116
1117 Run<LateControlReductionPhase>();
1118 RunPrintAndVerify("Late Control reduced");
1119 } else { 1109 } else {
1120 if (info()->is_osr()) { 1110 if (info()->is_osr()) {
1121 Run<OsrDeconstructionPhase>(); 1111 Run<OsrDeconstructionPhase>();
1122 if (info()->bailout_reason() != kNoReason) return Handle<Code>::null(); 1112 if (info()->bailout_reason() != kNoReason) return Handle<Code>::null();
1123 RunPrintAndVerify("OSR deconstruction", true); 1113 RunPrintAndVerify("OSR deconstruction", true);
1124 } 1114 }
1125 } 1115 }
1126 1116
1127 // Lower any remaining generic JSOperators. 1117 // Lower any remaining generic JSOperators.
1128 Run<GenericLoweringPhase>(); 1118 Run<GenericLoweringPhase>();
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 tcf << AsC1VRegisterAllocationData("CodeGen", 1366 tcf << AsC1VRegisterAllocationData("CodeGen",
1377 data->register_allocation_data()); 1367 data->register_allocation_data());
1378 } 1368 }
1379 1369
1380 data->DeleteRegisterAllocationZone(); 1370 data->DeleteRegisterAllocationZone();
1381 } 1371 }
1382 1372
1383 } // namespace compiler 1373 } // namespace compiler
1384 } // namespace internal 1374 } // namespace internal
1385 } // namespace v8 1375 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698