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

[turbofan] Extend typer support for typeof operator.

R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1422623013

Cr-Commit-Position: refs/heads/master@{#31770}
parent 796c30ea
...@@ -1102,6 +1102,8 @@ Type* Typer::Visitor::JSTypeOfTyper(Type* type, Typer* t) { ...@@ -1102,6 +1102,8 @@ Type* Typer::Visitor::JSTypeOfTyper(Type* type, Typer* t) {
return Type::Constant(f->boolean_string(), t->zone()); return Type::Constant(f->boolean_string(), t->zone());
} else if (type->Is(Type::Number())) { } else if (type->Is(Type::Number())) {
return Type::Constant(f->number_string(), t->zone()); return Type::Constant(f->number_string(), t->zone());
} else if (type->Is(Type::String())) {
return Type::Constant(f->string_string(), t->zone());
} else if (type->Is(Type::Symbol())) { } else if (type->Is(Type::Symbol())) {
return Type::Constant(f->symbol_string(), t->zone()); return Type::Constant(f->symbol_string(), t->zone());
} else if (type->Is(Type::Union(Type::Undefined(), Type::Undetectable(), } else if (type->Is(Type::Union(Type::Undefined(), Type::Undetectable(),
...@@ -1109,6 +1111,9 @@ Type* Typer::Visitor::JSTypeOfTyper(Type* type, Typer* t) { ...@@ -1109,6 +1111,9 @@ Type* Typer::Visitor::JSTypeOfTyper(Type* type, Typer* t) {
return Type::Constant(f->undefined_string(), t->zone()); return Type::Constant(f->undefined_string(), t->zone());
} else if (type->Is(Type::Null())) { } else if (type->Is(Type::Null())) {
return Type::Constant(f->object_string(), t->zone()); return Type::Constant(f->object_string(), t->zone());
} else if (type->IsConstant()) {
return Type::Constant(
Object::TypeOf(t->isolate(), type->AsConstant()->Value()), t->zone());
} }
return Type::InternalizedString(); return Type::InternalizedString();
} }
......
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