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

Unified Diff: src/compiler/types.cc

Issue 2535753004: [turbofan] Add appropriate types to express Callable. (Closed)
Patch Set: Add spec comments. Created 4 years, 1 month 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/types.h ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/types.cc
diff --git a/src/compiler/types.cc b/src/compiler/types.cc
index a66e15a9abcc4bd5bb2bb124f96e13988bdd5144..cc1a002b8be83b43c4adb441b34e988e01c87579 100644
--- a/src/compiler/types.cc
+++ b/src/compiler/types.cc
@@ -196,7 +196,17 @@ Type::bitset BitsetType::Lub(i::Map* map) {
case JS_GLOBAL_PROXY_TYPE:
case JS_API_OBJECT_TYPE:
case JS_SPECIAL_API_OBJECT_TYPE:
- if (map->is_undetectable()) return kOtherUndetectable;
+ if (map->is_undetectable()) {
+ // Currently we assume that every undetectable receiver is also
+ // callable, which is what we need to support document.all. We
+ // could add another Type bit to support other use cases in the
+ // future if necessary.
+ DCHECK(map->is_callable());
+ return kOtherUndetectable;
+ }
+ if (map->is_callable()) {
+ return kOtherCallable;
+ }
return kOtherObject;
case JS_VALUE_TYPE:
case JS_MESSAGE_OBJECT_TYPE:
@@ -255,15 +265,19 @@ Type::bitset BitsetType::Lub(i::Map* map) {
case JS_WEAK_MAP_TYPE:
case JS_WEAK_SET_TYPE:
case JS_PROMISE_TYPE:
- case JS_BOUND_FUNCTION_TYPE:
+ DCHECK(!map->is_callable());
DCHECK(!map->is_undetectable());
return kOtherObject;
+ case JS_BOUND_FUNCTION_TYPE:
+ DCHECK(!map->is_undetectable());
+ return kBoundFunction;
case JS_FUNCTION_TYPE:
DCHECK(!map->is_undetectable());
return kFunction;
case JS_PROXY_TYPE:
DCHECK(!map->is_undetectable());
- return kProxy;
+ if (map->is_callable()) return kCallableProxy;
+ return kOtherProxy;
case MAP_TYPE:
case ALLOCATION_SITE_TYPE:
case ACCESSOR_INFO_TYPE:
« no previous file with comments | « src/compiler/types.h ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698