Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 685009ec53a5998024e28aced0014507079efd97..431872df282f33d24b5185bc5cbe13adccef49ff 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -912,6 +912,8 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { |
DCHECK(info->is_eval() || info->is_global()); |
+ info->MarkAsToplevel(); |
+ |
Handle<SharedFunctionInfo> result; |
{ VMState<COMPILER> state(info->isolate()); |
@@ -1178,6 +1180,13 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo( |
bool allow_lazy = literal->AllowsLazyCompilation() && |
!DebuggerWantsEagerCompilation(&info, allow_lazy_without_ctx); |
+ |
+ if (outer_info->is_toplevel() && outer_info->will_serialize()) { |
+ // Make sure that if the toplevel code (possibly to be serialized), |
+ // the inner unction must be allowed to be compiled lazily. |
+ DCHECK(allow_lazy); |
+ } |
+ |
// Generate code |
Handle<ScopeInfo> scope_info; |
if (FLAG_lazy && allow_lazy && !literal->is_parenthesized()) { |