| Index: src/typing.cc
|
| diff --git a/src/typing.cc b/src/typing.cc
|
| index e9da680c32cd3ec025e80137e91b8a34fefd3dc4..01c395c3debbd640ee74370ad42f72d6c323646e 100644
|
| --- a/src/typing.cc
|
| +++ b/src/typing.cc
|
| @@ -247,8 +247,8 @@ void AstTyper::VisitForStatement(ForStatement* stmt) {
|
| RECURSE(Visit(stmt->cond()));
|
| }
|
| RECURSE(Visit(stmt->body()));
|
| - store_.Forget(); // Control may transfer here via 'continue'.
|
| if (stmt->next() != NULL) {
|
| + store_.Forget(); // Control may transfer here via 'continue'.
|
| RECURSE(Visit(stmt->next()));
|
| }
|
| store_.Forget(); // Control may transfer here via termination or 'break'.
|
| @@ -580,7 +580,9 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
|
| Type* upper = Type::Union(
|
| expr->left()->bounds().upper, expr->right()->bounds().upper);
|
| if (!upper->Is(Type::Signed32())) upper = Type::Signed32();
|
| - NarrowType(expr, Bounds(Type::Smi(), upper, isolate_));
|
| + Type* lower = Type::Intersect(
|
| + handle(Type::Smi(), isolate_), handle(upper, isolate_));
|
| + NarrowType(expr, Bounds(lower, upper, isolate_));
|
| break;
|
| }
|
| case Token::BIT_XOR:
|
| @@ -593,7 +595,8 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
|
| case Token::SHR:
|
| RECURSE(Visit(expr->left()));
|
| RECURSE(Visit(expr->right()));
|
| - NarrowType(expr, Bounds(Type::Smi(), Type::Unsigned32(), isolate_));
|
| + // TODO(rossberg): we could use an UnsignedSmi as lower bound here...
|
| + NarrowType(expr, Bounds(Type::Unsigned32(), isolate_));
|
| break;
|
| case Token::ADD: {
|
| RECURSE(Visit(expr->left()));
|
| @@ -601,15 +604,17 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
|
| Bounds l = expr->left()->bounds();
|
| Bounds r = expr->right()->bounds();
|
| Type* lower =
|
| - l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ?
|
| - Type::Smi() :
|
| + l.lower->Is(Type::None()) || r.lower->Is(Type::None()) ?
|
| + Type::None() :
|
| l.lower->Is(Type::String()) || r.lower->Is(Type::String()) ?
|
| - Type::String() : Type::None();
|
| + Type::String() :
|
| + l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ?
|
| + Type::Smi() : Type::None();
|
| Type* upper =
|
| - l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ?
|
| - Type::Number() :
|
| l.upper->Is(Type::String()) || r.upper->Is(Type::String()) ?
|
| - Type::String() : Type::NumberOrString();
|
| + Type::String() :
|
| + l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ?
|
| + Type::Number() : Type::NumberOrString();
|
| NarrowType(expr, Bounds(lower, upper, isolate_));
|
| break;
|
| }
|
|
|