Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index e4864e48015df3ef51186b5f814920b6d5364518..88f2d6befb3eea622b9c290346b7a821e2625c0a 100755 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -665,6 +665,14 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, |
if (!MakeCrankshaftCode(&info)) { |
return Handle<SharedFunctionInfo>::null(); |
} |
+ if (FLAG_optimize_closures |
+ && !AlwaysFullCompiler() |
+ && !info.scope()->HasTrivialOuterContext() |
+ && !info.scope()->outer_scope_calls_eval() |
+ && !info.scope()->inside_with()) { |
+ ASSERT(info.code()->kind() == Code::FUNCTION); |
+ info.code()->set_optimizable(true); |
+ } |
} else { |
// The bodies of function literals have not yet been visited by the |
// AST optimizer/analyzer. |