From 30af089bc568f4dc831e2c158cbf885dbfb392cc Mon Sep 17 00:00:00 2001 From: "kmillikin@chromium.org" Date: Thu, 12 Mar 2009 19:49:19 +0000 Subject: [PATCH] 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 --- src/codegen-ia32.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/codegen-ia32.cc b/src/codegen-ia32.cc index 94969dd..fee17e3 100644 --- a/src/codegen-ia32.cc +++ b/src/codegen-ia32.cc @@ -2231,7 +2231,8 @@ void CodeGenerator::VisitLoopStatement(LoopStatement* node) { // Do not duplicate conditions with function literal // subexpressions. This can cause us to compile the function // literal twice. - bool test_at_bottom = !node->has_function_literal(); + bool test_at_bottom = + !scope_->is_global_scope() && !node->has_function_literal(); IncrementLoopNesting(); @@ -2329,7 +2330,8 @@ void CodeGenerator::VisitLoopStatement(LoopStatement* node) { // Do not duplicate conditions with function literal // subexpressions. This can cause us to compile the function // 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. if (node->init() != NULL) { -- 2.7.4