LGTM. On Tue, Mar 24, 2009 at 3:22 PM, <[email protected]> wrote: > Reviewers: Kasper Lund, > > Description: > Make the "has function literal" default value for loops conservative. > It defaults to true so that if the analysis is not run we get a safe > analysis result. > > > Please review this at http://codereview.chromium.org/42562 > > SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ > > Affected files: > M src/ast.h > M src/codegen-ia32.cc > M src/rewriter.cc > > > Index: src/ast.h > =================================================================== > --- src/ast.h (revision 1599) > +++ src/ast.h (working copy) > @@ -296,7 +296,7 @@ > init_(NULL), > cond_(NULL), > next_(NULL), > - has_function_literal_(false) { > + may_have_function_literal_(true) { > } > > void Initialize(Statement* init, > @@ -317,7 +317,9 @@ > Statement* init() const { return init_; } > Expression* cond() const { return cond_; } > Statement* next() const { return next_; } > - bool has_function_literal() const { return has_function_literal_; } > + bool may_have_function_literal() const { > + return may_have_function_literal_; > + } > > #ifdef DEBUG > const char* OperatorString() const; > @@ -329,7 +331,7 @@ > Expression* cond_; > Statement* next_; > // True if there is a function literal subexpression in the condition. > - bool has_function_literal_; > + bool may_have_function_literal_; > > friend class AstOptimizer; > }; > Index: src/rewriter.cc > =================================================================== > --- src/rewriter.cc (revision 1599) > +++ src/rewriter.cc (working copy) > @@ -100,7 +100,7 @@ > if (node->cond() != NULL) { > has_function_literal_ = false; > Visit(node->cond()); > - node->has_function_literal_ = has_function_literal_; > + node->may_have_function_literal_ = has_function_literal_; > } > if (node->body() != NULL) { > Visit(node->body()); > Index: src/codegen-ia32.cc > =================================================================== > --- src/codegen-ia32.cc (revision 1599) > +++ src/codegen-ia32.cc (working copy) > @@ -2261,11 +2261,10 @@ > } > > case LoopStatement::WHILE_LOOP: { > - // Do not duplicate conditions with function literal > + // Do not duplicate conditions that may have function literal > // subexpressions. This can cause us to compile the function > // literal twice. > - bool test_at_bottom = > - !scope_->is_global_scope() && !node->has_function_literal(); > + bool test_at_bottom = !node->may_have_function_literal(); > > IncrementLoopNesting(); > > @@ -2360,11 +2359,10 @@ > } > > case LoopStatement::FOR_LOOP: { > - // Do not duplicate conditions with function literal > + // Do not duplicate conditions that may have function literal > // subexpressions. This can cause us to compile the function > // literal twice. > - bool test_at_bottom = > - !scope_->is_global_scope() && !node->has_function_literal(); > + bool test_at_bottom = !node->may_have_function_literal(); > > // Compile the init expression if present. > if (node->init() != NULL) { > > >
--~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
