Reviewers: jarin,

Description:
[turbofan] Run context specialization, inlining and initial DCE in one pass.

This is another missing piece in the puzzle towards general inlining.
The fact that we can combine this with context specialization is a nice
bonus, and not necessarily a requirement.

[email protected]

Please review this at https://codereview.chromium.org/1198193002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+12, -35 lines):
  M src/compiler/pipeline.cc


Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index 3e46d6f5194bd6abc0356231c627d67d0d97691e..34b1438fefb63b40ef20d26ee42d05c465448792 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -486,27 +486,25 @@ struct GraphBuilderPhase {
 };


-struct ContextSpecializerPhase {
-  static const char* phase_name() { return "context specializing"; }
-
-  void Run(PipelineData* data, Zone* temp_zone) {
-    JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
-    JSContextSpecializer spec(&graph_reducer, data->jsgraph());
-    AddReducer(data, &graph_reducer, &spec);
-    graph_reducer.ReduceGraph();
-  }
-};
-
-
 struct InliningPhase {
   static const char* phase_name() { return "inlining"; }

   void Run(PipelineData* data, Zone* temp_zone) {
     JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
+ DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
+                                              data->common());
+    CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
+                                         data->common(), data->machine());
+ JSContextSpecializer context_specializer(&graph_reducer, data->jsgraph());
     JSInliner inliner(&graph_reducer, data->info()->is_inlining_enabled()
                                           ? JSInliner::kGeneralInlining
                                           : JSInliner::kRestrictedInlining,
                       temp_zone, data->info(), data->jsgraph());
+    AddReducer(data, &graph_reducer, &dead_code_elimination);
+    AddReducer(data, &graph_reducer, &common_reducer);
+    if (data->info()->is_context_specializing()) {
+      AddReducer(data, &graph_reducer, &context_specializer);
+    }
     AddReducer(data, &graph_reducer, &inliner);
     graph_reducer.ReduceGraph();
   }
@@ -637,20 +635,6 @@ struct ChangeLoweringPhase {
 };


-struct EarlyControlReductionPhase {
-  static const char* phase_name() { return "early control reduction"; }
-  void Run(PipelineData* data, Zone* temp_zone) {
-    GraphReducer graph_reducer(temp_zone, data->graph());
-    DeadCodeElimination dce(&graph_reducer, data->graph(), data->common());
- CommonOperatorReducer common(&graph_reducer, data->graph(), data->common(),
-                                 data->machine());
-    graph_reducer.AddReducer(&dce);
-    graph_reducer.AddReducer(&common);
-    graph_reducer.ReduceGraph();
-  }
-};
-
-
 struct LateControlReductionPhase {
   static const char* phase_name() { return "late control reduction"; }
   void Run(PipelineData* data, Zone* temp_zone) {
@@ -1046,18 +1030,11 @@ Handle<Code> Pipeline::GenerateCode() {
   if (data.compilation_failed()) return Handle<Code>::null();
   RunPrintAndVerify("Initial untyped", true);

-  Run<EarlyControlReductionPhase>();
-  RunPrintAndVerify("Early Control reduced", true);
-
-  if (info()->is_context_specializing()) {
-    // Specialize the code to the context as aggressively as possible.
-    Run<ContextSpecializerPhase>();
-    RunPrintAndVerify("Context specialized", true);
-  }
-
+  // Perform context specialization and inlining (if enabled).
   Run<InliningPhase>();
   RunPrintAndVerify("Inlined", true);

+  // Remove dead->live edges from the graph.
   Run<EarlyGraphTrimmingPhase>();
   RunPrintAndVerify("Early trimmed", true);



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to