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

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

Issue 1198193002: [turbofan] Run context specialization, inlining and initial DCE in one pass. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 temp_zone, data->info(), data->jsgraph(), data->loop_assignment(), 479 temp_zone, data->info(), data->jsgraph(), data->loop_assignment(),
480 data->js_type_feedback(), data->source_positions()); 480 data->js_type_feedback(), data->source_positions());
481 bool stack_check = !data->info()->IsStub(); 481 bool stack_check = !data->info()->IsStub();
482 if (!graph_builder.CreateGraph(constant_context, stack_check)) { 482 if (!graph_builder.CreateGraph(constant_context, stack_check)) {
483 data->set_compilation_failed(); 483 data->set_compilation_failed();
484 } 484 }
485 } 485 }
486 }; 486 };
487 487
488 488
489 struct ContextSpecializerPhase {
490 static const char* phase_name() { return "context specializing"; }
491
492 void Run(PipelineData* data, Zone* temp_zone) {
493 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
494 JSContextSpecializer spec(&graph_reducer, data->jsgraph());
495 AddReducer(data, &graph_reducer, &spec);
496 graph_reducer.ReduceGraph();
497 }
498 };
499
500
501 struct InliningPhase { 489 struct InliningPhase {
502 static const char* phase_name() { return "inlining"; } 490 static const char* phase_name() { return "inlining"; }
503 491
504 void Run(PipelineData* data, Zone* temp_zone) { 492 void Run(PipelineData* data, Zone* temp_zone) {
505 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 493 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
494 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
495 data->common());
496 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
497 data->common(), data->machine());
498 JSContextSpecializer context_specializer(&graph_reducer, data->jsgraph());
506 JSInliner inliner(&graph_reducer, data->info()->is_inlining_enabled() 499 JSInliner inliner(&graph_reducer, data->info()->is_inlining_enabled()
507 ? JSInliner::kGeneralInlining 500 ? JSInliner::kGeneralInlining
508 : JSInliner::kRestrictedInlining, 501 : JSInliner::kRestrictedInlining,
509 temp_zone, data->info(), data->jsgraph()); 502 temp_zone, data->info(), data->jsgraph());
503 AddReducer(data, &graph_reducer, &dead_code_elimination);
504 AddReducer(data, &graph_reducer, &common_reducer);
505 if (data->info()->is_context_specializing()) {
506 AddReducer(data, &graph_reducer, &context_specializer);
507 }
510 AddReducer(data, &graph_reducer, &inliner); 508 AddReducer(data, &graph_reducer, &inliner);
511 graph_reducer.ReduceGraph(); 509 graph_reducer.ReduceGraph();
512 } 510 }
513 }; 511 };
514 512
515 513
516 struct TyperPhase { 514 struct TyperPhase {
517 static const char* phase_name() { return "typer"; } 515 static const char* phase_name() { return "typer"; }
518 516
519 void Run(PipelineData* data, Zone* temp_zone, Typer* typer) { 517 void Run(PipelineData* data, Zone* temp_zone, Typer* typer) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 data->common(), data->machine()); 628 data->common(), data->machine());
631 AddReducer(data, &graph_reducer, &vn_reducer); 629 AddReducer(data, &graph_reducer, &vn_reducer);
632 AddReducer(data, &graph_reducer, &lowering); 630 AddReducer(data, &graph_reducer, &lowering);
633 AddReducer(data, &graph_reducer, &machine_reducer); 631 AddReducer(data, &graph_reducer, &machine_reducer);
634 AddReducer(data, &graph_reducer, &common_reducer); 632 AddReducer(data, &graph_reducer, &common_reducer);
635 graph_reducer.ReduceGraph(); 633 graph_reducer.ReduceGraph();
636 } 634 }
637 }; 635 };
638 636
639 637
640 struct EarlyControlReductionPhase { 638 struct LateControlReductionPhase {
641 static const char* phase_name() { return "early control reduction"; } 639 static const char* phase_name() { return "late control reduction"; }
642 void Run(PipelineData* data, Zone* temp_zone) { 640 void Run(PipelineData* data, Zone* temp_zone) {
643 GraphReducer graph_reducer(temp_zone, data->graph()); 641 GraphReducer graph_reducer(temp_zone, data->graph());
644 DeadCodeElimination dce(&graph_reducer, data->graph(), data->common()); 642 DeadCodeElimination dce(&graph_reducer, data->graph(), data->common());
645 CommonOperatorReducer common(&graph_reducer, data->graph(), data->common(), 643 CommonOperatorReducer common(&graph_reducer, data->graph(), data->common(),
646 data->machine()); 644 data->machine());
647 graph_reducer.AddReducer(&dce); 645 graph_reducer.AddReducer(&dce);
648 graph_reducer.AddReducer(&common); 646 graph_reducer.AddReducer(&common);
649 graph_reducer.ReduceGraph(); 647 graph_reducer.ReduceGraph();
650 } 648 }
651 }; 649 };
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 data.source_positions()->AddDecorator(); 1030 data.source_positions()->AddDecorator();
1033 1031
1034 if (FLAG_loop_assignment_analysis) { 1032 if (FLAG_loop_assignment_analysis) {
1035 Run<LoopAssignmentAnalysisPhase>(); 1033 Run<LoopAssignmentAnalysisPhase>();
1036 } 1034 }
1037 1035
1038 Run<GraphBuilderPhase>(info()->is_context_specializing()); 1036 Run<GraphBuilderPhase>(info()->is_context_specializing());
1039 if (data.compilation_failed()) return Handle<Code>::null(); 1037 if (data.compilation_failed()) return Handle<Code>::null();
1040 RunPrintAndVerify("Initial untyped", true); 1038 RunPrintAndVerify("Initial untyped", true);
1041 1039
1042 Run<EarlyControlReductionPhase>(); 1040 // Perform context specialization and inlining (if enabled).
1043 RunPrintAndVerify("Early Control reduced", true);
1044
1045 if (info()->is_context_specializing()) {
1046 // Specialize the code to the context as aggressively as possible.
1047 Run<ContextSpecializerPhase>();
1048 RunPrintAndVerify("Context specialized", true);
1049 }
1050
1051 Run<InliningPhase>(); 1041 Run<InliningPhase>();
1052 RunPrintAndVerify("Inlined", true); 1042 RunPrintAndVerify("Inlined", true);
1053 1043
1044 // Remove dead->live edges from the graph.
1054 Run<EarlyGraphTrimmingPhase>(); 1045 Run<EarlyGraphTrimmingPhase>();
1055 RunPrintAndVerify("Early trimmed", true); 1046 RunPrintAndVerify("Early trimmed", true);
1056 1047
1057 if (FLAG_print_turbo_replay) { 1048 if (FLAG_print_turbo_replay) {
1058 // Print a replay of the initial graph. 1049 // Print a replay of the initial graph.
1059 GraphReplayPrinter::PrintReplay(data.graph()); 1050 GraphReplayPrinter::PrintReplay(data.graph());
1060 } 1051 }
1061 1052
1062 // Bailout here in case target architecture is not supported. 1053 // Bailout here in case target architecture is not supported.
1063 if (!SupportedTarget()) return Handle<Code>::null(); 1054 if (!SupportedTarget()) return Handle<Code>::null();
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 tcf << AsC1VRegisterAllocationData("CodeGen", 1357 tcf << AsC1VRegisterAllocationData("CodeGen",
1367 data->register_allocation_data()); 1358 data->register_allocation_data());
1368 } 1359 }
1369 1360
1370 data->DeleteRegisterAllocationZone(); 1361 data->DeleteRegisterAllocationZone();
1371 } 1362 }
1372 1363
1373 } // namespace compiler 1364 } // namespace compiler
1374 } // namespace internal 1365 } // namespace internal
1375 } // namespace v8 1366 } // 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