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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 // functions, so do not parse lazily in that case. | 1268 // functions, so do not parse lazily in that case. |
1269 ScriptCompiler::CompileOptions options = parse_info->compile_options(); | 1269 ScriptCompiler::CompileOptions options = parse_info->compile_options(); |
1270 bool parse_allow_lazy = (options == ScriptCompiler::kConsumeParserCache || | 1270 bool parse_allow_lazy = (options == ScriptCompiler::kConsumeParserCache || |
1271 String::cast(script->source())->length() > | 1271 String::cast(script->source())->length() > |
1272 FLAG_min_preparse_length) && | 1272 FLAG_min_preparse_length) && |
1273 !info->is_debug(); | 1273 !info->is_debug(); |
1274 | 1274 |
1275 // Consider parsing eagerly when targeting the code cache. | 1275 // Consider parsing eagerly when targeting the code cache. |
1276 parse_allow_lazy &= !(FLAG_serialize_eager && info->will_serialize()); | 1276 parse_allow_lazy &= !(FLAG_serialize_eager && info->will_serialize()); |
1277 | 1277 |
| 1278 // Consider parsing eagerly when targeting Ignition. |
| 1279 parse_allow_lazy &= !(FLAG_ignition && !isolate->serializer_enabled()); |
| 1280 |
1278 parse_info->set_allow_lazy_parsing(parse_allow_lazy); | 1281 parse_info->set_allow_lazy_parsing(parse_allow_lazy); |
1279 if (!parse_allow_lazy && | 1282 if (!parse_allow_lazy && |
1280 (options == ScriptCompiler::kProduceParserCache || | 1283 (options == ScriptCompiler::kProduceParserCache || |
1281 options == ScriptCompiler::kConsumeParserCache)) { | 1284 options == ScriptCompiler::kConsumeParserCache)) { |
1282 // We are going to parse eagerly, but we either 1) have cached data | 1285 // We are going to parse eagerly, but we either 1) have cached data |
1283 // produced by lazy parsing or 2) are asked to generate cached data. | 1286 // produced by lazy parsing or 2) are asked to generate cached data. |
1284 // Eager parsing cannot benefit from cached data, and producing cached | 1287 // Eager parsing cannot benefit from cached data, and producing cached |
1285 // data while parsing eagerly is not implemented. | 1288 // data while parsing eagerly is not implemented. |
1286 parse_info->set_cached_data(nullptr); | 1289 parse_info->set_cached_data(nullptr); |
1287 parse_info->set_compile_options(ScriptCompiler::kNoCompileOptions); | 1290 parse_info->set_compile_options(ScriptCompiler::kNoCompileOptions); |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 // unless we can lazily compile without the context. | 1786 // unless we can lazily compile without the context. |
1784 bool allow_lazy = literal->AllowsLazyCompilation() && | 1787 bool allow_lazy = literal->AllowsLazyCompilation() && |
1785 !LiveEditFunctionTracker::IsActive(isolate) && | 1788 !LiveEditFunctionTracker::IsActive(isolate) && |
1786 (!info.is_debug() || allow_lazy_without_ctx); | 1789 (!info.is_debug() || allow_lazy_without_ctx); |
1787 | 1790 |
1788 bool lazy = FLAG_lazy && allow_lazy && !literal->should_eager_compile(); | 1791 bool lazy = FLAG_lazy && allow_lazy && !literal->should_eager_compile(); |
1789 | 1792 |
1790 // Consider compiling eagerly when targeting the code cache. | 1793 // Consider compiling eagerly when targeting the code cache. |
1791 lazy &= !(FLAG_serialize_eager && info.will_serialize()); | 1794 lazy &= !(FLAG_serialize_eager && info.will_serialize()); |
1792 | 1795 |
| 1796 // Consider compiling eagerly when compiling bytecode for Ignition. |
| 1797 lazy &= !(FLAG_ignition && !isolate->serializer_enabled()); |
| 1798 |
1793 // Generate code | 1799 // Generate code |
1794 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1800 TimerEventScope<TimerEventCompileCode> timer(isolate); |
1795 TRACE_EVENT0("v8", "V8.CompileCode"); | 1801 TRACE_EVENT0("v8", "V8.CompileCode"); |
1796 if (lazy) { | 1802 if (lazy) { |
1797 info.SetCode(isolate->builtins()->CompileLazy()); | 1803 info.SetCode(isolate->builtins()->CompileLazy()); |
1798 } else if (Renumber(info.parse_info()) && GenerateBaselineCode(&info)) { | 1804 } else if (Renumber(info.parse_info()) && GenerateBaselineCode(&info)) { |
1799 // Code generation will ensure that the feedback vector is present and | 1805 // Code generation will ensure that the feedback vector is present and |
1800 // appropriately sized. | 1806 // appropriately sized. |
1801 DCHECK(!info.code().is_null()); | 1807 DCHECK(!info.code().is_null()); |
1802 Handle<ScopeInfo> scope_info = | 1808 Handle<ScopeInfo> scope_info = |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1952 MaybeHandle<Code> code; | 1958 MaybeHandle<Code> code; |
1953 if (cached.code != nullptr) code = handle(cached.code); | 1959 if (cached.code != nullptr) code = handle(cached.code); |
1954 Handle<Context> native_context(function->context()->native_context()); | 1960 Handle<Context> native_context(function->context()->native_context()); |
1955 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1961 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
1956 literals, BailoutId::None()); | 1962 literals, BailoutId::None()); |
1957 } | 1963 } |
1958 } | 1964 } |
1959 | 1965 |
1960 } // namespace internal | 1966 } // namespace internal |
1961 } // namespace v8 | 1967 } // namespace v8 |
OLD | NEW |