While the class Type objects the AstTyper generates should be
allocated to zone memory, there's no particular reason
the typer object itself needs to be.
BUG=None
TEST=None
R=rossberg@chromium.org,titzer@chromium.org
LOG=N
Review URL: https://codereview.chromium.org/
1303843003
Cr-Commit-Position: refs/heads/master@{#30313}
}
// Type-check the function.
- AstTyper::Run(info());
+ AstTyper(info()).Run();
// Optimization could have been disabled by the parser. Note that this check
// is only needed because the Hydrogen graph builder is missing some bailouts.
// Type-check the inlined function.
DCHECK(target_shared->has_deoptimization_support());
- AstTyper::Run(&target_info);
+ AstTyper(&target_info).Run();
int inlining_id = 0;
if (top_info()->is_tracking_positions()) {
}
-#define RECURSE(call) \
- do { \
- DCHECK(!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();
-
- RECURSE(visitor->VisitDeclarations(scope->declarations()));
- RECURSE(visitor->VisitStatements(info->literal()->body()));
-}
-
-#undef RECURSE
-
-
#ifdef OBJECT_PRINT
static void PrintObserved(Variable* var, Object* value, Type* type) {
OFStream os(stdout);
} while (false)
+void AstTyper::Run() {
+ Scope* scope = info_->scope();
+ RECURSE(VisitDeclarations(scope->declarations()));
+ RECURSE(VisitStatements(info_->literal()->body()));
+}
+
+
void AstTyper::VisitStatements(ZoneList<Statement*>* stmts) {
for (int i = 0; i < stmts->length(); ++i) {
Statement* stmt = stmts->at(i);
class AstTyper: public AstVisitor {
public:
- static void Run(CompilationInfo* info);
-
- void* operator new(size_t size, Zone* zone) { return zone->New(size); }
- void operator delete(void* pointer, Zone* zone) { }
- void operator delete(void* pointer) { }
+ explicit AstTyper(CompilationInfo* info);
+ void Run();
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
private:
- explicit AstTyper(CompilationInfo* info);
-
Effect ObservedOnStack(Object* value);
void ObserveTypesAtOsrEntry(IterationStatement* stmt);