Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: src/crankshaft/typing.cc

Issue 1655833002: Remove the template magic from types.(h|cc), remove types-inl.h. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Undo whitespace change Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/hydrogen-types.cc ('k') | src/ic/ic-state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/typing.cc
diff --git a/src/crankshaft/typing.cc b/src/crankshaft/typing.cc
index 77171a637ff7e9db76da0fddd2b609c9f55b6ac9..957347177c6705f29e13d02b36efeb3d97c350ac 100644
--- a/src/crankshaft/typing.cc
+++ b/src/crankshaft/typing.cc
@@ -45,7 +45,7 @@ AstTyper::AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure,
Effect AstTyper::ObservedOnStack(Object* value) {
Type* lower = Type::NowOf(value, zone());
- return Effect(Bounds(lower, Type::Any(zone())));
+ return Effect(Bounds(lower, Type::Any()));
}
@@ -393,7 +393,7 @@ void AstTyper::VisitLiteral(Literal* expr) {
void AstTyper::VisitRegExpLiteral(RegExpLiteral* expr) {
// TODO(rossberg): Reintroduce RegExp type.
- NarrowType(expr, Bounds(Type::Object(zone())));
+ NarrowType(expr, Bounds(Type::Object()));
}
@@ -421,7 +421,7 @@ void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) {
RECURSE(Visit(prop->value()));
}
- NarrowType(expr, Bounds(Type::Object(zone())));
+ NarrowType(expr, Bounds(Type::Object()));
}
@@ -432,7 +432,7 @@ void AstTyper::VisitArrayLiteral(ArrayLiteral* expr) {
RECURSE(Visit(value));
}
- NarrowType(expr, Bounds(Type::Object(zone())));
+ NarrowType(expr, Bounds(Type::Object()));
}
@@ -485,7 +485,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(zone())));
+ NarrowType(expr, Bounds(Type::None()));
}
@@ -569,7 +569,7 @@ void AstTyper::VisitCallNew(CallNew* expr) {
RECURSE(Visit(arg));
}
- NarrowType(expr, Bounds(Type::None(zone()), Type::Receiver(zone())));
+ NarrowType(expr, Bounds(Type::None(), Type::Receiver()));
}
@@ -596,13 +596,13 @@ void AstTyper::VisitUnaryOperation(UnaryOperation* expr) {
switch (expr->op()) {
case Token::NOT:
case Token::DELETE:
- NarrowType(expr, Bounds(Type::Boolean(zone())));
+ NarrowType(expr, Bounds(Type::Boolean()));
break;
case Token::VOID:
- NarrowType(expr, Bounds(Type::Undefined(zone())));
+ NarrowType(expr, Bounds(Type::Undefined()));
break;
case Token::TYPEOF:
- NarrowType(expr, Bounds(Type::InternalizedString(zone())));
+ NarrowType(expr, Bounds(Type::InternalizedString()));
break;
default:
UNREACHABLE();
@@ -624,7 +624,7 @@ void AstTyper::VisitCountOperation(CountOperation* expr) {
RECURSE(Visit(expr->expression()));
- NarrowType(expr, Bounds(Type::SignedSmall(zone()), Type::Number(zone())));
+ NarrowType(expr, Bounds(Type::SignedSmall(), Type::Number()));
VariableProxy* proxy = expr->expression()->AsVariableProxy();
if (proxy != NULL && proxy->var()->IsStackAllocated()) {
@@ -679,8 +679,8 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
RECURSE(Visit(expr->right()));
Type* upper = Type::Union(
expr->left()->bounds().upper, expr->right()->bounds().upper, zone());
- if (!upper->Is(Type::Signed32())) upper = Type::Signed32(zone());
- Type* lower = Type::Intersect(Type::SignedSmall(zone()), upper, zone());
+ if (!upper->Is(Type::Signed32())) upper = Type::Signed32();
+ Type* lower = Type::Intersect(Type::SignedSmall(), upper, zone());
NarrowType(expr, Bounds(lower, upper));
break;
}
@@ -689,8 +689,7 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
case Token::SAR:
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
- NarrowType(expr,
- Bounds(Type::SignedSmall(zone()), Type::Signed32(zone())));
+ NarrowType(expr, Bounds(Type::SignedSmall(), Type::Signed32()));
break;
case Token::SHR:
RECURSE(Visit(expr->left()));
@@ -698,7 +697,7 @@ 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::SignedSmall(zone()), Type::Number(zone())));
+ NarrowType(expr, Bounds(Type::SignedSmall(), Type::Number()));
break;
case Token::ADD: {
RECURSE(Visit(expr->left()));
@@ -706,17 +705,19 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
Bounds l = expr->left()->bounds();
Bounds r = expr->right()->bounds();
Type* lower =
- !l.lower->IsInhabited() || !r.lower->IsInhabited() ?
- Type::None(zone()) :
- l.lower->Is(Type::String()) || r.lower->Is(Type::String()) ?
- Type::String(zone()) :
- l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ?
- Type::SignedSmall(zone()) : Type::None(zone());
+ !l.lower->IsInhabited() || !r.lower->IsInhabited()
+ ? Type::None()
+ : l.lower->Is(Type::String()) || r.lower->Is(Type::String())
+ ? Type::String()
+ : l.lower->Is(Type::Number()) && r.lower->Is(Type::Number())
+ ? Type::SignedSmall()
+ : Type::None();
Type* upper =
- l.upper->Is(Type::String()) || r.upper->Is(Type::String()) ?
- Type::String(zone()) :
- l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ?
- Type::Number(zone()) : Type::NumberOrString(zone());
+ l.upper->Is(Type::String()) || r.upper->Is(Type::String())
+ ? Type::String()
+ : l.upper->Is(Type::Number()) && r.upper->Is(Type::Number())
+ ? Type::Number()
+ : Type::NumberOrString();
NarrowType(expr, Bounds(lower, upper));
break;
}
@@ -726,7 +727,7 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
case Token::MOD:
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
- NarrowType(expr, Bounds(Type::SignedSmall(zone()), Type::Number(zone())));
+ NarrowType(expr, Bounds(Type::SignedSmall(), Type::Number()));
break;
default:
UNREACHABLE();
@@ -748,7 +749,7 @@ void AstTyper::VisitCompareOperation(CompareOperation* expr) {
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
- NarrowType(expr, Bounds(Type::Boolean(zone())));
+ NarrowType(expr, Bounds(Type::Boolean()));
}
« no previous file with comments | « src/crankshaft/hydrogen-types.cc ('k') | src/ic/ic-state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698