[turbofan] Fix Typer::Rangify to handle integral bitset types.

R=bmeurer@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#25074}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25074 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jarin@chromium.org 2014-11-03 13:58:39 +00:00
parent 273a9ad200
commit 83806d568d

View File

@ -408,10 +408,19 @@ Type* Typer::Visitor::FalsifyUndefined(Type* type, Typer* t) {
Type* Typer::Visitor::Rangify(Type* type, Typer* t) { Type* Typer::Visitor::Rangify(Type* type, Typer* t) {
if (type->IsRange()) return type; // Shortcut. if (type->IsRange()) return type; // Shortcut.
if (!type->Is(t->integer)) return type; // Give up. if (!type->Is(t->integer) && !type->Is(Type::Integral32())) {
return type; // Give up on non-integer types.
}
double min = type->Min();
double max = type->Max();
// Handle the degenerate case of empty bitset types (such as
// OtherUnsigned31 and OtherSigned32 on 64-bit architectures).
if (std::isnan(min)) {
DCHECK(std::isnan(max));
return type;
}
Factory* f = t->isolate()->factory(); Factory* f = t->isolate()->factory();
return Type::Range(f->NewNumber(type->Min()), f->NewNumber(type->Max()), return Type::Range(f->NewNumber(min), f->NewNumber(max), t->zone());
t->zone());
} }