Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 1cdce60874abfe6671852f1c725202a7f27efc61..a42fdada79e4d9aac3eefb6e1ea936883039d6d9 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1366,11 +1366,6 @@ Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { |
} |
-static bool ShouldOptimizeNewClosure(Handle<SharedFunctionInfo> info) { |
- return !info->is_toplevel() && info->allows_lazy_compilation(); |
-} |
- |
- |
Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
Handle<SharedFunctionInfo> info, |
Handle<Context> context, |
@@ -1384,6 +1379,10 @@ Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
info->ResetForNewContext(isolate()->heap()->global_ic_age()); |
} |
+ if (FLAG_always_opt && info->allows_lazy_compilation()) { |
+ result->MarkForOptimization(); |
+ } |
+ |
int index = info->SearchOptimizedCodeMap(context->native_context(), |
BailoutId::None()); |
if (!info->bound() && index < 0) { |
@@ -1399,12 +1398,8 @@ Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
Code* code = info->GetCodeFromOptimizedCodeMap(index); |
DCHECK(!code->marked_for_deoptimization()); |
result->ReplaceCode(code); |
- return result; |
} |
- if (FLAG_always_opt && ShouldOptimizeNewClosure(info)) { |
- result->MarkForOptimization(); |
- } |
return result; |
} |