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" |
11 #include "src/compiler/ast-graph-builder.h" | 11 #include "src/compiler/ast-graph-builder.h" |
12 #include "src/compiler/ast-loop-assignment-analyzer.h" | 12 #include "src/compiler/ast-loop-assignment-analyzer.h" |
13 #include "src/compiler/basic-block-instrumentor.h" | 13 #include "src/compiler/basic-block-instrumentor.h" |
14 #include "src/compiler/change-lowering.h" | 14 #include "src/compiler/change-lowering.h" |
15 #include "src/compiler/code-generator.h" | 15 #include "src/compiler/code-generator.h" |
| 16 #include "src/compiler/common-operator-reducer.h" |
16 #include "src/compiler/control-reducer.h" | 17 #include "src/compiler/control-reducer.h" |
17 #include "src/compiler/graph-replay.h" | 18 #include "src/compiler/graph-replay.h" |
18 #include "src/compiler/graph-visualizer.h" | 19 #include "src/compiler/graph-visualizer.h" |
19 #include "src/compiler/instruction.h" | 20 #include "src/compiler/instruction.h" |
20 #include "src/compiler/instruction-selector.h" | 21 #include "src/compiler/instruction-selector.h" |
21 #include "src/compiler/js-builtin-reducer.h" | 22 #include "src/compiler/js-builtin-reducer.h" |
22 #include "src/compiler/js-context-specialization.h" | 23 #include "src/compiler/js-context-specialization.h" |
23 #include "src/compiler/js-generic-lowering.h" | 24 #include "src/compiler/js-generic-lowering.h" |
24 #include "src/compiler/js-inlining.h" | 25 #include "src/compiler/js-inlining.h" |
25 #include "src/compiler/js-typed-lowering.h" | 26 #include "src/compiler/js-typed-lowering.h" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 static const char* phase_name() { return "typed lowering"; } | 415 static const char* phase_name() { return "typed lowering"; } |
415 | 416 |
416 void Run(PipelineData* data, Zone* temp_zone) { | 417 void Run(PipelineData* data, Zone* temp_zone) { |
417 SourcePositionTable::Scope pos(data->source_positions(), | 418 SourcePositionTable::Scope pos(data->source_positions(), |
418 SourcePosition::Unknown()); | 419 SourcePosition::Unknown()); |
419 ValueNumberingReducer vn_reducer(temp_zone); | 420 ValueNumberingReducer vn_reducer(temp_zone); |
420 LoadElimination load_elimination; | 421 LoadElimination load_elimination; |
421 JSBuiltinReducer builtin_reducer(data->jsgraph()); | 422 JSBuiltinReducer builtin_reducer(data->jsgraph()); |
422 JSTypedLowering typed_lowering(data->jsgraph(), temp_zone); | 423 JSTypedLowering typed_lowering(data->jsgraph(), temp_zone); |
423 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); | 424 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); |
| 425 CommonOperatorReducer common_reducer; |
424 GraphReducer graph_reducer(data->graph(), temp_zone); | 426 GraphReducer graph_reducer(data->graph(), temp_zone); |
425 graph_reducer.AddReducer(&vn_reducer); | 427 graph_reducer.AddReducer(&vn_reducer); |
426 graph_reducer.AddReducer(&builtin_reducer); | 428 graph_reducer.AddReducer(&builtin_reducer); |
427 graph_reducer.AddReducer(&typed_lowering); | 429 graph_reducer.AddReducer(&typed_lowering); |
428 graph_reducer.AddReducer(&load_elimination); | 430 graph_reducer.AddReducer(&load_elimination); |
429 graph_reducer.AddReducer(&simple_reducer); | 431 graph_reducer.AddReducer(&simple_reducer); |
| 432 graph_reducer.AddReducer(&common_reducer); |
430 graph_reducer.ReduceGraph(); | 433 graph_reducer.ReduceGraph(); |
431 } | 434 } |
432 }; | 435 }; |
433 | 436 |
434 | 437 |
435 struct SimplifiedLoweringPhase { | 438 struct SimplifiedLoweringPhase { |
436 static const char* phase_name() { return "simplified lowering"; } | 439 static const char* phase_name() { return "simplified lowering"; } |
437 | 440 |
438 void Run(PipelineData* data, Zone* temp_zone) { | 441 void Run(PipelineData* data, Zone* temp_zone) { |
439 SourcePositionTable::Scope pos(data->source_positions(), | 442 SourcePositionTable::Scope pos(data->source_positions(), |
440 SourcePosition::Unknown()); | 443 SourcePosition::Unknown()); |
441 SimplifiedLowering lowering(data->jsgraph()); | 444 SimplifiedLowering lowering(data->jsgraph()); |
442 lowering.LowerAllNodes(); | 445 lowering.LowerAllNodes(); |
443 ValueNumberingReducer vn_reducer(temp_zone); | 446 ValueNumberingReducer vn_reducer(temp_zone); |
444 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); | 447 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); |
445 MachineOperatorReducer machine_reducer(data->jsgraph()); | 448 MachineOperatorReducer machine_reducer(data->jsgraph()); |
| 449 CommonOperatorReducer common_reducer; |
446 GraphReducer graph_reducer(data->graph(), temp_zone); | 450 GraphReducer graph_reducer(data->graph(), temp_zone); |
447 graph_reducer.AddReducer(&vn_reducer); | 451 graph_reducer.AddReducer(&vn_reducer); |
448 graph_reducer.AddReducer(&simple_reducer); | 452 graph_reducer.AddReducer(&simple_reducer); |
449 graph_reducer.AddReducer(&machine_reducer); | 453 graph_reducer.AddReducer(&machine_reducer); |
| 454 graph_reducer.AddReducer(&common_reducer); |
450 graph_reducer.ReduceGraph(); | 455 graph_reducer.ReduceGraph(); |
451 } | 456 } |
452 }; | 457 }; |
453 | 458 |
454 | 459 |
455 struct ChangeLoweringPhase { | 460 struct ChangeLoweringPhase { |
456 static const char* phase_name() { return "change lowering"; } | 461 static const char* phase_name() { return "change lowering"; } |
457 | 462 |
458 void Run(PipelineData* data, Zone* temp_zone) { | 463 void Run(PipelineData* data, Zone* temp_zone) { |
459 SourcePositionTable::Scope pos(data->source_positions(), | 464 SourcePositionTable::Scope pos(data->source_positions(), |
460 SourcePosition::Unknown()); | 465 SourcePosition::Unknown()); |
461 Linkage linkage(data->graph_zone(), data->info()); | 466 Linkage linkage(data->graph_zone(), data->info()); |
462 ValueNumberingReducer vn_reducer(temp_zone); | 467 ValueNumberingReducer vn_reducer(temp_zone); |
463 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); | 468 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); |
464 ChangeLowering lowering(data->jsgraph(), &linkage); | 469 ChangeLowering lowering(data->jsgraph(), &linkage); |
465 MachineOperatorReducer machine_reducer(data->jsgraph()); | 470 MachineOperatorReducer machine_reducer(data->jsgraph()); |
| 471 CommonOperatorReducer common_reducer; |
466 GraphReducer graph_reducer(data->graph(), temp_zone); | 472 GraphReducer graph_reducer(data->graph(), temp_zone); |
467 graph_reducer.AddReducer(&vn_reducer); | 473 graph_reducer.AddReducer(&vn_reducer); |
468 graph_reducer.AddReducer(&simple_reducer); | 474 graph_reducer.AddReducer(&simple_reducer); |
469 graph_reducer.AddReducer(&lowering); | 475 graph_reducer.AddReducer(&lowering); |
470 graph_reducer.AddReducer(&machine_reducer); | 476 graph_reducer.AddReducer(&machine_reducer); |
| 477 graph_reducer.AddReducer(&common_reducer); |
471 graph_reducer.ReduceGraph(); | 478 graph_reducer.ReduceGraph(); |
472 } | 479 } |
473 }; | 480 }; |
474 | 481 |
475 | 482 |
476 struct ControlReductionPhase { | 483 struct ControlReductionPhase { |
477 void Run(PipelineData* data, Zone* temp_zone) { | 484 void Run(PipelineData* data, Zone* temp_zone) { |
478 SourcePositionTable::Scope pos(data->source_positions(), | 485 SourcePositionTable::Scope pos(data->source_positions(), |
479 SourcePosition::Unknown()); | 486 SourcePosition::Unknown()); |
480 ControlReducer::ReduceGraph(temp_zone, data->jsgraph(), data->common()); | 487 ControlReducer::ReduceGraph(temp_zone, data->jsgraph(), data->common()); |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 } | 1085 } |
1079 | 1086 |
1080 | 1087 |
1081 void Pipeline::TearDown() { | 1088 void Pipeline::TearDown() { |
1082 InstructionOperand::TearDownCaches(); | 1089 InstructionOperand::TearDownCaches(); |
1083 } | 1090 } |
1084 | 1091 |
1085 } // namespace compiler | 1092 } // namespace compiler |
1086 } // namespace internal | 1093 } // namespace internal |
1087 } // namespace v8 | 1094 } // namespace v8 |
OLD | NEW |