OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 if (context->IsNativeContext()) parse_info.set_global(); | 1326 if (context->IsNativeContext()) parse_info.set_global(); |
1327 parse_info.set_language_mode(language_mode); | 1327 parse_info.set_language_mode(language_mode); |
1328 parse_info.set_parse_restriction(restriction); | 1328 parse_info.set_parse_restriction(restriction); |
1329 parse_info.set_context(context); | 1329 parse_info.set_context(context); |
1330 | 1330 |
1331 shared_info = CompileToplevel(&info); | 1331 shared_info = CompileToplevel(&info); |
1332 | 1332 |
1333 if (shared_info.is_null()) { | 1333 if (shared_info.is_null()) { |
1334 return MaybeHandle<JSFunction>(); | 1334 return MaybeHandle<JSFunction>(); |
1335 } else { | 1335 } else { |
1336 // Explicitly disable optimization for eval code. We're not yet prepared | |
1337 // to handle eval-code in the optimizing compiler. | |
1338 if (restriction != ONLY_SINGLE_FUNCTION_LITERAL) { | |
1339 shared_info->DisableOptimization(kEval); | |
1340 } | |
1341 | |
1342 // If caller is strict mode, the result must be in strict mode as well. | 1336 // If caller is strict mode, the result must be in strict mode as well. |
1343 DCHECK(is_sloppy(language_mode) || | 1337 DCHECK(is_sloppy(language_mode) || |
1344 is_strict(shared_info->language_mode())); | 1338 is_strict(shared_info->language_mode())); |
1345 compilation_cache->PutEval(source, outer_info, context, shared_info, | 1339 compilation_cache->PutEval(source, outer_info, context, shared_info, |
1346 eval_scope_position); | 1340 eval_scope_position); |
1347 } | 1341 } |
1348 } | 1342 } |
1349 | 1343 |
1350 Handle<JSFunction> result = | 1344 Handle<JSFunction> result = |
1351 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 1345 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1742 MaybeHandle<Code> code; | 1736 MaybeHandle<Code> code; |
1743 if (cached.code != nullptr) code = handle(cached.code); | 1737 if (cached.code != nullptr) code = handle(cached.code); |
1744 Handle<Context> native_context(function->context()->native_context()); | 1738 Handle<Context> native_context(function->context()->native_context()); |
1745 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1739 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
1746 literals, BailoutId::None()); | 1740 literals, BailoutId::None()); |
1747 } | 1741 } |
1748 } | 1742 } |
1749 | 1743 |
1750 } // namespace internal | 1744 } // namespace internal |
1751 } // namespace v8 | 1745 } // namespace v8 |
OLD | NEW |