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/adapters.h" | 10 #include "src/base/adapters.h" |
11 #include "src/base/platform/elapsed-timer.h" | 11 #include "src/base/platform/elapsed-timer.h" |
12 #include "src/compiler/ast-graph-builder.h" | 12 #include "src/compiler/ast-graph-builder.h" |
13 #include "src/compiler/ast-loop-assignment-analyzer.h" | 13 #include "src/compiler/ast-loop-assignment-analyzer.h" |
14 #include "src/compiler/basic-block-instrumentor.h" | 14 #include "src/compiler/basic-block-instrumentor.h" |
15 #include "src/compiler/change-lowering.h" | 15 #include "src/compiler/change-lowering.h" |
16 #include "src/compiler/code-generator.h" | 16 #include "src/compiler/code-generator.h" |
17 #include "src/compiler/common-operator-reducer.h" | 17 #include "src/compiler/common-operator-reducer.h" |
18 #include "src/compiler/control-flow-optimizer.h" | 18 #include "src/compiler/control-flow-optimizer.h" |
19 #include "src/compiler/control-reducer.h" | 19 #include "src/compiler/dead-code-elimination.h" |
20 #include "src/compiler/frame-elider.h" | 20 #include "src/compiler/frame-elider.h" |
21 #include "src/compiler/graph-replay.h" | 21 #include "src/compiler/graph-replay.h" |
22 #include "src/compiler/graph-trimmer.h" | 22 #include "src/compiler/graph-trimmer.h" |
23 #include "src/compiler/graph-visualizer.h" | 23 #include "src/compiler/graph-visualizer.h" |
24 #include "src/compiler/greedy-allocator.h" | 24 #include "src/compiler/greedy-allocator.h" |
25 #include "src/compiler/instruction.h" | 25 #include "src/compiler/instruction.h" |
26 #include "src/compiler/instruction-selector.h" | 26 #include "src/compiler/instruction-selector.h" |
27 #include "src/compiler/js-builtin-reducer.h" | 27 #include "src/compiler/js-builtin-reducer.h" |
28 #include "src/compiler/js-context-specialization.h" | 28 #include "src/compiler/js-context-specialization.h" |
29 #include "src/compiler/js-generic-lowering.h" | 29 #include "src/compiler/js-generic-lowering.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->DeadValue(), | 410 : GraphReducer(zone, jsgraph->graph(), jsgraph->TheHoleConstant(), |
411 jsgraph->DeadControl()) {} | 411 jsgraph->Dead()) {} |
412 ~JSGraphReducer() final {} | 412 ~JSGraphReducer() final {} |
413 }; | 413 }; |
414 | 414 |
415 | 415 |
416 void AddReducer(PipelineData* data, GraphReducer* graph_reducer, | 416 void AddReducer(PipelineData* data, GraphReducer* graph_reducer, |
417 Reducer* reducer) { | 417 Reducer* reducer) { |
418 if (data->info()->is_source_positions_enabled()) { | 418 if (data->info()->is_source_positions_enabled()) { |
419 void* const buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper)); | 419 void* const buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper)); |
420 SourcePositionWrapper* const wrapper = | 420 SourcePositionWrapper* const wrapper = |
421 new (buffer) SourcePositionWrapper(reducer, data->source_positions()); | 421 new (buffer) SourcePositionWrapper(reducer, data->source_positions()); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 AddReducer(data, &graph_reducer, &machine_reducer); | 633 AddReducer(data, &graph_reducer, &machine_reducer); |
634 AddReducer(data, &graph_reducer, &common_reducer); | 634 AddReducer(data, &graph_reducer, &common_reducer); |
635 graph_reducer.ReduceGraph(); | 635 graph_reducer.ReduceGraph(); |
636 } | 636 } |
637 }; | 637 }; |
638 | 638 |
639 | 639 |
640 struct EarlyControlReductionPhase { | 640 struct EarlyControlReductionPhase { |
641 static const char* phase_name() { return "early control reduction"; } | 641 static const char* phase_name() { return "early control reduction"; } |
642 void Run(PipelineData* data, Zone* temp_zone) { | 642 void Run(PipelineData* data, Zone* temp_zone) { |
643 ControlReducer::ReduceGraph(temp_zone, data->jsgraph(), 0); | 643 GraphReducer graph_reducer(temp_zone, data->graph()); |
| 644 DeadCodeElimination dce(&graph_reducer, data->graph(), data->common()); |
| 645 CommonOperatorReducer common(&graph_reducer, data->graph(), data->common(), |
| 646 data->machine()); |
| 647 graph_reducer.AddReducer(&dce); |
| 648 graph_reducer.AddReducer(&common); |
| 649 graph_reducer.ReduceGraph(); |
644 } | 650 } |
645 }; | 651 }; |
646 | 652 |
647 | 653 |
648 struct LateControlReductionPhase { | 654 struct LateControlReductionPhase { |
649 static const char* phase_name() { return "late control reduction"; } | 655 static const char* phase_name() { return "late control reduction"; } |
650 void Run(PipelineData* data, Zone* temp_zone) { | 656 void Run(PipelineData* data, Zone* temp_zone) { |
651 ControlReducer::ReduceGraph(temp_zone, data->jsgraph(), 0); | 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(); |
652 } | 664 } |
653 }; | 665 }; |
654 | 666 |
655 | 667 |
656 struct EarlyGraphTrimmingPhase { | 668 struct EarlyGraphTrimmingPhase { |
657 static const char* phase_name() { return "early graph trimming"; } | 669 static const char* phase_name() { return "early graph trimming"; } |
658 void Run(PipelineData* data, Zone* temp_zone) { | 670 void Run(PipelineData* data, Zone* temp_zone) { |
659 GraphTrimmer trimmer(temp_zone, data->graph()); | 671 GraphTrimmer trimmer(temp_zone, data->graph()); |
660 NodeVector roots(temp_zone); | 672 NodeVector roots(temp_zone); |
661 data->jsgraph()->GetCachedNodes(&roots); | 673 data->jsgraph()->GetCachedNodes(&roots); |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 tcf << AsC1VRegisterAllocationData("CodeGen", | 1376 tcf << AsC1VRegisterAllocationData("CodeGen", |
1365 data->register_allocation_data()); | 1377 data->register_allocation_data()); |
1366 } | 1378 } |
1367 | 1379 |
1368 data->DeleteRegisterAllocationZone(); | 1380 data->DeleteRegisterAllocationZone(); |
1369 } | 1381 } |
1370 | 1382 |
1371 } // namespace compiler | 1383 } // namespace compiler |
1372 } // namespace internal | 1384 } // namespace internal |
1373 } // namespace v8 | 1385 } // namespace v8 |
OLD | NEW |