Author: [email protected]
Date: Tue Mar 24 07:25:22 2009
New Revision: 1600
Modified:
branches/bleeding_edge/src/ast.h
branches/bleeding_edge/src/codegen-ia32.cc
branches/bleeding_edge/src/rewriter.cc
Log:
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.
Review URL: http://codereview.chromium.org/42562
Modified: branches/bleeding_edge/src/ast.h
==============================================================================
--- branches/bleeding_edge/src/ast.h (original)
+++ branches/bleeding_edge/src/ast.h Tue Mar 24 07:25:22 2009
@@ -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;
};
Modified: branches/bleeding_edge/src/codegen-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-ia32.cc (original)
+++ branches/bleeding_edge/src/codegen-ia32.cc Tue Mar 24 07:25:22 2009
@@ -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) {
Modified: branches/bleeding_edge/src/rewriter.cc
==============================================================================
--- branches/bleeding_edge/src/rewriter.cc (original)
+++ branches/bleeding_edge/src/rewriter.cc Tue Mar 24 07:25:22 2009
@@ -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());
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---