Reviewers: jarin,

Description:
[turbofan] Remove unused constructor function matching from typer.

This optimization never triggers currently, and is inherently native
context dependent for no real reason (for example it will not properly
detect those constructors in the case of cross native context inlining),
plus it is slow and awkward.  In case we really need this functionality
at some point, we should find a way to make it work with the builtin
function id mechanism that is already in place to match other builtins.

[email protected]

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

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

Affected files (+12, -45 lines):
  M src/compiler/pipeline.cc
  M src/compiler/typer.h
  M src/compiler/typer.cc
  M test/cctest/compiler/test-changes-lowering.cc
  M test/cctest/compiler/test-js-constant-cache.cc
  M test/cctest/compiler/test-js-typed-lowering.cc
  M test/cctest/compiler/test-machine-operator-reducer.cc
  M test/cctest/compiler/test-simplified-lowering.cc
  M test/unittests/compiler/graph-unittest.cc


Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index 0d1619a80087f15d9a72f5f8ed2433fd00ac75eb..6f85651a2e93e8882b178d03a2e865d965870b2d 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -1055,8 +1055,7 @@ Handle<Code> Pipeline::GenerateCode() {
   SmartPointer<Typer> typer;
   if (info()->is_typing_enabled()) {
     // Type the graph.
-    typer.Reset(new Typer(isolate(), data.graph(), info()->function_type(),
-                          info()->context()));
+ typer.Reset(new Typer(isolate(), data.graph(), info()->function_type()));
     Run<TyperPhase>(typer.get());
     RunPrintAndVerify("Typed");
   }
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index 5d8b423290b05887fd62943af4831ae29a17416a..2a802c5be44dd7c6715b044ee1e541d70d5589f4 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -65,12 +65,9 @@ class TyperCache final {
                                          Type::Integral32(), zone());
   Type* const kClz32Func =
       Type::Function(CreateRange(0, 32), Type::Number(), zone());
-  Type* const kArrayBufferFunc =
-      Type::Function(Type::Object(zone()), Type::Unsigned32(), zone());

 #define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \
-  Type* const k##TypeName##Array = CreateArray(k##TypeName);     \
- Type* const k##TypeName##ArrayFunc = CreateArrayFunction(k##TypeName##Array);
+  Type* const k##TypeName##Array = CreateArray(k##TypeName);
   TYPED_ARRAYS(TYPED_ARRAY)
 #undef TYPED_ARRAY

@@ -119,12 +116,10 @@ class Typer::Decorator final : public GraphDecorator {
 };


-Typer::Typer(Isolate* isolate, Graph* graph, Type::FunctionType* function_type,
-             MaybeHandle<Context> context)
+Typer::Typer(Isolate* isolate, Graph* graph, Type::FunctionType* function_type)
     : isolate_(isolate),
       graph_(graph),
       function_type_(function_type),
-      context_(context),
       decorator_(nullptr),
       cache_(kCache.Get()) {
   Zone* zone = this->zone();
@@ -261,7 +256,6 @@ class Typer::Visitor : public Reducer {

  private:
   Typer* typer_;
-  MaybeHandle<Context> context_;
   ZoneSet<NodeId> weakened_nodes_;

 #define DECLARE_METHOD(x) inline Bounds Type##x(Node* node);
@@ -286,7 +280,6 @@ class Typer::Visitor : public Reducer {
   Zone* zone() { return typer_->zone(); }
   Isolate* isolate() { return typer_->isolate(); }
   Graph* graph() { return typer_->graph(); }
-  MaybeHandle<Context> context() { return typer_->context(); }

   void SetWeakened(NodeId node_id) { weakened_nodes_.insert(node_id); }
   bool IsWeakened(NodeId node_id) {
@@ -2337,28 +2330,6 @@ Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
         default:
           break;
       }
- } else if (JSFunction::cast(*value)->IsBuiltin() && !context().is_null()) {
-      Handle<Context> native =
-          handle(context().ToHandleChecked()->native_context(), isolate());
-      if (*value == native->array_buffer_fun()) {
-        return typer_->cache_.kArrayBufferFunc;
-      } else if (*value == native->int8_array_fun()) {
-        return typer_->cache_.kInt8ArrayFunc;
-      } else if (*value == native->int16_array_fun()) {
-        return typer_->cache_.kInt16ArrayFunc;
-      } else if (*value == native->int32_array_fun()) {
-        return typer_->cache_.kInt32ArrayFunc;
-      } else if (*value == native->uint8_array_fun()) {
-        return typer_->cache_.kUint8ArrayFunc;
-      } else if (*value == native->uint16_array_fun()) {
-        return typer_->cache_.kUint16ArrayFunc;
-      } else if (*value == native->uint32_array_fun()) {
-        return typer_->cache_.kUint32ArrayFunc;
-      } else if (*value == native->float32_array_fun()) {
-        return typer_->cache_.kFloat32ArrayFunc;
-      } else if (*value == native->float64_array_fun()) {
-        return typer_->cache_.kFloat64ArrayFunc;
-      }
     }
     int const arity =
JSFunction::cast(*value)->shared()->internal_formal_parameter_count();
Index: src/compiler/typer.h
diff --git a/src/compiler/typer.h b/src/compiler/typer.h
index 5c59b5610bf8ab2bcb795873942067a2c6a659ed..f5ef4f15535821c5ab5a43a323b35050651e78cc 100644
--- a/src/compiler/typer.h
+++ b/src/compiler/typer.h
@@ -18,8 +18,8 @@ class TyperCache;

 class Typer {
  public:
-  Typer(Isolate* isolate, Graph* graph, Type::FunctionType* function_type,
-        MaybeHandle<Context> context);
+  Typer(Isolate* isolate, Graph* graph,
+        Type::FunctionType* function_type = nullptr);
   ~Typer();

   void Run();
@@ -31,7 +31,6 @@ class Typer {
   class Decorator;

   Graph* graph() const { return graph_; }
-  MaybeHandle<Context> context() const { return context_; }
   Zone* zone() const { return graph()->zone(); }
   Isolate* isolate() const { return isolate_; }
   Type::FunctionType* function_type() const { return function_type_; }
@@ -39,7 +38,6 @@ class Typer {
   Isolate* const isolate_;
   Graph* const graph_;
   Type::FunctionType* function_type_;
-  MaybeHandle<Context> const context_;
   Decorator* decorator_;
   TyperCache const& cache_;

Index: test/cctest/compiler/test-changes-lowering.cc
diff --git a/test/cctest/compiler/test-changes-lowering.cc b/test/cctest/compiler/test-changes-lowering.cc index 1483f86f9574ec580f98dc131b8ea0fc500830b3..04b5b9176b6c4e9677ec6822edc34f2ee2b7e2b0 100644
--- a/test/cctest/compiler/test-changes-lowering.cc
+++ b/test/cctest/compiler/test-changes-lowering.cc
@@ -126,7 +126,7 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {

   void LowerChange(Node* change) {
     // Run the graph reducer with changes lowering on a single node.
- Typer typer(this->isolate(), this->graph(), nullptr, Handle<Context>());
+    Typer typer(this->isolate(), this->graph());
     typer.Run();
     ChangeLowering change_lowering(&jsgraph);
     SelectLowering select_lowering(this->graph(), this->common());
Index: test/cctest/compiler/test-js-constant-cache.cc
diff --git a/test/cctest/compiler/test-js-constant-cache.cc b/test/cctest/compiler/test-js-constant-cache.cc index a269b5697a686b31d4ba2e36226b6c81bb5956a3..8774a9a9e36c3b740bcd970ec101c7c1382486a8 100644
--- a/test/cctest/compiler/test-js-constant-cache.cc
+++ b/test/cctest/compiler/test-js-constant-cache.cc
@@ -21,7 +21,7 @@ class JSCacheTesterHelper {
       : main_graph_(zone),
         main_common_(zone),
         main_javascript_(zone),
- main_typer_(isolate, &main_graph_, nullptr, MaybeHandle<Context>()),
+        main_typer_(isolate, &main_graph_),
         main_machine_(zone) {}
   Graph main_graph_;
   CommonOperatorBuilder main_common_;
Index: test/cctest/compiler/test-js-typed-lowering.cc
diff --git a/test/cctest/compiler/test-js-typed-lowering.cc b/test/cctest/compiler/test-js-typed-lowering.cc index 47ae71d232d6990126ba70b0e3f838d058aae5b5..e2f94bc0dc26698fc156acece634f752da0dfef3 100644
--- a/test/cctest/compiler/test-js-typed-lowering.cc
+++ b/test/cctest/compiler/test-js-typed-lowering.cc
@@ -38,7 +38,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
         simplified(main_zone()),
         common(main_zone()),
         graph(main_zone()),
-        typer(main_isolate(), &graph, nullptr, MaybeHandle<Context>()),
+        typer(main_isolate(), &graph),
         context_node(NULL) {
     graph.SetStart(graph.NewNode(common.Start(num_parameters)));
     graph.SetEnd(graph.NewNode(common.End(1)));
Index: test/cctest/compiler/test-machine-operator-reducer.cc
diff --git a/test/cctest/compiler/test-machine-operator-reducer.cc b/test/cctest/compiler/test-machine-operator-reducer.cc index d3ab454d6f6d3117c20a9e46b7fbc16751d0b440..299f0c02abf52d421d09f5c1701d3a473ffa2652 100644
--- a/test/cctest/compiler/test-machine-operator-reducer.cc
+++ b/test/cctest/compiler/test-machine-operator-reducer.cc
@@ -60,7 +60,7 @@ class ReducerTester : public HandleAndZoneScope {
         common(main_zone()),
         graph(main_zone()),
         javascript(main_zone()),
-        typer(isolate, &graph, nullptr, MaybeHandle<Context>()),
+        typer(isolate, &graph),
         jsgraph(isolate, &graph, &common, &javascript, &machine),
         maxuint32(Constant<int32_t>(kMaxUInt32)) {
     Node* s = graph.NewNode(common.Start(num_parameters));
Index: test/cctest/compiler/test-simplified-lowering.cc
diff --git a/test/cctest/compiler/test-simplified-lowering.cc b/test/cctest/compiler/test-simplified-lowering.cc index d5160a0068f687ed60dd9dc067b34fd0aed7ee6a..022e01690ba815d960590c66fc540c8950fbd966 100644
--- a/test/cctest/compiler/test-simplified-lowering.cc
+++ b/test/cctest/compiler/test-simplified-lowering.cc
@@ -35,7 +35,7 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> {
   SimplifiedLoweringTester(MachineType p0 = kMachNone,
                            MachineType p1 = kMachNone)
       : GraphBuilderTester<ReturnType>(p0, p1),
- typer(this->isolate(), this->graph(), nullptr, MaybeHandle<Context>()),
+        typer(this->isolate(), this->graph()),
         javascript(this->zone()),
jsgraph(this->isolate(), this->graph(), this->common(), &javascript,
                 this->machine()),
@@ -710,7 +710,7 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
   explicit TestingGraph(Type* p0_type, Type* p1_type = Type::None(),
                         Type* p2_type = Type::None())
       : GraphAndBuilders(main_zone()),
-        typer(main_isolate(), graph(), nullptr, MaybeHandle<Context>()),
+        typer(main_isolate(), graph()),
         javascript(main_zone()),
jsgraph(main_isolate(), graph(), common(), &javascript, machine()) {
     start = graph()->NewNode(common()->Start(2));
Index: test/unittests/compiler/graph-unittest.cc
diff --git a/test/unittests/compiler/graph-unittest.cc b/test/unittests/compiler/graph-unittest.cc index 0fae3a9541c7cb260ae7b76115d04d9ed58fd759..6b8546b95a4380bd5b49462aa2a7e845ff141cf4 100644
--- a/test/unittests/compiler/graph-unittest.cc
+++ b/test/unittests/compiler/graph-unittest.cc
@@ -110,8 +110,7 @@ Matcher<Node*> GraphTest::IsUndefinedConstant() {


 TypedGraphTest::TypedGraphTest(int num_parameters)
-    : GraphTest(num_parameters),
-      typer_(isolate(), graph(), nullptr, MaybeHandle<Context>()) {}
+    : GraphTest(num_parameters), typer_(isolate(), graph()) {}


 TypedGraphTest::~TypedGraphTest() {}


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