LGTM. On Wed, Nov 5, 2008 at 9:03 PM, <[EMAIL PROTECTED]> wrote: > Reviewers: Kasper Lund, > > Description: > Handle stack overflow errors correctly when rewriting the AST > for likely Smis. > > > Please review this at http://codereview.chromium.org/9429 > > SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ > > Affected files: > M src/compiler.cc > M src/rewriter.h > M src/rewriter.cc > > > Index: src/compiler.cc > =================================================================== > --- src/compiler.cc (revision 700) > +++ src/compiler.cc (working copy) > @@ -66,7 +66,11 @@ > #endif > > // Optimize the AST. > - Rewriter::Optimize(literal); > + if (!Rewriter::Optimize(literal)) { > + // Signal a stack overflow by returning a null handle. The stack > + // overflow exception will be thrown by the caller. > + return Handle<Code>::null(); > + } > > // Generate code and return it. > Handle<Code> result = CodeGenerator::MakeCode(literal, script, is_eval); > Index: src/rewriter.cc > =================================================================== > --- src/rewriter.cc (revision 700) > +++ src/rewriter.cc (working copy) > @@ -761,17 +761,20 @@ > } > > > -void Rewriter::Optimize(FunctionLiteral* function) { > +bool Rewriter::Optimize(FunctionLiteral* function) { > ZoneList<Statement*>* body = function->body(); > - if (body->is_empty()) return; > > - if (FLAG_optimize_ast) { > + if (FLAG_optimize_ast && !body->is_empty()) { > Scope* scope = function->scope(); > if (!scope->is_global_scope()) { > AstOptimizer optimizer; > optimizer.Optimize(body); > + if (optimizer.HasStackOverflow()) { > + return false; > + } > } > } > + return true; > } > > > Index: src/rewriter.h > =================================================================== > --- src/rewriter.h (revision 700) > +++ src/rewriter.h (working copy) > @@ -44,7 +44,7 @@ > class Rewriter { > public: > static bool Process(FunctionLiteral* function); > - static void Optimize(FunctionLiteral* function); > + static bool Optimize(FunctionLiteral* function); > }; > > > > >
--~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
