Fix a test in the IA32 code generator for whether loop conditions

contain function literals.  The test was not conservative enough.

Review URL: http://codereview.chromium.org/42138

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1504 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 03d7c6bd
...@@ -2231,7 +2231,8 @@ void CodeGenerator::VisitLoopStatement(LoopStatement* node) { ...@@ -2231,7 +2231,8 @@ void CodeGenerator::VisitLoopStatement(LoopStatement* node) {
// Do not duplicate conditions with function literal // Do not duplicate conditions with function literal
// subexpressions. This can cause us to compile the function // subexpressions. This can cause us to compile the function
// literal twice. // literal twice.
bool test_at_bottom = !node->has_function_literal(); bool test_at_bottom =
!scope_->is_global_scope() && !node->has_function_literal();
IncrementLoopNesting(); IncrementLoopNesting();
...@@ -2329,7 +2330,8 @@ void CodeGenerator::VisitLoopStatement(LoopStatement* node) { ...@@ -2329,7 +2330,8 @@ void CodeGenerator::VisitLoopStatement(LoopStatement* node) {
// Do not duplicate conditions with function literal // Do not duplicate conditions with function literal
// subexpressions. This can cause us to compile the function // subexpressions. This can cause us to compile the function
// literal twice. // literal twice.
bool test_at_bottom = !node->has_function_literal(); bool test_at_bottom =
!scope_->is_global_scope() && !node->has_function_literal();
// Compile the init expression if present. // Compile the init expression if present.
if (node->init() != NULL) { if (node->init() != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment