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

Unified Diff: src/typing.cc

Issue 133683002: Retry "Templatise type representation" after making clang happy (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/types.cc ('k') | test/cctest/test-types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/typing.cc
diff --git a/src/typing.cc b/src/typing.cc
index 152f3c7325d9b5ebf332b22fd5ad16627815c7ec..30e0b920529a5a9ed8890a3d627d3ff06b7bfacb 100644
--- a/src/typing.cc
+++ b/src/typing.cc
@@ -71,12 +71,6 @@ void AstTyper::Run(CompilationInfo* info) {
#undef RECURSE
-Effect AstTyper::ObservedOnStack(Object* value) {
- Type* lower = Type::OfCurrently(Handle<Object>(value, isolate()));
- return Effect(Bounds(lower, Type::Any(), isolate()));
-}
-
-
#ifdef OBJECT_PRINT
static void PrintObserved(Variable* var, Object* value, Handle<Type> type) {
PrintF(" observed %s ", var->IsParameter() ? "param" : "local");
@@ -89,6 +83,12 @@ Effect AstTyper::ObservedOnStack(Object* value) {
#endif // OBJECT_PRINT
+Effect AstTyper::ObservedOnStack(Object* value) {
+ Handle<Type> lower = Type::OfCurrently(handle(value, isolate()), isolate());
+ return Effect(Bounds(lower, Type::Any(isolate())));
+}
+
+
void AstTyper::ObserveTypesAtOsrEntry(IterationStatement* stmt) {
if (stmt->OsrEntryId() != info_->osr_ast_id()) return;
@@ -405,13 +405,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_)));
}
@@ -432,7 +432,7 @@ void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) {
RECURSE(Visit(prop->value()));
}
- NarrowType(expr, Bounds(Type::Object(), isolate_));
+ NarrowType(expr, Bounds(Type::Object(isolate_)));
}
@@ -443,7 +443,7 @@ void AstTyper::VisitArrayLiteral(ArrayLiteral* expr) {
RECURSE(Visit(value));
}
- NarrowType(expr, Bounds(Type::Array(), isolate_));
+ NarrowType(expr, Bounds(Type::Array(isolate_)));
}
@@ -495,7 +495,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_)));
}
@@ -593,13 +593,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();
@@ -617,7 +617,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()) {
@@ -668,14 +668,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;
}
@@ -684,7 +683,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()));
@@ -692,26 +691,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:
@@ -720,7 +719,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();
@@ -740,7 +739,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_)));
}
« no previous file with comments | « src/types.cc ('k') | test/cctest/test-types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698