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 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 LiveEditFunctionTracker live_edit_tracker(isolate, literal); | 1600 LiveEditFunctionTracker live_edit_tracker(isolate, literal); |
1601 // Determine if the function can be lazily compiled. This is necessary to | 1601 // Determine if the function can be lazily compiled. This is necessary to |
1602 // allow some of our builtin JS files to be lazily compiled. These | 1602 // allow some of our builtin JS files to be lazily compiled. These |
1603 // builtins cannot be handled lazily by the parser, since we have to know | 1603 // builtins cannot be handled lazily by the parser, since we have to know |
1604 // if a function uses the special natives syntax, which is something the | 1604 // if a function uses the special natives syntax, which is something the |
1605 // parser records. | 1605 // parser records. |
1606 // If the debugger requests compilation for break points, we cannot be | 1606 // If the debugger requests compilation for break points, we cannot be |
1607 // aggressive about lazy compilation, because it might trigger compilation | 1607 // aggressive about lazy compilation, because it might trigger compilation |
1608 // of functions without an outer context when setting a breakpoint through | 1608 // of functions without an outer context when setting a breakpoint through |
1609 // Debug::FindSharedFunctionInfoInScript. | 1609 // Debug::FindSharedFunctionInfoInScript. |
1610 bool allow_lazy_without_ctx = literal->AllowsLazyCompilationWithoutContext(); | 1610 bool allow_lazy = literal->AllowsLazyCompilation() && !info.is_debug(); |
1611 // Compile eagerly for live edit. When compiling debug code, eagerly compile | |
1612 // unless we can lazily compile without the context. | |
1613 bool allow_lazy = literal->AllowsLazyCompilation() && | |
1614 !LiveEditFunctionTracker::IsActive(isolate) && | |
1615 (!info.is_debug() || allow_lazy_without_ctx); | |
1616 | |
1617 bool lazy = FLAG_lazy && allow_lazy && !literal->should_eager_compile(); | 1611 bool lazy = FLAG_lazy && allow_lazy && !literal->should_eager_compile(); |
1618 | 1612 |
1619 // Consider compiling eagerly when targeting the code cache. | 1613 // Consider compiling eagerly when targeting the code cache. |
1620 lazy &= !(FLAG_serialize_eager && info.will_serialize()); | 1614 lazy &= !(FLAG_serialize_eager && info.will_serialize()); |
1621 | 1615 |
1622 // Consider compiling eagerly when compiling bytecode for Ignition. | 1616 // Consider compiling eagerly when compiling bytecode for Ignition. |
1623 lazy &= | 1617 lazy &= |
1624 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); | 1618 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); |
1625 | 1619 |
1626 // Generate code | 1620 // Generate code |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 MaybeHandle<Code> code; | 1768 MaybeHandle<Code> code; |
1775 if (cached.code != nullptr) code = handle(cached.code); | 1769 if (cached.code != nullptr) code = handle(cached.code); |
1776 Handle<Context> native_context(function->context()->native_context()); | 1770 Handle<Context> native_context(function->context()->native_context()); |
1777 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1771 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
1778 literals, BailoutId::None()); | 1772 literals, BailoutId::None()); |
1779 } | 1773 } |
1780 } | 1774 } |
1781 | 1775 |
1782 } // namespace internal | 1776 } // namespace internal |
1783 } // namespace v8 | 1777 } // namespace v8 |
OLD | NEW |