Reviewers: rossberg, titzer,

Description:
Don't allocate AstTyper with the zone allocator.

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
[email protected],[email protected]
LOG=N

Please review this at https://codereview.chromium.org/1303843003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+11, -27 lines):
  M src/compiler.cc
  M src/hydrogen.cc
  M src/typing.h
  M src/typing.cc


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index c39936cc254b531c891beb50a23cb7afdfda9333..0b7823b53bd435121cf5aa648a29339e87dd4c5f 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -468,7 +468,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
   }

   // 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.
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 8c59ce86c9fe11f4c8ed1cfb76a8ed69cfcd3f2f..e7c3ef0d1869c967e16c9f6b2bffaf8788c00a95 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -8335,7 +8335,7 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,

   // 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()) {
Index: src/typing.cc
diff --git a/src/typing.cc b/src/typing.cc
index 204ace6c9688e0bff9089ad16c462d95018c3393..22e4b219d9d05ffdacfba20d3278f8b852326465 100644
--- a/src/typing.cc
+++ b/src/typing.cc
@@ -26,24 +26,6 @@ AstTyper::AstTyper(CompilationInfo* info)
 }


-#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);
@@ -122,6 +104,13 @@ void AstTyper::ObserveTypesAtOsrEntry(IterationStatement* stmt) {
   } 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);
Index: src/typing.h
diff --git a/src/typing.h b/src/typing.h
index f3ead18f99646fa79febb4e5de88db5413e02daf..ccfb973437faa6f672ac1f1f0ffb29f895aa7516 100644
--- a/src/typing.h
+++ b/src/typing.h
@@ -19,17 +19,12 @@ namespace internal {

 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);



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to