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

[turbofan] Assign types to remaining builtins on String.prototype.

Assign types to the remaining builtins on the String.prototype where we
know a meaningful type, i.e. where the type is not dependent on some
callable function that is pass or loaded.

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

Review-Url: https://codereview.chromium.org/2532463002
Cr-Commit-Position: refs/heads/master@{#41294}
parent f666bff8
......@@ -1369,6 +1369,7 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
return t->cache_.kJSDateSecondType;
case kDateGetTime:
return t->cache_.kJSDateValueType;
// Number functions.
case kNumberIsFinite:
case kNumberIsInteger:
......@@ -1381,16 +1382,41 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
return t->cache_.kIntegerOrMinusZeroOrNaN;
case kNumberToString:
return Type::String();
// String functions.
case kStringCharCodeAt:
return Type::Union(Type::Range(0, kMaxUInt16, t->zone()), Type::NaN(),
t->zone());
case kStringCharAt:
return Type::String();
case kStringCodePointAt:
return Type::Union(Type::Range(0.0, String::kMaxCodePoint, t->zone()),
Type::Undefined(), t->zone());
case kStringConcat:
case kStringFromCharCode:
case kStringFromCodePoint:
return Type::String();
case kStringIndexOf:
case kStringLastIndexOf:
return Type::Range(-1.0, String::kMaxLength - 1.0, t->zone());
case kStringEndsWith:
case kStringIncludes:
return Type::Boolean();
case kStringRaw:
case kStringRepeat:
case kStringSlice:
return Type::String();
case kStringStartsWith:
return Type::Boolean();
case kStringSubstr:
case kStringSubstring:
case kStringToLowerCase:
case kStringToString:
case kStringToUpperCase:
case kStringTrim:
case kStringTrimLeft:
case kStringTrimRight:
case kStringValueOf:
return Type::String();
case kStringIterator:
......
......@@ -7252,11 +7252,27 @@ class Script: public Struct {
V(RegExp.prototype, toString, RegExpToString) \
V(String.prototype, charCodeAt, StringCharCodeAt) \
V(String.prototype, charAt, StringCharAt) \
V(String.prototype, codePointAt, StringCodePointAt) \
V(String.prototype, concat, StringConcat) \
V(String.prototype, endsWith, StringEndsWith) \
V(String.prototype, includes, StringIncludes) \
V(String.prototype, indexOf, StringIndexOf) \
V(String.prototype, lastIndexOf, StringLastIndexOf) \
V(String.prototype, repeat, StringRepeat) \
V(String.prototype, slice, StringSlice) \
V(String.prototype, startsWith, StringStartsWith) \
V(String.prototype, substr, StringSubstr) \
V(String.prototype, substring, StringSubstring) \
V(String.prototype, toLowerCase, StringToLowerCase) \
V(String.prototype, toString, StringToString) \
V(String.prototype, toUpperCase, StringToUpperCase) \
V(String.prototype, trim, StringTrim) \
V(String.prototype, trimLeft, StringTrimLeft) \
V(String.prototype, trimRight, StringTrimRight) \
V(String.prototype, valueOf, StringValueOf) \
V(String, fromCharCode, StringFromCharCode) \
V(String, fromCodePoint, StringFromCodePoint) \
V(String, raw, StringRaw) \
V(Math, random, MathRandom) \
V(Math, floor, MathFloor) \
V(Math, round, MathRound) \
......
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