Index: src/typing.cc |
diff --git a/src/typing.cc b/src/typing.cc |
index 8487c05eb4af9fe472509c5afc34ae0eb1916053..9294d424eaf211dbdfd4774a004c8ab955371a8d 100644 |
--- a/src/typing.cc |
+++ b/src/typing.cc |
@@ -344,13 +344,13 @@ void AstTyper::VisitVariableProxy(VariableProxy* expr) { |
void AstTyper::VisitLiteral(Literal* expr) { |
- Type* type = Type::Constant(expr->value(), isolate_); |
- NarrowType(expr, Bounds(type, isolate_)); |
+ Handle<Type> type = Type::Constant(expr->value(), isolate_); |
+ NarrowType(expr, Bounds(type)); |
} |
void AstTyper::VisitRegExpLiteral(RegExpLiteral* expr) { |
- NarrowType(expr, Bounds(Type::RegExp(), isolate_)); |
+ NarrowType(expr, Bounds(Type::RegExp(isolate_))); |
} |
@@ -371,7 +371,7 @@ void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) { |
RECURSE(Visit(prop->value())); |
} |
- NarrowType(expr, Bounds(Type::Object(), isolate_)); |
+ NarrowType(expr, Bounds(Type::Object(isolate_))); |
} |
@@ -382,7 +382,7 @@ void AstTyper::VisitArrayLiteral(ArrayLiteral* expr) { |
RECURSE(Visit(value)); |
} |
- NarrowType(expr, Bounds(Type::Array(), isolate_)); |
+ NarrowType(expr, Bounds(Type::Array(isolate_))); |
} |
@@ -435,7 +435,7 @@ void AstTyper::VisitThrow(Throw* expr) { |
RECURSE(Visit(expr->exception())); |
// TODO(rossberg): is it worth having a non-termination effect? |
- NarrowType(expr, Bounds(Type::None(), isolate_)); |
+ NarrowType(expr, Bounds(Type::None(isolate_))); |
} |
@@ -534,13 +534,13 @@ void AstTyper::VisitUnaryOperation(UnaryOperation* expr) { |
switch (expr->op()) { |
case Token::NOT: |
case Token::DELETE: |
- NarrowType(expr, Bounds(Type::Boolean(), isolate_)); |
+ NarrowType(expr, Bounds(Type::Boolean(isolate_))); |
break; |
case Token::VOID: |
- NarrowType(expr, Bounds(Type::Undefined(), isolate_)); |
+ NarrowType(expr, Bounds(Type::Undefined(isolate_))); |
break; |
case Token::TYPEOF: |
- NarrowType(expr, Bounds(Type::InternalizedString(), isolate_)); |
+ NarrowType(expr, Bounds(Type::InternalizedString(isolate_))); |
break; |
default: |
UNREACHABLE(); |
@@ -559,7 +559,7 @@ void AstTyper::VisitCountOperation(CountOperation* expr) { |
RECURSE(Visit(expr->expression())); |
- NarrowType(expr, Bounds(Type::Smi(), Type::Number(), isolate_)); |
+ NarrowType(expr, Bounds(Type::Smi(isolate_), Type::Number(isolate_))); |
VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
if (proxy != NULL && proxy->var()->IsStackAllocated()) { |
@@ -607,14 +607,13 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) { |
case Token::BIT_AND: { |
RECURSE(Visit(expr->left())); |
RECURSE(Visit(expr->right())); |
- Handle<Type> upper( |
- Type::Union( |
- expr->left()->bounds().upper, expr->right()->bounds().upper), |
+ Handle<Type> upper = Type::Union( |
+ expr->left()->bounds().upper, expr->right()->bounds().upper, |
isolate_); |
if (!upper->Is(Type::Signed32())) |
- upper = handle(Type::Signed32(), isolate_); |
- Handle<Type> lower(Type::Intersect( |
- handle(Type::Smi(), isolate_), upper), isolate_); |
+ upper = Type::Signed32(isolate_); |
+ Handle<Type> lower = |
+ Type::Intersect(Type::Smi(isolate_), upper, isolate_); |
NarrowType(expr, Bounds(lower, upper)); |
break; |
} |
@@ -623,7 +622,7 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) { |
case Token::SAR: |
RECURSE(Visit(expr->left())); |
RECURSE(Visit(expr->right())); |
- NarrowType(expr, Bounds(Type::Smi(), Type::Signed32(), isolate_)); |
+ NarrowType(expr, Bounds(Type::Smi(isolate_), Type::Signed32(isolate_))); |
break; |
case Token::SHR: |
RECURSE(Visit(expr->left())); |
@@ -631,26 +630,26 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) { |
// TODO(rossberg): The upper bound would be Unsigned32, but since there |
// is no 'positive Smi' type for the lower bound, we use the smallest |
// union of Smi and Unsigned32 as upper bound instead. |
- NarrowType(expr, Bounds(Type::Smi(), Type::Number(), isolate_)); |
+ NarrowType(expr, Bounds(Type::Smi(isolate_), Type::Number(isolate_))); |
break; |
case Token::ADD: { |
RECURSE(Visit(expr->left())); |
RECURSE(Visit(expr->right())); |
Bounds l = expr->left()->bounds(); |
Bounds r = expr->right()->bounds(); |
- Type* lower = |
+ Handle<Type> lower = |
l.lower->Is(Type::None()) || r.lower->Is(Type::None()) ? |
- Type::None() : |
+ Type::None(isolate_) : |
l.lower->Is(Type::String()) || r.lower->Is(Type::String()) ? |
- Type::String() : |
+ Type::String(isolate_) : |
l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ? |
- Type::Smi() : Type::None(); |
- Type* upper = |
+ Type::Smi(isolate_) : Type::None(isolate_); |
+ Handle<Type> upper = |
l.upper->Is(Type::String()) || r.upper->Is(Type::String()) ? |
- Type::String() : |
+ Type::String(isolate_) : |
l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ? |
- Type::Number() : Type::NumberOrString(); |
- NarrowType(expr, Bounds(lower, upper, isolate_)); |
+ Type::Number(isolate_) : Type::NumberOrString(isolate_); |
+ NarrowType(expr, Bounds(lower, upper)); |
break; |
} |
case Token::SUB: |
@@ -659,7 +658,7 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) { |
case Token::MOD: |
RECURSE(Visit(expr->left())); |
RECURSE(Visit(expr->right())); |
- NarrowType(expr, Bounds(Type::Smi(), Type::Number(), isolate_)); |
+ NarrowType(expr, Bounds(Type::Smi(isolate_), Type::Number(isolate_))); |
break; |
default: |
UNREACHABLE(); |
@@ -679,7 +678,7 @@ void AstTyper::VisitCompareOperation(CompareOperation* expr) { |
RECURSE(Visit(expr->left())); |
RECURSE(Visit(expr->right())); |
- NarrowType(expr, Bounds(Type::Boolean(), isolate_)); |
+ NarrowType(expr, Bounds(Type::Boolean(isolate_))); |
} |