Commit f23819ef authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Assign proper types to various builtins.

Let the Typer assign proper types to Map, Set, WeakMap and WeakSet
builtins. Also assign a proper type to Array.isArray, Object.assign
and Object.create.

R=yangguo@chromium.org

Review-Url: https://codereview.chromium.org/2640783006
Cr-Commit-Position: refs/heads/master@{#42535}
parent 9c68654c
......@@ -1460,6 +1460,8 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
return Type::OtherObject();
// Array functions.
case kArrayIsArray:
return Type::Boolean();
case kArrayConcat:
return Type::Receiver();
case kArrayEvery:
......@@ -1494,6 +1496,9 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
return t->cache_.kPositiveSafeInteger;
// Object functions.
case kObjectAssign:
case kObjectCreate:
return Type::OtherObject();
case kObjectHasOwnProperty:
return Type::Boolean();
......@@ -1522,6 +1527,46 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
case kGlobalIsFinite:
case kGlobalIsNaN:
return Type::Boolean();
// Map functions.
case kMapClear:
case kMapForEach:
return Type::Undefined();
case kMapDelete:
case kMapHas:
return Type::Boolean();
case kMapEntries:
case kMapKeys:
case kMapSet:
case kMapValues:
return Type::OtherObject();
// Set functions.
case kSetAdd:
case kSetEntries:
case kSetKeys:
case kSetValues:
return Type::OtherObject();
case kSetClear:
case kSetForEach:
return Type::Undefined();
case kSetDelete:
case kSetHas:
return Type::Boolean();
// WeakMap functions.
case kWeakMapDelete:
case kWeakMapHas:
return Type::Boolean();
case kWeakMapSet:
return Type::OtherObject();
// WeakSet functions.
case kWeakSetAdd:
return Type::OtherObject();
case kWeakSetDelete:
case kWeakSetHas:
return Type::Boolean();
default:
break;
}
......
......@@ -6990,6 +6990,7 @@ class Script: public Struct {
// Installation of ids for the selected builtin functions is handled
// by the bootstrapper.
#define FUNCTIONS_WITH_ID_LIST(V) \
V(Array, isArray, ArrayIsArray) \
V(Array.prototype, concat, ArrayConcat) \
V(Array.prototype, every, ArrayEvery) \
V(Array.prototype, fill, ArrayFill) \
......@@ -7021,6 +7022,8 @@ class Script: public Struct {
V(Date.prototype, getTime, DateGetTime) \
V(Function.prototype, apply, FunctionApply) \
V(Function.prototype, call, FunctionCall) \
V(Object, assign, ObjectAssign) \
V(Object, create, ObjectCreate) \
V(Object.prototype, hasOwnProperty, ObjectHasOwnProperty) \
V(RegExp.prototype, compile, RegExpCompile) \
V(RegExp.prototype, exec, RegExpExec) \
......@@ -7090,7 +7093,28 @@ class Script: public Struct {
V(Number, parseFloat, NumberParseFloat) \
V(Number, parseInt, NumberParseInt) \
V(Number.prototype, toString, NumberToString) \
V(Object, create, ObjectCreate)
V(Map.prototype, clear, MapClear) \
V(Map.prototype, delete, MapDelete) \
V(Map.prototype, entries, MapEntries) \
V(Map.prototype, forEach, MapForEach) \
V(Map.prototype, has, MapHas) \
V(Map.prototype, keys, MapKeys) \
V(Map.prototype, set, MapSet) \
V(Map.prototype, values, MapValues) \
V(Set.prototype, add, SetAdd) \
V(Set.prototype, clear, SetClear) \
V(Set.prototype, delete, SetDelete) \
V(Set.prototype, entries, SetEntries) \
V(Set.prototype, forEach, SetForEach) \
V(Set.prototype, has, SetHas) \
V(Set.prototype, keys, SetKeys) \
V(Set.prototype, values, SetValues) \
V(WeakMap.prototype, delete, WeakMapDelete) \
V(WeakMap.prototype, has, WeakMapHas) \
V(WeakMap.prototype, set, WeakMapSet) \
V(WeakSet.prototype, add, WeakSetAdd) \
V(WeakSet.prototype, delete, WeakSetDelete) \
V(WeakSet.prototype, has, WeakSetHas)
#define ATOMIC_FUNCTIONS_WITH_ID_LIST(V) \
V(Atomics, load, AtomicsLoad) \
......
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