1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "src/typing.h"
7 #include "src/frames.h"
8 #include "src/frames-inl.h"
9 #include "src/ostreams.h"
10 #include "src/parser.h" // for CompileTimeValue; TODO(rossberg): should move
11 #include "src/scopes.h"
17 AstTyper::AstTyper(CompilationInfo* info)
19 oracle_(info->isolate(), info->zone(),
20 handle(info->closure()->shared()->code()),
21 handle(info->closure()->shared()->feedback_vector()),
22 handle(info->closure()->context()->native_context())),
23 store_(info->zone()) {
24 InitializeAstVisitor(info->isolate(), info->zone());
28 #define RECURSE(call) \
30 DCHECK(!visitor->HasStackOverflow()); \
32 if (visitor->HasStackOverflow()) return; \
35 void AstTyper::Run(CompilationInfo* info) {
36 AstTyper* visitor = new(info->zone()) AstTyper(info);
37 Scope* scope = info->scope();
39 // Handle implicit declaration of the function name in named function
40 // expressions before other declarations.
41 if (scope->is_function_scope() && scope->function() != NULL) {
42 RECURSE(visitor->VisitVariableDeclaration(scope->function()));
44 RECURSE(visitor->VisitDeclarations(scope->declarations()));
45 RECURSE(visitor->VisitStatements(info->function()->body()));
52 static void PrintObserved(Variable* var, Object* value, Type* type) {
54 os << " observed " << (var->IsParameter() ? "param" : "local") << " ";
55 var->name()->Print(os);
56 os << " : " << Brief(value) << " -> ";
60 #endif // OBJECT_PRINT
63 Effect AstTyper::ObservedOnStack(Object* value) {
64 Type* lower = Type::NowOf(value, zone());
65 return Effect(Bounds(lower, Type::Any(zone())));
69 void AstTyper::ObserveTypesAtOsrEntry(IterationStatement* stmt) {
70 if (stmt->OsrEntryId() != info_->osr_ast_id()) return;
72 DisallowHeapAllocation no_gc;
73 JavaScriptFrameIterator it(isolate());
74 JavaScriptFrame* frame = it.frame();
75 Scope* scope = info_->scope();
77 // Assert that the frame on the stack belongs to the function we want to OSR.
78 DCHECK_EQ(*info_->closure(), frame->function());
80 int params = scope->num_parameters();
81 int locals = scope->StackLocalCount();
83 // Use sequential composition to achieve desired narrowing.
84 // The receiver is a parameter with index -1.
85 store_.Seq(parameter_index(-1), ObservedOnStack(frame->receiver()));
86 for (int i = 0; i < params; i++) {
87 store_.Seq(parameter_index(i), ObservedOnStack(frame->GetParameter(i)));
90 for (int i = 0; i < locals; i++) {
91 store_.Seq(stack_local_index(i), ObservedOnStack(frame->GetExpression(i)));
95 if (FLAG_trace_osr && FLAG_print_scopes) {
96 PrintObserved(scope->receiver(),
98 store_.LookupBounds(parameter_index(-1)).lower);
100 for (int i = 0; i < params; i++) {
101 PrintObserved(scope->parameter(i),
102 frame->GetParameter(i),
103 store_.LookupBounds(parameter_index(i)).lower);
106 ZoneList<Variable*> local_vars(locals, zone());
107 ZoneList<Variable*> context_vars(scope->ContextLocalCount(), zone());
108 scope->CollectStackAndContextLocals(&local_vars, &context_vars);
109 for (int i = 0; i < locals; i++) {
110 PrintObserved(local_vars.at(i),
111 frame->GetExpression(i),
112 store_.LookupBounds(stack_local_index(i)).lower);
115 #endif // OBJECT_PRINT
119 #define RECURSE(call) \
121 DCHECK(!HasStackOverflow()); \
123 if (HasStackOverflow()) return; \
127 void AstTyper::VisitStatements(ZoneList<Statement*>* stmts) {
128 for (int i = 0; i < stmts->length(); ++i) {
129 Statement* stmt = stmts->at(i);
130 RECURSE(Visit(stmt));
131 if (stmt->IsJump()) break;
136 void AstTyper::VisitBlock(Block* stmt) {
137 RECURSE(VisitStatements(stmt->statements()));
138 if (stmt->labels() != NULL) {
139 store_.Forget(); // Control may transfer here via 'break l'.
144 void AstTyper::VisitExpressionStatement(ExpressionStatement* stmt) {
145 RECURSE(Visit(stmt->expression()));
149 void AstTyper::VisitEmptyStatement(EmptyStatement* stmt) {
153 void AstTyper::VisitIfStatement(IfStatement* stmt) {
154 // Collect type feedback.
155 if (!stmt->condition()->ToBooleanIsTrue() &&
156 !stmt->condition()->ToBooleanIsFalse()) {
157 stmt->condition()->RecordToBooleanTypeFeedback(oracle());
160 RECURSE(Visit(stmt->condition()));
161 Effects then_effects = EnterEffects();
162 RECURSE(Visit(stmt->then_statement()));
164 Effects else_effects = EnterEffects();
165 RECURSE(Visit(stmt->else_statement()));
167 then_effects.Alt(else_effects);
168 store_.Seq(then_effects);
172 void AstTyper::VisitContinueStatement(ContinueStatement* stmt) {
173 // TODO(rossberg): is it worth having a non-termination effect?
177 void AstTyper::VisitBreakStatement(BreakStatement* stmt) {
178 // TODO(rossberg): is it worth having a non-termination effect?
182 void AstTyper::VisitReturnStatement(ReturnStatement* stmt) {
183 // Collect type feedback.
184 // TODO(rossberg): we only need this for inlining into test contexts...
185 stmt->expression()->RecordToBooleanTypeFeedback(oracle());
187 RECURSE(Visit(stmt->expression()));
188 // TODO(rossberg): is it worth having a non-termination effect?
192 void AstTyper::VisitWithStatement(WithStatement* stmt) {
193 RECURSE(stmt->expression());
194 RECURSE(stmt->statement());
198 void AstTyper::VisitSwitchStatement(SwitchStatement* stmt) {
199 RECURSE(Visit(stmt->tag()));
201 ZoneList<CaseClause*>* clauses = stmt->cases();
202 Effects local_effects(zone());
203 bool complex_effects = false; // True for label effects or fall-through.
205 for (int i = 0; i < clauses->length(); ++i) {
206 CaseClause* clause = clauses->at(i);
208 Effects clause_effects = EnterEffects();
210 if (!clause->is_default()) {
211 Expression* label = clause->label();
212 // Collect type feedback.
216 oracle()->CompareType(clause->CompareId(),
217 &tag_type, &label_type, &combined_type);
218 NarrowLowerType(stmt->tag(), tag_type);
219 NarrowLowerType(label, label_type);
220 clause->set_compare_type(combined_type);
222 RECURSE(Visit(label));
223 if (!clause_effects.IsEmpty()) complex_effects = true;
226 ZoneList<Statement*>* stmts = clause->statements();
227 RECURSE(VisitStatements(stmts));
229 if (stmts->is_empty() || stmts->last()->IsJump()) {
230 local_effects.Alt(clause_effects);
232 complex_effects = true;
236 if (complex_effects) {
237 store_.Forget(); // Reached this in unknown state.
239 store_.Seq(local_effects);
244 void AstTyper::VisitCaseClause(CaseClause* clause) {
249 void AstTyper::VisitDoWhileStatement(DoWhileStatement* stmt) {
250 // Collect type feedback.
251 if (!stmt->cond()->ToBooleanIsTrue()) {
252 stmt->cond()->RecordToBooleanTypeFeedback(oracle());
255 // TODO(rossberg): refine the unconditional Forget (here and elsewhere) by
256 // computing the set of variables assigned in only some of the origins of the
257 // control transfer (such as the loop body here).
258 store_.Forget(); // Control may transfer here via looping or 'continue'.
259 ObserveTypesAtOsrEntry(stmt);
260 RECURSE(Visit(stmt->body()));
261 RECURSE(Visit(stmt->cond()));
262 store_.Forget(); // Control may transfer here via 'break'.
266 void AstTyper::VisitWhileStatement(WhileStatement* stmt) {
267 // Collect type feedback.
268 if (!stmt->cond()->ToBooleanIsTrue()) {
269 stmt->cond()->RecordToBooleanTypeFeedback(oracle());
272 store_.Forget(); // Control may transfer here via looping or 'continue'.
273 RECURSE(Visit(stmt->cond()));
274 ObserveTypesAtOsrEntry(stmt);
275 RECURSE(Visit(stmt->body()));
276 store_.Forget(); // Control may transfer here via termination or 'break'.
280 void AstTyper::VisitForStatement(ForStatement* stmt) {
281 if (stmt->init() != NULL) {
282 RECURSE(Visit(stmt->init()));
284 store_.Forget(); // Control may transfer here via looping.
285 if (stmt->cond() != NULL) {
286 // Collect type feedback.
287 stmt->cond()->RecordToBooleanTypeFeedback(oracle());
289 RECURSE(Visit(stmt->cond()));
291 ObserveTypesAtOsrEntry(stmt);
292 RECURSE(Visit(stmt->body()));
293 if (stmt->next() != NULL) {
294 store_.Forget(); // Control may transfer here via 'continue'.
295 RECURSE(Visit(stmt->next()));
297 store_.Forget(); // Control may transfer here via termination or 'break'.
301 void AstTyper::VisitForInStatement(ForInStatement* stmt) {
302 // Collect type feedback.
303 stmt->set_for_in_type(static_cast<ForInStatement::ForInType>(
304 oracle()->ForInType(stmt->ForInFeedbackSlot())));
306 RECURSE(Visit(stmt->enumerable()));
307 store_.Forget(); // Control may transfer here via looping or 'continue'.
308 ObserveTypesAtOsrEntry(stmt);
309 RECURSE(Visit(stmt->body()));
310 store_.Forget(); // Control may transfer here via 'break'.
314 void AstTyper::VisitForOfStatement(ForOfStatement* stmt) {
315 RECURSE(Visit(stmt->iterable()));
316 store_.Forget(); // Control may transfer here via looping or 'continue'.
317 RECURSE(Visit(stmt->body()));
318 store_.Forget(); // Control may transfer here via 'break'.
322 void AstTyper::VisitTryCatchStatement(TryCatchStatement* stmt) {
323 Effects try_effects = EnterEffects();
324 RECURSE(Visit(stmt->try_block()));
326 Effects catch_effects = EnterEffects();
327 store_.Forget(); // Control may transfer here via 'throw'.
328 RECURSE(Visit(stmt->catch_block()));
330 try_effects.Alt(catch_effects);
331 store_.Seq(try_effects);
332 // At this point, only variables that were reassigned in the catch block are
337 void AstTyper::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
338 RECURSE(Visit(stmt->try_block()));
339 store_.Forget(); // Control may transfer here via 'throw'.
340 RECURSE(Visit(stmt->finally_block()));
344 void AstTyper::VisitDebuggerStatement(DebuggerStatement* stmt) {
345 store_.Forget(); // May do whatever.
349 void AstTyper::VisitFunctionLiteral(FunctionLiteral* expr) {
350 expr->InitializeSharedInfo(Handle<Code>(info_->closure()->shared()->code()));
354 void AstTyper::VisitClassLiteral(ClassLiteral* expr) {}
357 void AstTyper::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) {
361 void AstTyper::VisitConditional(Conditional* expr) {
362 // Collect type feedback.
363 expr->condition()->RecordToBooleanTypeFeedback(oracle());
365 RECURSE(Visit(expr->condition()));
366 Effects then_effects = EnterEffects();
367 RECURSE(Visit(expr->then_expression()));
369 Effects else_effects = EnterEffects();
370 RECURSE(Visit(expr->else_expression()));
372 then_effects.Alt(else_effects);
373 store_.Seq(then_effects);
375 NarrowType(expr, Bounds::Either(
376 expr->then_expression()->bounds(),
377 expr->else_expression()->bounds(), zone()));
381 void AstTyper::VisitVariableProxy(VariableProxy* expr) {
382 Variable* var = expr->var();
383 if (var->IsStackAllocated()) {
384 NarrowType(expr, store_.LookupBounds(variable_index(var)));
389 void AstTyper::VisitLiteral(Literal* expr) {
390 Type* type = Type::Constant(expr->value(), zone());
391 NarrowType(expr, Bounds(type));
395 void AstTyper::VisitRegExpLiteral(RegExpLiteral* expr) {
396 // TODO(rossberg): Reintroduce RegExp type.
397 NarrowType(expr, Bounds(Type::Object(zone())));
401 void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) {
402 ZoneList<ObjectLiteral::Property*>* properties = expr->properties();
403 for (int i = 0; i < properties->length(); ++i) {
404 ObjectLiteral::Property* prop = properties->at(i);
406 // Collect type feedback.
407 if ((prop->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL &&
408 !CompileTimeValue::IsCompileTimeValue(prop->value())) ||
409 prop->kind() == ObjectLiteral::Property::COMPUTED) {
410 if (!prop->is_computed_name() &&
411 prop->key()->AsLiteral()->value()->IsInternalizedString() &&
412 prop->emit_store()) {
413 prop->RecordTypeFeedback(oracle());
417 RECURSE(Visit(prop->value()));
420 NarrowType(expr, Bounds(Type::Object(zone())));
424 void AstTyper::VisitArrayLiteral(ArrayLiteral* expr) {
425 ZoneList<Expression*>* values = expr->values();
426 for (int i = 0; i < values->length(); ++i) {
427 Expression* value = values->at(i);
428 RECURSE(Visit(value));
431 NarrowType(expr, Bounds(Type::Array(zone())));
435 void AstTyper::VisitAssignment(Assignment* expr) {
436 // Collect type feedback.
437 Property* prop = expr->target()->AsProperty();
439 TypeFeedbackId id = expr->AssignmentFeedbackId();
440 expr->set_is_uninitialized(oracle()->StoreIsUninitialized(id));
441 if (!expr->IsUninitialized()) {
442 if (prop->key()->IsPropertyName()) {
443 Literal* lit_key = prop->key()->AsLiteral();
444 DCHECK(lit_key != NULL && lit_key->value()->IsString());
445 Handle<String> name = Handle<String>::cast(lit_key->value());
446 oracle()->AssignmentReceiverTypes(id, name, expr->GetReceiverTypes());
448 KeyedAccessStoreMode store_mode;
449 IcCheckType key_type;
450 oracle()->KeyedAssignmentReceiverTypes(id, expr->GetReceiverTypes(),
451 &store_mode, &key_type);
452 expr->set_store_mode(store_mode);
453 expr->set_key_type(key_type);
459 expr->is_compound() ? expr->binary_operation() : expr->value();
460 RECURSE(Visit(expr->target()));
462 NarrowType(expr, rhs->bounds());
464 VariableProxy* proxy = expr->target()->AsVariableProxy();
465 if (proxy != NULL && proxy->var()->IsStackAllocated()) {
466 store_.Seq(variable_index(proxy->var()), Effect(expr->bounds()));
471 void AstTyper::VisitYield(Yield* expr) {
472 RECURSE(Visit(expr->generator_object()));
473 RECURSE(Visit(expr->expression()));
475 // We don't know anything about the result type.
479 void AstTyper::VisitThrow(Throw* expr) {
480 RECURSE(Visit(expr->exception()));
481 // TODO(rossberg): is it worth having a non-termination effect?
483 NarrowType(expr, Bounds(Type::None(zone())));
487 void AstTyper::VisitProperty(Property* expr) {
488 // Collect type feedback.
489 FeedbackVectorICSlot slot(FeedbackVectorICSlot::Invalid());
490 TypeFeedbackId id(TypeFeedbackId::None());
491 if (FLAG_vector_ics) {
492 slot = expr->PropertyFeedbackSlot();
493 expr->set_is_uninitialized(oracle()->LoadIsUninitialized(slot));
495 id = expr->PropertyFeedbackId();
496 expr->set_is_uninitialized(oracle()->LoadIsUninitialized(id));
499 if (!expr->IsUninitialized()) {
500 if (expr->key()->IsPropertyName()) {
501 Literal* lit_key = expr->key()->AsLiteral();
502 DCHECK(lit_key != NULL && lit_key->value()->IsString());
503 Handle<String> name = Handle<String>::cast(lit_key->value());
504 if (FLAG_vector_ics) {
505 oracle()->PropertyReceiverTypes(slot, name, expr->GetReceiverTypes());
507 oracle()->PropertyReceiverTypes(id, name, expr->GetReceiverTypes());
511 IcCheckType key_type;
512 if (FLAG_vector_ics) {
513 oracle()->KeyedPropertyReceiverTypes(slot, expr->GetReceiverTypes(),
514 &is_string, &key_type);
516 oracle()->KeyedPropertyReceiverTypes(id, expr->GetReceiverTypes(),
517 &is_string, &key_type);
519 expr->set_is_string_access(is_string);
520 expr->set_key_type(key_type);
524 RECURSE(Visit(expr->obj()));
525 RECURSE(Visit(expr->key()));
527 // We don't know anything about the result type.
531 void AstTyper::VisitCall(Call* expr) {
532 // Collect type feedback.
533 RECURSE(Visit(expr->expression()));
534 bool is_uninitialized = true;
535 if (expr->IsUsingCallFeedbackICSlot(isolate())) {
536 FeedbackVectorICSlot slot = expr->CallFeedbackICSlot();
537 is_uninitialized = oracle()->CallIsUninitialized(slot);
538 if (!expr->expression()->IsProperty() &&
539 oracle()->CallIsMonomorphic(slot)) {
540 expr->set_target(oracle()->GetCallTarget(slot));
541 Handle<AllocationSite> site = oracle()->GetCallAllocationSite(slot);
542 expr->set_allocation_site(site);
546 expr->set_is_uninitialized(is_uninitialized);
548 ZoneList<Expression*>* args = expr->arguments();
549 for (int i = 0; i < args->length(); ++i) {
550 Expression* arg = args->at(i);
554 VariableProxy* proxy = expr->expression()->AsVariableProxy();
555 if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) {
556 store_.Forget(); // Eval could do whatever to local variables.
559 // We don't know anything about the result type.
563 void AstTyper::VisitCallNew(CallNew* expr) {
564 // Collect type feedback.
565 expr->RecordTypeFeedback(oracle());
567 RECURSE(Visit(expr->expression()));
568 ZoneList<Expression*>* args = expr->arguments();
569 for (int i = 0; i < args->length(); ++i) {
570 Expression* arg = args->at(i);
574 NarrowType(expr, Bounds(Type::None(zone()), Type::Receiver(zone())));
578 void AstTyper::VisitCallRuntime(CallRuntime* expr) {
579 ZoneList<Expression*>* args = expr->arguments();
580 for (int i = 0; i < args->length(); ++i) {
581 Expression* arg = args->at(i);
585 // We don't know anything about the result type.
589 void AstTyper::VisitUnaryOperation(UnaryOperation* expr) {
590 // Collect type feedback.
591 if (expr->op() == Token::NOT) {
592 // TODO(rossberg): only do in test or value context.
593 expr->expression()->RecordToBooleanTypeFeedback(oracle());
596 RECURSE(Visit(expr->expression()));
598 switch (expr->op()) {
601 NarrowType(expr, Bounds(Type::Boolean(zone())));
604 NarrowType(expr, Bounds(Type::Undefined(zone())));
607 NarrowType(expr, Bounds(Type::InternalizedString(zone())));
615 void AstTyper::VisitCountOperation(CountOperation* expr) {
616 // Collect type feedback.
617 TypeFeedbackId store_id = expr->CountStoreFeedbackId();
618 KeyedAccessStoreMode store_mode;
619 IcCheckType key_type;
620 oracle()->GetStoreModeAndKeyType(store_id, &store_mode, &key_type);
621 expr->set_store_mode(store_mode);
622 expr->set_key_type(key_type);
623 oracle()->CountReceiverTypes(store_id, expr->GetReceiverTypes());
624 expr->set_type(oracle()->CountType(expr->CountBinOpFeedbackId()));
625 // TODO(rossberg): merge the count type with the generic expression type.
627 RECURSE(Visit(expr->expression()));
629 NarrowType(expr, Bounds(Type::SignedSmall(zone()), Type::Number(zone())));
631 VariableProxy* proxy = expr->expression()->AsVariableProxy();
632 if (proxy != NULL && proxy->var()->IsStackAllocated()) {
633 store_.Seq(variable_index(proxy->var()), Effect(expr->bounds()));
638 void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
639 // Collect type feedback.
643 Maybe<int> fixed_right_arg;
644 Handle<AllocationSite> allocation_site;
645 oracle()->BinaryType(expr->BinaryOperationFeedbackId(),
646 &left_type, &right_type, &type, &fixed_right_arg,
647 &allocation_site, expr->op());
648 NarrowLowerType(expr, type);
649 NarrowLowerType(expr->left(), left_type);
650 NarrowLowerType(expr->right(), right_type);
651 expr->set_allocation_site(allocation_site);
652 expr->set_fixed_right_arg(fixed_right_arg);
653 if (expr->op() == Token::OR || expr->op() == Token::AND) {
654 expr->left()->RecordToBooleanTypeFeedback(oracle());
657 switch (expr->op()) {
659 RECURSE(Visit(expr->left()));
660 RECURSE(Visit(expr->right()));
661 NarrowType(expr, expr->right()->bounds());
665 Effects left_effects = EnterEffects();
666 RECURSE(Visit(expr->left()));
668 Effects right_effects = EnterEffects();
669 RECURSE(Visit(expr->right()));
671 left_effects.Alt(right_effects);
672 store_.Seq(left_effects);
674 NarrowType(expr, Bounds::Either(
675 expr->left()->bounds(), expr->right()->bounds(), zone()));
679 case Token::BIT_AND: {
680 RECURSE(Visit(expr->left()));
681 RECURSE(Visit(expr->right()));
682 Type* upper = Type::Union(
683 expr->left()->bounds().upper, expr->right()->bounds().upper, zone());
684 if (!upper->Is(Type::Signed32())) upper = Type::Signed32(zone());
685 Type* lower = Type::Intersect(Type::SignedSmall(zone()), upper, zone());
686 NarrowType(expr, Bounds(lower, upper));
692 RECURSE(Visit(expr->left()));
693 RECURSE(Visit(expr->right()));
695 Bounds(Type::SignedSmall(zone()), Type::Signed32(zone())));
698 RECURSE(Visit(expr->left()));
699 RECURSE(Visit(expr->right()));
700 // TODO(rossberg): The upper bound would be Unsigned32, but since there
701 // is no 'positive Smi' type for the lower bound, we use the smallest
702 // union of Smi and Unsigned32 as upper bound instead.
703 NarrowType(expr, Bounds(Type::SignedSmall(zone()), Type::Number(zone())));
706 RECURSE(Visit(expr->left()));
707 RECURSE(Visit(expr->right()));
708 Bounds l = expr->left()->bounds();
709 Bounds r = expr->right()->bounds();
711 !l.lower->IsInhabited() || !r.lower->IsInhabited() ?
713 l.lower->Is(Type::String()) || r.lower->Is(Type::String()) ?
714 Type::String(zone()) :
715 l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ?
716 Type::SignedSmall(zone()) : Type::None(zone());
718 l.upper->Is(Type::String()) || r.upper->Is(Type::String()) ?
719 Type::String(zone()) :
720 l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ?
721 Type::Number(zone()) : Type::NumberOrString(zone());
722 NarrowType(expr, Bounds(lower, upper));
729 RECURSE(Visit(expr->left()));
730 RECURSE(Visit(expr->right()));
731 NarrowType(expr, Bounds(Type::SignedSmall(zone()), Type::Number(zone())));
739 void AstTyper::VisitCompareOperation(CompareOperation* expr) {
740 // Collect type feedback.
744 oracle()->CompareType(expr->CompareOperationFeedbackId(),
745 &left_type, &right_type, &combined_type);
746 NarrowLowerType(expr->left(), left_type);
747 NarrowLowerType(expr->right(), right_type);
748 expr->set_combined_type(combined_type);
750 RECURSE(Visit(expr->left()));
751 RECURSE(Visit(expr->right()));
753 NarrowType(expr, Bounds(Type::Boolean(zone())));
757 void AstTyper::VisitThisFunction(ThisFunction* expr) {
761 void AstTyper::VisitSuperReference(SuperReference* expr) {}
764 void AstTyper::VisitDeclarations(ZoneList<Declaration*>* decls) {
765 for (int i = 0; i < decls->length(); ++i) {
766 Declaration* decl = decls->at(i);
767 RECURSE(Visit(decl));
772 void AstTyper::VisitVariableDeclaration(VariableDeclaration* declaration) {
776 void AstTyper::VisitFunctionDeclaration(FunctionDeclaration* declaration) {
777 RECURSE(Visit(declaration->fun()));
781 void AstTyper::VisitModuleDeclaration(ModuleDeclaration* declaration) {
782 RECURSE(Visit(declaration->module()));
786 void AstTyper::VisitImportDeclaration(ImportDeclaration* declaration) {
787 RECURSE(Visit(declaration->module()));
791 void AstTyper::VisitExportDeclaration(ExportDeclaration* declaration) {
795 void AstTyper::VisitModuleLiteral(ModuleLiteral* module) {
796 RECURSE(Visit(module->body()));
800 void AstTyper::VisitModulePath(ModulePath* module) {
801 RECURSE(Visit(module->module()));
805 void AstTyper::VisitModuleUrl(ModuleUrl* module) {
809 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) {
810 RECURSE(Visit(stmt->body()));
814 } } // namespace v8::internal