Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2059)

Unified Diff: src/compiler/typer.cc

Issue 1182193005: [turbofan] Remove the TryLowerDirectJSCall hack from generic lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | src/types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(&params[0], &params[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) \
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698