Chromium Code Reviews| Index: src/typing.cc |
| diff --git a/src/typing.cc b/src/typing.cc |
| index 3f3ff6014bcac000b67e1f1e70065188a9e70649..dfd41f3e1460f56726b6aa14f438a0d6236a68b4 100644 |
| --- a/src/typing.cc |
| +++ b/src/typing.cc |
| @@ -45,13 +45,13 @@ AstTyper::AstTyper(CompilationInfo* info) |
| } |
| -#define CHECK_ALIVE(call) \ |
| +#define RECURSE(call) \ |
| do { \ |
| + ASSERT(!visitor->HasStackOverflow()); \ |
| call; \ |
| if (visitor->HasStackOverflow()) return; \ |
| } while (false) |
| - |
| void AstTyper::Run(CompilationInfo* info) { |
| AstTyper* visitor = new(info->zone()) AstTyper(info); |
| Scope* scope = info->scope(); |
| @@ -59,52 +59,48 @@ void AstTyper::Run(CompilationInfo* info) { |
| // Handle implicit declaration of the function name in named function |
| // expressions before other declarations. |
| if (scope->is_function_scope() && scope->function() != NULL) { |
| - CHECK_ALIVE(visitor->VisitVariableDeclaration(scope->function())); |
| + RECURSE(visitor->VisitVariableDeclaration(scope->function())); |
| } |
| - CHECK_ALIVE(visitor->VisitDeclarations(scope->declarations())); |
| - CHECK_ALIVE(visitor->VisitStatements(info->function()->body())); |
| + RECURSE(visitor->VisitDeclarations(scope->declarations())); |
| + RECURSE(visitor->VisitStatements(info->function()->body())); |
| } |
| +#undef RECURSE |
| -#undef CHECK_ALIVE |
| -#define CHECK_ALIVE(call) \ |
| +#define RECURSE(call) \ |
| do { \ |
| + ASSERT(!HasStackOverflow()); \ |
| call; \ |
| if (HasStackOverflow()) return; \ |
| } while (false) |
| void AstTyper::VisitStatements(ZoneList<Statement*>* stmts) { |
| - ASSERT(!HasStackOverflow()); |
| for (int i = 0; i < stmts->length(); ++i) { |
| Statement* stmt = stmts->at(i); |
| - CHECK_ALIVE(Visit(stmt)); |
| + RECURSE(Visit(stmt)); |
| } |
| } |
| void AstTyper::VisitBlock(Block* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(VisitStatements(stmt->statements())); |
| + RECURSE(VisitStatements(stmt->statements())); |
| } |
| void AstTyper::VisitExpressionStatement(ExpressionStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->expression())); |
| + RECURSE(Visit(stmt->expression())); |
| } |
| void AstTyper::VisitEmptyStatement(EmptyStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitIfStatement(IfStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->condition())); |
| - CHECK_ALIVE(Visit(stmt->then_statement())); |
| - CHECK_ALIVE(Visit(stmt->else_statement())); |
| + RECURSE(Visit(stmt->condition())); |
| + RECURSE(Visit(stmt->then_statement())); |
| + RECURSE(Visit(stmt->else_statement())); |
| if (!stmt->condition()->ToBooleanIsTrue() && |
| !stmt->condition()->ToBooleanIsFalse()) { |
| @@ -114,18 +110,15 @@ void AstTyper::VisitIfStatement(IfStatement* stmt) { |
| void AstTyper::VisitContinueStatement(ContinueStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitBreakStatement(BreakStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitReturnStatement(ReturnStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->expression())); |
| + RECURSE(Visit(stmt->expression())); |
| // TODO(rossberg): we only need this for inlining into test contexts... |
| stmt->expression()->RecordToBooleanTypeFeedback(oracle()); |
| @@ -133,22 +126,20 @@ void AstTyper::VisitReturnStatement(ReturnStatement* stmt) { |
| void AstTyper::VisitWithStatement(WithStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(stmt->expression()); |
| - CHECK_ALIVE(stmt->statement()); |
| + RECURSE(stmt->expression()); |
| + RECURSE(stmt->statement()); |
| } |
| void AstTyper::VisitSwitchStatement(SwitchStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->tag())); |
| + RECURSE(Visit(stmt->tag())); |
| ZoneList<CaseClause*>* clauses = stmt->cases(); |
| SwitchStatement::SwitchType switch_type = stmt->switch_type(); |
| for (int i = 0; i < clauses->length(); ++i) { |
| CaseClause* clause = clauses->at(i); |
| if (!clause->is_default()) { |
| Expression* label = clause->label(); |
| - CHECK_ALIVE(Visit(label)); |
| + RECURSE(Visit(label)); |
| SwitchStatement::SwitchType label_switch_type = |
| label->IsSmiLiteral() ? SwitchStatement::SMI_SWITCH : |
| @@ -159,7 +150,7 @@ void AstTyper::VisitSwitchStatement(SwitchStatement* stmt) { |
| else if (switch_type != label_switch_type) |
| switch_type = SwitchStatement::GENERIC_SWITCH; |
| } |
| - CHECK_ALIVE(VisitStatements(clause->statements())); |
| + RECURSE(VisitStatements(clause->statements())); |
| } |
| if (switch_type == SwitchStatement::UNKNOWN_SWITCH) |
| switch_type = SwitchStatement::GENERIC_SWITCH; |
| @@ -177,9 +168,8 @@ void AstTyper::VisitSwitchStatement(SwitchStatement* stmt) { |
| void AstTyper::VisitDoWhileStatement(DoWhileStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->body())); |
| - CHECK_ALIVE(Visit(stmt->cond())); |
| + RECURSE(Visit(stmt->body())); |
| + RECURSE(Visit(stmt->cond())); |
| if (!stmt->cond()->ToBooleanIsTrue()) { |
| stmt->cond()->RecordToBooleanTypeFeedback(oracle()); |
| @@ -188,9 +178,8 @@ void AstTyper::VisitDoWhileStatement(DoWhileStatement* stmt) { |
| void AstTyper::VisitWhileStatement(WhileStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->cond())); |
| - CHECK_ALIVE(Visit(stmt->body())); |
| + RECURSE(Visit(stmt->cond())); |
| + RECURSE(Visit(stmt->body())); |
| if (!stmt->cond()->ToBooleanIsTrue()) { |
| stmt->cond()->RecordToBooleanTypeFeedback(oracle()); |
| @@ -199,98 +188,98 @@ void AstTyper::VisitWhileStatement(WhileStatement* stmt) { |
| void AstTyper::VisitForStatement(ForStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| if (stmt->init() != NULL) { |
| - CHECK_ALIVE(Visit(stmt->init())); |
| + RECURSE(Visit(stmt->init())); |
| } |
| if (stmt->cond() != NULL) { |
| - CHECK_ALIVE(Visit(stmt->cond())); |
| + RECURSE(Visit(stmt->cond())); |
| stmt->cond()->RecordToBooleanTypeFeedback(oracle()); |
| } |
| - CHECK_ALIVE(Visit(stmt->body())); |
| + RECURSE(Visit(stmt->body())); |
| if (stmt->next() != NULL) { |
| - CHECK_ALIVE(Visit(stmt->next())); |
| + RECURSE(Visit(stmt->next())); |
| } |
| } |
| void AstTyper::VisitForInStatement(ForInStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->enumerable())); |
| - CHECK_ALIVE(Visit(stmt->body())); |
| + RECURSE(Visit(stmt->enumerable())); |
| + RECURSE(Visit(stmt->body())); |
| stmt->RecordTypeFeedback(oracle()); |
| } |
| void AstTyper::VisitForOfStatement(ForOfStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->iterable())); |
| - CHECK_ALIVE(Visit(stmt->body())); |
| + RECURSE(Visit(stmt->iterable())); |
| + RECURSE(Visit(stmt->body())); |
| } |
| void AstTyper::VisitTryCatchStatement(TryCatchStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->try_block())); |
| - CHECK_ALIVE(Visit(stmt->catch_block())); |
| + RECURSE(Visit(stmt->try_block())); |
| + RECURSE(Visit(stmt->catch_block())); |
| } |
| void AstTyper::VisitTryFinallyStatement(TryFinallyStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->try_block())); |
| - CHECK_ALIVE(Visit(stmt->finally_block())); |
| + RECURSE(Visit(stmt->try_block())); |
| + RECURSE(Visit(stmt->finally_block())); |
| } |
| void AstTyper::VisitDebuggerStatement(DebuggerStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitFunctionLiteral(FunctionLiteral* expr) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitSharedFunctionInfoLiteral(SharedFunctionInfoLiteral* expr) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitConditional(Conditional* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->condition())); |
| - CHECK_ALIVE(Visit(expr->then_expression())); |
| - CHECK_ALIVE(Visit(expr->else_expression())); |
| + RECURSE(Visit(expr->condition())); |
| + RECURSE(Visit(expr->then_expression())); |
| + RECURSE(Visit(expr->else_expression())); |
| expr->condition()->RecordToBooleanTypeFeedback(oracle()); |
| + |
| + MergeLowerType(expr, Type::Union( |
|
Jakob Kummerow
2013/06/26 15:09:23
As discussed offline, inferring the lower bound as
rossberg
2013/06/26 16:18:59
Actually, the correct thing to use here is interse
|
| + expr->then_expression()->lower_type(), |
| + expr->else_expression()->lower_type())); |
| + MergeUpperType(expr, Type::Union( |
| + expr->then_expression()->upper_type(), |
| + expr->else_expression()->upper_type())); |
| } |
| void AstTyper::VisitVariableProxy(VariableProxy* expr) { |
| - ASSERT(!HasStackOverflow()); |
| + // TODO(rossberg): typing of variables |
| } |
| void AstTyper::VisitLiteral(Literal* expr) { |
| - ASSERT(!HasStackOverflow()); |
| + Type* type = Type::Constant(expr->value(), isolate_); |
| + MergeLowerType(expr, type); |
| + MergeUpperType(expr, type); |
| } |
| void AstTyper::VisitRegExpLiteral(RegExpLiteral* expr) { |
| - ASSERT(!HasStackOverflow()); |
| + MergeLowerType(expr, Type::RegExp()); |
| + MergeUpperType(expr, Type::RegExp()); |
| } |
| void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) { |
| - ASSERT(!HasStackOverflow()); |
| ZoneList<ObjectLiteral::Property*>* properties = expr->properties(); |
| for (int i = 0; i < properties->length(); ++i) { |
| ObjectLiteral::Property* prop = properties->at(i); |
| - CHECK_ALIVE(Visit(prop->value())); |
| + RECURSE(Visit(prop->value())); |
| if ((prop->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL && |
| !CompileTimeValue::IsCompileTimeValue(prop->value())) || |
| @@ -299,27 +288,28 @@ void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) { |
| prop->RecordTypeFeedback(oracle()); |
| } |
| } |
| + |
| + MergeLowerType(expr, Type::Object()); |
| + MergeUpperType(expr, Type::Object()); |
| } |
| void AstTyper::VisitArrayLiteral(ArrayLiteral* expr) { |
| - ASSERT(!HasStackOverflow()); |
| ZoneList<Expression*>* values = expr->values(); |
| for (int i = 0; i < values->length(); ++i) { |
| Expression* value = values->at(i); |
| - CHECK_ALIVE(Visit(value)); |
| + RECURSE(Visit(value)); |
| } |
| + |
| + MergeLowerType(expr, Type::Array()); |
| + MergeUpperType(expr, Type::Array()); |
| } |
| void AstTyper::VisitAssignment(Assignment* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->target())); |
| - CHECK_ALIVE(Visit(expr->value())); |
| - |
| // TODO(rossberg): Can we clean this up? |
| if (expr->is_compound()) { |
| - CHECK_ALIVE(Visit(expr->binary_operation())); |
| + RECURSE(Visit(expr->binary_operation())); |
| Expression* target = expr->target(); |
| Property* prop = target->AsProperty(); |
| @@ -328,42 +318,52 @@ void AstTyper::VisitAssignment(Assignment* expr) { |
| if (!prop->key()->IsPropertyName()) // i.e., keyed |
| expr->RecordTypeFeedback(oracle(), zone()); |
|
Jakob Kummerow
2013/06/26 15:09:23
nit: {} while you're here
rossberg
2013/06/26 16:18:59
Done.
|
| } |
| - return; |
| + } else { |
| + RECURSE(Visit(expr->target())); |
| + RECURSE(Visit(expr->value())); |
| + |
| + if (expr->target()->AsProperty()) |
| + expr->RecordTypeFeedback(oracle(), zone()); |
|
Jakob Kummerow
2013/06/26 15:09:23
nit: {}
rossberg
2013/06/26 16:18:59
Done.
|
| + |
| + MergeLowerType(expr, expr->value()->lower_type()); |
| + MergeUpperType(expr, expr->value()->upper_type()); |
| } |
| - if (expr->target()->AsProperty()) |
| - expr->RecordTypeFeedback(oracle(), zone()); |
| + // TODO(rossberg): handle target variables |
| } |
| void AstTyper::VisitYield(Yield* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->generator_object())); |
| - CHECK_ALIVE(Visit(expr->expression())); |
| + RECURSE(Visit(expr->generator_object())); |
| + RECURSE(Visit(expr->expression())); |
| + |
| + // We don't know anything about the type. |
| } |
| void AstTyper::VisitThrow(Throw* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->exception())); |
| + RECURSE(Visit(expr->exception())); |
| + |
| + // Lower type is None already |
|
Jakob Kummerow
2013/06/26 15:09:23
nit: trailing full stop please.
rossberg
2013/06/26 16:18:59
Done.
|
| + MergeUpperType(expr, Type::None()); |
| } |
| void AstTyper::VisitProperty(Property* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->obj())); |
| - CHECK_ALIVE(Visit(expr->key())); |
| + RECURSE(Visit(expr->obj())); |
| + RECURSE(Visit(expr->key())); |
| expr->RecordTypeFeedback(oracle(), zone()); |
| + |
| + // We don't know anything about the type. |
| } |
| void AstTyper::VisitCall(Call* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->expression())); |
| + RECURSE(Visit(expr->expression())); |
| ZoneList<Expression*>* args = expr->arguments(); |
| for (int i = 0; i < args->length(); ++i) { |
| Expression* arg = args->at(i); |
| - CHECK_ALIVE(Visit(arg)); |
| + RECURSE(Visit(arg)); |
| } |
| Expression* callee = expr->expression(); |
| @@ -374,35 +374,38 @@ void AstTyper::VisitCall(Call* expr) { |
| } else { |
| expr->RecordTypeFeedback(oracle(), CALL_AS_FUNCTION); |
| } |
| + |
| + // We don't know anything about the type. |
| } |
| void AstTyper::VisitCallNew(CallNew* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->expression())); |
| + RECURSE(Visit(expr->expression())); |
| ZoneList<Expression*>* args = expr->arguments(); |
| for (int i = 0; i < args->length(); ++i) { |
| Expression* arg = args->at(i); |
| - CHECK_ALIVE(Visit(arg)); |
| + RECURSE(Visit(arg)); |
| } |
| expr->RecordTypeFeedback(oracle()); |
| + |
| + // We don't know anything about the type. |
| } |
| void AstTyper::VisitCallRuntime(CallRuntime* expr) { |
| - ASSERT(!HasStackOverflow()); |
| ZoneList<Expression*>* args = expr->arguments(); |
| for (int i = 0; i < args->length(); ++i) { |
| Expression* arg = args->at(i); |
| - CHECK_ALIVE(Visit(arg)); |
| + RECURSE(Visit(arg)); |
| } |
| + |
| + // We don't know anything about the type. |
| } |
| void AstTyper::VisitUnaryOperation(UnaryOperation* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->expression())); |
| + RECURSE(Visit(expr->expression())); |
| // Collect type feedback. |
| Handle<Type> op_type = oracle()->UnaryType(expr->UnaryOperationFeedbackId()); |
| @@ -411,25 +414,69 @@ void AstTyper::VisitUnaryOperation(UnaryOperation* expr) { |
| // TODO(rossberg): only do in test or value context. |
| expr->expression()->RecordToBooleanTypeFeedback(oracle()); |
| } |
| + |
| + switch (expr->op()) { |
| + case Token::NOT: |
| + case Token::DELETE: |
| + MergeLowerType(expr, Type::Boolean()); |
| + MergeUpperType(expr, Type::Boolean()); |
| + break; |
| + case Token::VOID: |
| + MergeLowerType(expr, Type::Undefined()); |
| + MergeUpperType(expr, Type::Undefined()); |
| + break; |
| + case Token::ADD: |
| + case Token::SUB: |
| + MergeLowerType(expr, Type::Smi()); |
| + MergeUpperType(expr, |
| + BoundedType(Type::Number(), expr->expression()->upper_type())); |
| + break; |
| + case Token::BIT_NOT: |
| + MergeLowerType(expr, Type::Smi()); |
| + MergeUpperType(expr, Type::Signed32()); |
| + break; |
| + case Token::TYPEOF: |
| + MergeLowerType(expr, Type::InternalizedString()); |
| + MergeUpperType(expr, Type::InternalizedString()); |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + } |
| } |
| void AstTyper::VisitCountOperation(CountOperation* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->expression())); |
| + RECURSE(Visit(expr->expression())); |
| expr->RecordTypeFeedback(oracle(), zone()); |
| Property* prop = expr->expression()->AsProperty(); |
| if (prop != NULL) { |
| prop->RecordTypeFeedback(oracle(), zone()); |
| } |
| + |
| + if (expr->is_prefix()) { |
|
Jakob Kummerow
2013/06/26 15:09:23
I don't think we need all this logic here. Regardl
rossberg
2013/06/26 16:18:59
Good catch. Done.
|
| + switch (expr->op()) { |
| + case Token::INC: |
| + // No unique lower type (could be Smi or string) |
| + MergeUpperType(expr, AdditionType(expr->expression()->upper_type())); |
| + break; |
| + case Token::DEC: |
| + MergeLowerType(expr, Type::Smi()); |
| + MergeUpperType(expr, Type::Number()); |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + } |
| + } else { |
| + MergeLowerType(expr, expr->expression()->lower_type()); |
| + MergeUpperType(expr, expr->expression()->upper_type()); |
| + } |
| } |
| void AstTyper::VisitBinaryOperation(BinaryOperation* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->left())); |
| - CHECK_ALIVE(Visit(expr->right())); |
| + RECURSE(Visit(expr->left())); |
| + RECURSE(Visit(expr->right())); |
| // Collect type feedback. |
| Handle<Type> type, left_type, right_type; |
| @@ -443,13 +490,55 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) { |
| if (expr->op() == Token::OR || expr->op() == Token::AND) { |
| expr->left()->RecordToBooleanTypeFeedback(oracle()); |
| } |
| + |
| + switch (expr->op()) { |
| + case Token::COMMA: |
| + MergeLowerType(expr, expr->right()->lower_type()); |
| + MergeUpperType(expr, expr->right()->upper_type()); |
| + break; |
| + case Token::OR: |
| + case Token::AND: |
| + // No lower type |
|
Jakob Kummerow
2013/06/26 15:09:23
nit: trailing full stop please.
rossberg
2013/06/26 16:18:59
Comment is obsolete now.
|
| + MergeUpperType(expr, Type::Union( |
| + expr->left()->upper_type(), expr->right()->upper_type())); |
| + break; |
| + case Token::BIT_OR: |
| + case Token::BIT_AND: |
| + MergeLowerType(expr, Type::Smi()); |
| + MergeUpperType(expr, BoundedType(Type::Signed32(), handle(Type::Union( |
| + expr->left()->upper_type(), expr->right()->upper_type()), isolate_))); |
| + break; |
| + case Token::BIT_XOR: |
| + case Token::SHL: |
| + case Token::SHR: |
|
Jakob Kummerow
2013/06/26 15:09:23
I think you're mixing up SHR and SAR here.
rossberg
2013/06/26 16:18:59
Done.
|
| + MergeLowerType(expr, Type::Smi()); |
| + MergeUpperType(expr, Type::Signed32()); |
| + break; |
| + case Token::SAR: |
| + MergeLowerType(expr, Type::Smi()); |
| + MergeUpperType(expr, Type::Unsigned32()); |
| + break; |
| + case Token::ADD: |
| + // No unique lower type (could be Smi or string) |
|
Jakob Kummerow
2013/06/26 15:09:23
nit: trailing full stop please.
rossberg
2013/06/26 16:18:59
Done.
|
| + MergeUpperType(expr, AdditionType(handle(Type::Union( |
| + expr->left()->upper_type(), expr->right()->upper_type()), isolate_))); |
| + break; |
| + case Token::SUB: |
| + case Token::MUL: |
| + case Token::DIV: |
| + case Token::MOD: |
| + MergeLowerType(expr, Type::Smi()); |
| + MergeUpperType(expr, Type::Number()); |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + } |
| } |
| void AstTyper::VisitCompareOperation(CompareOperation* expr) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(expr->left())); |
| - CHECK_ALIVE(Visit(expr->right())); |
| + RECURSE(Visit(expr->left())); |
| + RECURSE(Visit(expr->right())); |
| // Collect type feedback. |
| Handle<Type> left_type, right_type, combined_type; |
| @@ -458,76 +547,67 @@ void AstTyper::VisitCompareOperation(CompareOperation* expr) { |
| MergeLowerType(expr->left(), left_type); |
| MergeLowerType(expr->right(), right_type); |
| expr->set_combined_type(combined_type); |
| + |
| + MergeLowerType(expr, Type::Boolean()); |
| + MergeUpperType(expr, Type::Boolean()); |
| } |
| void AstTyper::VisitThisFunction(ThisFunction* expr) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitDeclarations(ZoneList<Declaration*>* decls) { |
| - ASSERT(!HasStackOverflow()); |
| for (int i = 0; i < decls->length(); ++i) { |
| Declaration* decl = decls->at(i); |
| - CHECK_ALIVE(Visit(decl)); |
| + RECURSE(Visit(decl)); |
| } |
| } |
| void AstTyper::VisitVariableDeclaration(VariableDeclaration* declaration) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitFunctionDeclaration(FunctionDeclaration* declaration) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(declaration->fun())); |
| + RECURSE(Visit(declaration->fun())); |
| } |
| void AstTyper::VisitModuleDeclaration(ModuleDeclaration* declaration) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(declaration->module())); |
| + RECURSE(Visit(declaration->module())); |
| } |
| void AstTyper::VisitImportDeclaration(ImportDeclaration* declaration) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(declaration->module())); |
| + RECURSE(Visit(declaration->module())); |
| } |
| void AstTyper::VisitExportDeclaration(ExportDeclaration* declaration) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitModuleLiteral(ModuleLiteral* module) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(module->body())); |
| + RECURSE(Visit(module->body())); |
| } |
| void AstTyper::VisitModuleVariable(ModuleVariable* module) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitModulePath(ModulePath* module) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(module->module())); |
| + RECURSE(Visit(module->module())); |
| } |
| void AstTyper::VisitModuleUrl(ModuleUrl* module) { |
| - ASSERT(!HasStackOverflow()); |
| } |
| void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { |
| - ASSERT(!HasStackOverflow()); |
| - CHECK_ALIVE(Visit(stmt->body())); |
| + RECURSE(Visit(stmt->body())); |
| } |