Index: src/compiler/typer.cc |
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc |
index 0f6c4d1079a026d82ed400a676489ce083809736..aeacad5e42f969d23ff26da91f83e3918d647ffd 100644 |
--- a/src/compiler/typer.cc |
+++ b/src/compiler/typer.cc |
@@ -26,6 +26,10 @@ namespace compiler { |
V(Float64) |
enum LazyCachedType { |
+ kAnyFunc0, |
+ kAnyFunc1, |
+ kAnyFunc2, |
+ kAnyFunc3, |
kNumberFunc0, |
kNumberFunc1, |
kNumberFunc2, |
@@ -78,6 +82,15 @@ class LazyTypeCache final : public ZoneObject { |
return CreateNative(Type::Number(), Type::UntaggedFloat64()); |
case kUint8Clamped: |
return Get(kUint8); |
+ case kAnyFunc0: |
+ return Type::Function(Type::Any(), zone()); |
+ case kAnyFunc1: |
+ return Type::Function(Type::Any(), Type::Any(), zone()); |
+ case kAnyFunc2: |
+ return Type::Function(Type::Any(), Type::Any(), Type::Any(), zone()); |
+ case kAnyFunc3: |
+ return Type::Function(Type::Any(), Type::Any(), Type::Any(), |
+ Type::Any(), zone()); |
case kNumberFunc0: |
return Type::Function(Type::Number(), zone()); |
case kNumberFunc1: |
@@ -2393,6 +2406,23 @@ Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
return typer_->cache_->Get(kFloat64ArrayFunc); |
} |
} |
+ int const arity = |
+ JSFunction::cast(*value)->shared()->internal_formal_parameter_count(); |
+ switch (arity) { |
+ case 0: |
+ return typer_->cache_->Get(kAnyFunc0); |
+ case 1: |
+ return typer_->cache_->Get(kAnyFunc1); |
+ case 2: |
+ return typer_->cache_->Get(kAnyFunc2); |
+ case 3: |
+ return typer_->cache_->Get(kAnyFunc3); |
+ default: { |
+ Type** const params = zone()->NewArray<Type*>(arity); |
+ std::fill(¶ms[0], ¶ms[arity], Type::Any(zone())); |
+ return Type::Function(Type::Any(zone()), arity, params, zone()); |
+ } |
+ } |
} else if (value->IsJSTypedArray()) { |
switch (JSTypedArray::cast(*value)->type()) { |
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |