Commit 722e2e2b authored by bmeurer's avatar bmeurer Committed by Commit bot

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

R=jarin@chromium.org,rossberg@chromium.org

Review URL: https://codereview.chromium.org/1221683006

Cr-Commit-Position: refs/heads/master@{#29365}
parent c74383aa
...@@ -1055,8 +1055,7 @@ Handle<Code> Pipeline::GenerateCode() { ...@@ -1055,8 +1055,7 @@ Handle<Code> Pipeline::GenerateCode() {
SmartPointer<Typer> typer; SmartPointer<Typer> typer;
if (info()->is_typing_enabled()) { if (info()->is_typing_enabled()) {
// Type the graph. // Type the graph.
typer.Reset(new Typer(isolate(), data.graph(), info()->function_type(), typer.Reset(new Typer(isolate(), data.graph(), info()->function_type()));
info()->context()));
Run<TyperPhase>(typer.get()); Run<TyperPhase>(typer.get());
RunPrintAndVerify("Typed"); RunPrintAndVerify("Typed");
} }
......
...@@ -65,12 +65,9 @@ class TyperCache final { ...@@ -65,12 +65,9 @@ class TyperCache final {
Type::Integral32(), zone()); Type::Integral32(), zone());
Type* const kClz32Func = Type* const kClz32Func =
Type::Function(CreateRange(0, 32), Type::Number(), zone()); 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) \ #define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \
Type* const k##TypeName##Array = CreateArray(k##TypeName); \ Type* const k##TypeName##Array = CreateArray(k##TypeName);
Type* const k##TypeName##ArrayFunc = CreateArrayFunction(k##TypeName##Array);
TYPED_ARRAYS(TYPED_ARRAY) TYPED_ARRAYS(TYPED_ARRAY)
#undef TYPED_ARRAY #undef TYPED_ARRAY
...@@ -119,12 +116,10 @@ class Typer::Decorator final : public GraphDecorator { ...@@ -119,12 +116,10 @@ class Typer::Decorator final : public GraphDecorator {
}; };
Typer::Typer(Isolate* isolate, Graph* graph, Type::FunctionType* function_type, Typer::Typer(Isolate* isolate, Graph* graph, Type::FunctionType* function_type)
MaybeHandle<Context> context)
: isolate_(isolate), : isolate_(isolate),
graph_(graph), graph_(graph),
function_type_(function_type), function_type_(function_type),
context_(context),
decorator_(nullptr), decorator_(nullptr),
cache_(kCache.Get()) { cache_(kCache.Get()) {
Zone* zone = this->zone(); Zone* zone = this->zone();
...@@ -261,7 +256,6 @@ class Typer::Visitor : public Reducer { ...@@ -261,7 +256,6 @@ class Typer::Visitor : public Reducer {
private: private:
Typer* typer_; Typer* typer_;
MaybeHandle<Context> context_;
ZoneSet<NodeId> weakened_nodes_; ZoneSet<NodeId> weakened_nodes_;
#define DECLARE_METHOD(x) inline Bounds Type##x(Node* node); #define DECLARE_METHOD(x) inline Bounds Type##x(Node* node);
...@@ -286,7 +280,6 @@ class Typer::Visitor : public Reducer { ...@@ -286,7 +280,6 @@ class Typer::Visitor : public Reducer {
Zone* zone() { return typer_->zone(); } Zone* zone() { return typer_->zone(); }
Isolate* isolate() { return typer_->isolate(); } Isolate* isolate() { return typer_->isolate(); }
Graph* graph() { return typer_->graph(); } Graph* graph() { return typer_->graph(); }
MaybeHandle<Context> context() { return typer_->context(); }
void SetWeakened(NodeId node_id) { weakened_nodes_.insert(node_id); } void SetWeakened(NodeId node_id) { weakened_nodes_.insert(node_id); }
bool IsWeakened(NodeId node_id) { bool IsWeakened(NodeId node_id) {
...@@ -2337,28 +2330,6 @@ Type* Typer::Visitor::TypeConstant(Handle<Object> value) { ...@@ -2337,28 +2330,6 @@ Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
default: default:
break; 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 = int const arity =
JSFunction::cast(*value)->shared()->internal_formal_parameter_count(); JSFunction::cast(*value)->shared()->internal_formal_parameter_count();
......
...@@ -18,8 +18,8 @@ class TyperCache; ...@@ -18,8 +18,8 @@ class TyperCache;
class Typer { class Typer {
public: public:
Typer(Isolate* isolate, Graph* graph, Type::FunctionType* function_type, Typer(Isolate* isolate, Graph* graph,
MaybeHandle<Context> context); Type::FunctionType* function_type = nullptr);
~Typer(); ~Typer();
void Run(); void Run();
...@@ -31,7 +31,6 @@ class Typer { ...@@ -31,7 +31,6 @@ class Typer {
class Decorator; class Decorator;
Graph* graph() const { return graph_; } Graph* graph() const { return graph_; }
MaybeHandle<Context> context() const { return context_; }
Zone* zone() const { return graph()->zone(); } Zone* zone() const { return graph()->zone(); }
Isolate* isolate() const { return isolate_; } Isolate* isolate() const { return isolate_; }
Type::FunctionType* function_type() const { return function_type_; } Type::FunctionType* function_type() const { return function_type_; }
...@@ -39,7 +38,6 @@ class Typer { ...@@ -39,7 +38,6 @@ class Typer {
Isolate* const isolate_; Isolate* const isolate_;
Graph* const graph_; Graph* const graph_;
Type::FunctionType* function_type_; Type::FunctionType* function_type_;
MaybeHandle<Context> const context_;
Decorator* decorator_; Decorator* decorator_;
TyperCache const& cache_; TyperCache const& cache_;
......
...@@ -126,7 +126,7 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> { ...@@ -126,7 +126,7 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
void LowerChange(Node* change) { void LowerChange(Node* change) {
// Run the graph reducer with changes lowering on a single node. // 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(); typer.Run();
ChangeLowering change_lowering(&jsgraph); ChangeLowering change_lowering(&jsgraph);
SelectLowering select_lowering(this->graph(), this->common()); SelectLowering select_lowering(this->graph(), this->common());
......
...@@ -21,7 +21,7 @@ class JSCacheTesterHelper { ...@@ -21,7 +21,7 @@ class JSCacheTesterHelper {
: main_graph_(zone), : main_graph_(zone),
main_common_(zone), main_common_(zone),
main_javascript_(zone), main_javascript_(zone),
main_typer_(isolate, &main_graph_, nullptr, MaybeHandle<Context>()), main_typer_(isolate, &main_graph_),
main_machine_(zone) {} main_machine_(zone) {}
Graph main_graph_; Graph main_graph_;
CommonOperatorBuilder main_common_; CommonOperatorBuilder main_common_;
......
...@@ -38,7 +38,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope { ...@@ -38,7 +38,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
simplified(main_zone()), simplified(main_zone()),
common(main_zone()), common(main_zone()),
graph(main_zone()), graph(main_zone()),
typer(main_isolate(), &graph, nullptr, MaybeHandle<Context>()), typer(main_isolate(), &graph),
context_node(NULL) { context_node(NULL) {
graph.SetStart(graph.NewNode(common.Start(num_parameters))); graph.SetStart(graph.NewNode(common.Start(num_parameters)));
graph.SetEnd(graph.NewNode(common.End(1))); graph.SetEnd(graph.NewNode(common.End(1)));
......
...@@ -60,7 +60,7 @@ class ReducerTester : public HandleAndZoneScope { ...@@ -60,7 +60,7 @@ class ReducerTester : public HandleAndZoneScope {
common(main_zone()), common(main_zone()),
graph(main_zone()), graph(main_zone()),
javascript(main_zone()), javascript(main_zone()),
typer(isolate, &graph, nullptr, MaybeHandle<Context>()), typer(isolate, &graph),
jsgraph(isolate, &graph, &common, &javascript, &machine), jsgraph(isolate, &graph, &common, &javascript, &machine),
maxuint32(Constant<int32_t>(kMaxUInt32)) { maxuint32(Constant<int32_t>(kMaxUInt32)) {
Node* s = graph.NewNode(common.Start(num_parameters)); Node* s = graph.NewNode(common.Start(num_parameters));
......
...@@ -35,7 +35,7 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> { ...@@ -35,7 +35,7 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> {
SimplifiedLoweringTester(MachineType p0 = kMachNone, SimplifiedLoweringTester(MachineType p0 = kMachNone,
MachineType p1 = kMachNone) MachineType p1 = kMachNone)
: GraphBuilderTester<ReturnType>(p0, p1), : GraphBuilderTester<ReturnType>(p0, p1),
typer(this->isolate(), this->graph(), nullptr, MaybeHandle<Context>()), typer(this->isolate(), this->graph()),
javascript(this->zone()), javascript(this->zone()),
jsgraph(this->isolate(), this->graph(), this->common(), &javascript, jsgraph(this->isolate(), this->graph(), this->common(), &javascript,
this->machine()), this->machine()),
...@@ -710,7 +710,7 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { ...@@ -710,7 +710,7 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
explicit TestingGraph(Type* p0_type, Type* p1_type = Type::None(), explicit TestingGraph(Type* p0_type, Type* p1_type = Type::None(),
Type* p2_type = Type::None()) Type* p2_type = Type::None())
: GraphAndBuilders(main_zone()), : GraphAndBuilders(main_zone()),
typer(main_isolate(), graph(), nullptr, MaybeHandle<Context>()), typer(main_isolate(), graph()),
javascript(main_zone()), javascript(main_zone()),
jsgraph(main_isolate(), graph(), common(), &javascript, machine()) { jsgraph(main_isolate(), graph(), common(), &javascript, machine()) {
start = graph()->NewNode(common()->Start(2)); start = graph()->NewNode(common()->Start(2));
......
...@@ -110,8 +110,7 @@ Matcher<Node*> GraphTest::IsUndefinedConstant() { ...@@ -110,8 +110,7 @@ Matcher<Node*> GraphTest::IsUndefinedConstant() {
TypedGraphTest::TypedGraphTest(int num_parameters) TypedGraphTest::TypedGraphTest(int num_parameters)
: GraphTest(num_parameters), : GraphTest(num_parameters), typer_(isolate(), graph()) {}
typer_(isolate(), graph(), nullptr, MaybeHandle<Context>()) {}
TypedGraphTest::~TypedGraphTest() {} TypedGraphTest::~TypedGraphTest() {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment