Reviewers: Benedikt Meurer,

Description:
[turbofan] JSTypeFeedbackSpecializer is now an AdvancedReducer.

[email protected]
BUG=

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

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

Affected files (+15, -12 lines):
  M src/compiler/js-type-feedback.h
  M src/compiler/js-type-feedback.cc
  M src/compiler/pipeline.cc
  M test/unittests/compiler/js-type-feedback-unittest.cc


Index: src/compiler/js-type-feedback.cc
diff --git a/src/compiler/js-type-feedback.cc b/src/compiler/js-type-feedback.cc index 02c9677bec05631d3c90d020218f036828ea4c2f..ca93473dd3208acf69dcc4240aefcab423d7ee50 100644
--- a/src/compiler/js-type-feedback.cc
+++ b/src/compiler/js-type-feedback.cc
@@ -199,7 +199,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) { Node* deopt = graph()->NewNode(common()->Deoptimize(), frame_state_before,
                                  effect, check_failed);
   NodeProperties::MergeControlToEnd(graph(), common(), deopt);
-  NodeProperties::ReplaceWithValue(node, load, load, check_success);
+  ReplaceWithValue(node, load, load, check_success);
   return Replace(load);
 }

@@ -214,7 +214,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamedForGlobalVariable(
   if (!constant_value.is_null()) {
     // Always optimize global constants.
     Node* constant = jsgraph()->Constant(constant_value);
-    NodeProperties::ReplaceWithValue(node, constant);
+    ReplaceWithValue(node, constant);
     return Replace(constant);
   }

@@ -250,7 +250,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamedForGlobalVariable(
               String::Flatten(Handle<String>::cast(constant_value));
         }
         Node* constant = jsgraph()->Constant(constant_value);
-        NodeProperties::ReplaceWithValue(node, constant);
+        ReplaceWithValue(node, constant);
         return Replace(constant);
       } else {
         // Load directly from the property cell.
@@ -259,7 +259,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamedForGlobalVariable(
         Node* load_field = graph()->NewNode(
             simplified()->LoadField(access), jsgraph()->Constant(cell),
             NodeProperties::GetEffectInput(node), control);
- NodeProperties::ReplaceWithValue(node, load_field, load_field, control);
+        ReplaceWithValue(node, load_field, load_field, control);
         return Replace(load_field);
       }
     }
@@ -315,7 +315,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSStoreNamed(Node* node) { Node* deopt = graph()->NewNode(common()->Deoptimize(), frame_state_before,
                                  effect, check_failed);
   NodeProperties::MergeControlToEnd(graph(), common(), deopt);
-  NodeProperties::ReplaceWithValue(node, store, store, check_success);
+  ReplaceWithValue(node, store, store, check_success);
   return Replace(store);
 }

Index: src/compiler/js-type-feedback.h
diff --git a/src/compiler/js-type-feedback.h b/src/compiler/js-type-feedback.h index 3d557950a5ac0ce6702a36165fb344ff220215cb..4f1f045d6d3397daf01ae82a9e5158133464400d 100644
--- a/src/compiler/js-type-feedback.h
+++ b/src/compiler/js-type-feedback.h
@@ -47,14 +47,15 @@ class JSTypeFeedbackTable : public ZoneObject {

 // Specializes a graph to the type feedback recorded in the
 // {js_type_feedback} provided to the constructor.
-class JSTypeFeedbackSpecializer : public Reducer {
+class JSTypeFeedbackSpecializer : public AdvancedReducer {
  public:
-  JSTypeFeedbackSpecializer(JSGraph* jsgraph,
+  JSTypeFeedbackSpecializer(Editor* editor, JSGraph* jsgraph,
                             JSTypeFeedbackTable* js_type_feedback,
                             TypeFeedbackOracle* oracle,
                             Handle<GlobalObject> global_object,
                             CompilationDependencies* dependencies)
-      : jsgraph_(jsgraph),
+      : AdvancedReducer(editor),
+        jsgraph_(jsgraph),
         simplified_(jsgraph->graph()->zone()),
         js_type_feedback_(js_type_feedback),
         oracle_(oracle),
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index 776001885cab00b815a729895bf6284c3dd8b52e..b22a74ba2665557204317998b6e726ee3b3f1e23 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -553,8 +553,8 @@ struct JSTypeFeedbackPhase {
     // TODO(titzer): introduce a specialization mode/flags enum to control
     // specializing to the global object here.
     JSTypeFeedbackSpecializer specializer(
-        data->jsgraph(), data->js_type_feedback(), &oracle, global_object,
-        data->info()->dependencies());
+        &graph_reducer, data->jsgraph(), data->js_type_feedback(), &oracle,
+        global_object, data->info()->dependencies());
     AddReducer(data, &graph_reducer, &specializer);
     graph_reducer.ReduceGraph();
   }
Index: test/unittests/compiler/js-type-feedback-unittest.cc
diff --git a/test/unittests/compiler/js-type-feedback-unittest.cc b/test/unittests/compiler/js-type-feedback-unittest.cc index 08fe68a8baa037141046ab748394342c131c1540..fc83646b2e1af18f4de1090ada8db0f01df44e4a 100644
--- a/test/unittests/compiler/js-type-feedback-unittest.cc
+++ b/test/unittests/compiler/js-type-feedback-unittest.cc
@@ -41,8 +41,10 @@ class JSTypeFeedbackTest : public TypedGraphTest {
     MachineOperatorBuilder machine(zone());
     JSGraph jsgraph(isolate(), graph(), common(), javascript(), &machine);
     JSTypeFeedbackTable table(zone());
- JSTypeFeedbackSpecializer reducer(&jsgraph, &table, nullptr, global_object,
-                                      &dependencies_);
+    // TODO(titzer): mock the GraphReducer here for better unit testing.
+    GraphReducer graph_reducer(graph(), zone());
+ JSTypeFeedbackSpecializer reducer(&graph_reducer, &jsgraph, &table, nullptr,
+                                      global_object, &dependencies_);
     return reducer.Reduce(node);
   }



--
--
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