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

[turbofan] Add more typing rules for Array.prototype builtins.

For a couple of those Array builtins we can specify a useful type that
will help us to eliminate a couple of checks on their outputs.

R=yangguo@chromium.org
BUG=v8:5267

Review-Url: https://codereview.chromium.org/2529233002
Cr-Commit-Position: refs/heads/master@{#41295}
parent ae14b6b7
......@@ -1433,11 +1433,38 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
return Type::OtherObject();
// Array functions.
case kArrayConcat:
return Type::Receiver();
case kArrayEvery:
return Type::Boolean();
case kArrayFill:
case kArrayFilter:
return Type::Receiver();
case kArrayFindIndex:
return Type::Range(-1, kMaxSafeInteger, t->zone());
case kArrayForEach:
return Type::Undefined();
case kArrayIncludes:
return Type::Boolean();
case kArrayIndexOf:
return Type::Range(-1, kMaxSafeInteger, t->zone());
case kArrayJoin:
return Type::String();
case kArrayLastIndexOf:
return Type::Range(-1, kMaxSafeInteger, t->zone());
case kArrayMap:
return Type::Receiver();
case kArrayPush:
return t->cache_.kPositiveSafeInteger;
case kArrayReverse:
case kArraySlice:
return Type::Receiver();
case kArraySome:
return Type::Boolean();
case kArraySplice:
return Type::Receiver();
case kArrayUnshift:
return t->cache_.kPositiveSafeInteger;
// Object functions.
case kObjectHasOwnProperty:
......
......@@ -7228,11 +7228,25 @@ 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.prototype, concat, ArrayConcat) \
V(Array.prototype, every, ArrayEvery) \
V(Array.prototype, fill, ArrayFill) \
V(Array.prototype, filter, ArrayFilter) \
V(Array.prototype, findIndex, ArrayFindIndex) \
V(Array.prototype, forEach, ArrayForEach) \
V(Array.prototype, includes, ArrayIncludes) \
V(Array.prototype, indexOf, ArrayIndexOf) \
V(Array.prototype, join, ArrayJoin) \
V(Array.prototype, lastIndexOf, ArrayLastIndexOf) \
V(Array.prototype, push, ArrayPush) \
V(Array.prototype, map, ArrayMap) \
V(Array.prototype, pop, ArrayPop) \
V(Array.prototype, push, ArrayPush) \
V(Array.prototype, reverse, ArrayReverse) \
V(Array.prototype, shift, ArrayShift) \
V(Array.prototype, slice, ArraySlice) \
V(Array.prototype, some, ArraySome) \
V(Array.prototype, splice, ArraySplice) \
V(Array.prototype, unshift, ArrayUnshift) \
V(Date, now, DateNow) \
V(Date.prototype, getDate, DateGetDate) \
V(Date.prototype, getDay, DateGetDay) \
......
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