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() {
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");
}
......
......@@ -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();
......
......@@ -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_;
......
......@@ -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());
......
......@@ -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_;
......
......@@ -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)));
......
......@@ -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));
......
......@@ -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));
......
......@@ -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() {}
......
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