| Index: src/compiler/typer.cc
|
| diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
|
| index 600940c897c4e0312183d6560a7bf21da1c2a8af..1055e11d3fb7c37682b63c06fdef0b808f58b505 100644
|
| --- a/src/compiler/typer.cc
|
| +++ b/src/compiler/typer.cc
|
| @@ -454,9 +454,14 @@ Type* Typer::Visitor::ToLength(Type* type, Typer* t) {
|
| type = ToInteger(type, t);
|
| double min = type->Min();
|
| double max = type->Max();
|
| + if (max <= 0.0) {
|
| + return Type::NewConstant(0, t->zone());
|
| + }
|
| + if (min >= kMaxSafeInteger) {
|
| + return Type::NewConstant(kMaxSafeInteger, t->zone());
|
| + }
|
| if (min <= 0.0) min = 0.0;
|
| - if (max > kMaxSafeInteger) max = kMaxSafeInteger;
|
| - if (max <= min) max = min;
|
| + if (max >= kMaxSafeInteger) max = kMaxSafeInteger;
|
| return Type::Range(min, max, t->zone());
|
| }
|
|
|
|
|