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