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

[turbofan] Assign appropriate types to RegExp builtins.

Recognize a couple of builtins on the RegExp.prototype in the Typer and
assign useful types to them, so we can optimize various checks on their
results.

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

Review-Url: https://codereview.chromium.org/2531463002
Cr-Commit-Position: refs/heads/master@{#41240}
parent 14f81dd2
......@@ -1415,6 +1415,16 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
case kObjectHasOwnProperty:
return Type::Boolean();
// RegExp functions.
case kRegExpCompile:
return Type::OtherObject();
case kRegExpExec:
return Type::Union(Type::OtherObject(), Type::Null(), t->zone());
case kRegExpTest:
return Type::Boolean();
case kRegExpToString:
return Type::String();
// Function functions.
case kFunctionHasInstance:
return Type::Boolean();
......
......@@ -7249,6 +7249,10 @@ class Script: public Struct {
V(Function.prototype, apply, FunctionApply) \
V(Function.prototype, call, FunctionCall) \
V(Object.prototype, hasOwnProperty, ObjectHasOwnProperty) \
V(RegExp.prototype, compile, RegExpCompile) \
V(RegExp.prototype, exec, RegExpExec) \
V(RegExp.prototype, test, RegExpTest) \
V(RegExp.prototype, toString, RegExpToString) \
V(String.prototype, charCodeAt, StringCharCodeAt) \
V(String.prototype, charAt, StringCharAt) \
V(String.prototype, concat, StringConcat) \
......
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