New approach, please take another look.

Please disregard the delta from the first patch set, as this is pretty much a
complete rewrite (and rebased onto current bleeding_edge).

The patch is pretty big, but most of it is just refactoring:
• AstNodes' ctors in ast.h have been moved to the "protected" section of the
respective class, to make sure they're only used by the factory.
• The methods in AstNodeFactory are, as factory methods tend to be, very similar
to the ctors they're calling; plus some housekeeping, and with implicit
isolate/zone parameters.
• parser.cc, scopes.cc, and rewriter.cc use the new factory methods instead of
calling AstNode ctors directly.

Rationale for this approach:
A visitor is probably the cleanest way to compute information about a tree/AST, but walking the tree at an arbitrary time is relatively expensive, so we do the
work at tree construction time.

Object ownership is a bit tricky, because:
• AstProperties is a zone object and lives as long as the AST nodes do
• AstConstructionVisitor is BASE_EMBEDDED, so its lifetime must be tied to some
other C++ object that owns it
• AstNodeFactory can live anywhere in the C++ world; I could have it live in a
CompilationInfo if someone thinks that would be better.

I'm open to suggestions on how to make this even cleaner, but I also think we
can live with it as it is.

Computation of the kDontSoftInline flag is not yet included, but can easily be
added to the AstConstructionVisitor.

https://chromiumcodereview.appspot.com/9221011/

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to