| 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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 if (function->shared()->code()->kind() == Code::FUNCTION) { | 867 if (function->shared()->code()->kind() == Code::FUNCTION) { |
| 868 return Handle<Code>(function->shared()->code()); | 868 return Handle<Code>(function->shared()->code()); |
| 869 } | 869 } |
| 870 | 870 |
| 871 // We do not switch to baseline code when the debugger might have created a | 871 // We do not switch to baseline code when the debugger might have created a |
| 872 // copy of the bytecode with break slots to be able to set break points. | 872 // copy of the bytecode with break slots to be able to set break points. |
| 873 if (function->shared()->HasDebugInfo()) { | 873 if (function->shared()->HasDebugInfo()) { |
| 874 return MaybeHandle<Code>(); | 874 return MaybeHandle<Code>(); |
| 875 } | 875 } |
| 876 | 876 |
| 877 // TODO(4280): For now we do not switch generators to baseline code because | 877 // TODO(4280): For now we do not switch generators or async functions to |
| 878 // there might be suspended activations stored in generator objects on the | 878 // baseline code because there might be suspended activations stored in |
| 879 // heap. We could eventually go directly to TurboFan in this case. | 879 // generator objects on the heap. We could eventually go directly to |
| 880 if (function->shared()->is_generator()) { | 880 // TurboFan in this case. |
| 881 if (function->shared()->is_resumable()) { |
| 881 return MaybeHandle<Code>(); | 882 return MaybeHandle<Code>(); |
| 882 } | 883 } |
| 883 | 884 |
| 884 // TODO(4280): For now we disable switching to baseline code in the presence | 885 // TODO(4280): For now we disable switching to baseline code in the presence |
| 885 // of interpreter activations of the given function. The reasons are: | 886 // of interpreter activations of the given function. The reasons are: |
| 886 // 1) The debugger assumes each function is either full-code or bytecode. | 887 // 1) The debugger assumes each function is either full-code or bytecode. |
| 887 // 2) The underlying bytecode is cleared below, breaking stack unwinding. | 888 // 2) The underlying bytecode is cleared below, breaking stack unwinding. |
| 888 InterpreterActivationsFinder activations_finder(function->shared()); | 889 InterpreterActivationsFinder activations_finder(function->shared()); |
| 889 if (HasInterpreterActivations(isolate, &activations_finder)) { | 890 if (HasInterpreterActivations(isolate, &activations_finder)) { |
| 890 if (FLAG_trace_opt) { | 891 if (FLAG_trace_opt) { |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 // be generated lazily once deopt is triggered. | 1302 // be generated lazily once deopt is triggered. |
| 1302 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { | 1303 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { |
| 1303 DCHECK_NOT_NULL(info->literal()); | 1304 DCHECK_NOT_NULL(info->literal()); |
| 1304 DCHECK_NOT_NULL(info->scope()); | 1305 DCHECK_NOT_NULL(info->scope()); |
| 1305 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1306 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 1306 if (!shared->has_deoptimization_support()) { | 1307 if (!shared->has_deoptimization_support()) { |
| 1307 Zone zone(info->isolate()->allocator()); | 1308 Zone zone(info->isolate()->allocator()); |
| 1308 CompilationInfo unoptimized(info->parse_info(), info->closure()); | 1309 CompilationInfo unoptimized(info->parse_info(), info->closure()); |
| 1309 unoptimized.EnableDeoptimizationSupport(); | 1310 unoptimized.EnableDeoptimizationSupport(); |
| 1310 | 1311 |
| 1311 // TODO(4280): For now we do not switch generators to baseline code because | 1312 // TODO(4280): For now we do not switch generators or async functions to |
| 1312 // there might be suspended activations stored in generator objects on the | 1313 // baseline code because there might be suspended activations stored in |
| 1313 // heap. We could eventually go directly to TurboFan in this case. | 1314 // generator objects on the heap. We could eventually go directly to |
| 1314 if (shared->is_generator()) return false; | 1315 // TurboFan in this case. |
| 1316 if (shared->is_resumable()) return false; |
| 1315 | 1317 |
| 1316 // TODO(4280): For now we disable switching to baseline code in the presence | 1318 // TODO(4280): For now we disable switching to baseline code in the presence |
| 1317 // of interpreter activations of the given function. The reasons are: | 1319 // of interpreter activations of the given function. The reasons are: |
| 1318 // 1) The debugger assumes each function is either full-code or bytecode. | 1320 // 1) The debugger assumes each function is either full-code or bytecode. |
| 1319 // 2) The underlying bytecode is cleared below, breaking stack unwinding. | 1321 // 2) The underlying bytecode is cleared below, breaking stack unwinding. |
| 1320 // The expensive check for activations only needs to be done when the given | 1322 // The expensive check for activations only needs to be done when the given |
| 1321 // function has bytecode, otherwise we can be sure there are no activations. | 1323 // function has bytecode, otherwise we can be sure there are no activations. |
| 1322 if (shared->HasBytecodeArray()) { | 1324 if (shared->HasBytecodeArray()) { |
| 1323 InterpreterActivationsFinder activations_finder(*shared); | 1325 InterpreterActivationsFinder activations_finder(*shared); |
| 1324 if (HasInterpreterActivations(info->isolate(), &activations_finder)) { | 1326 if (HasInterpreterActivations(info->isolate(), &activations_finder)) { |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 DCHECK(shared->is_compiled()); | 1786 DCHECK(shared->is_compiled()); |
| 1785 function->set_literals(cached.literals); | 1787 function->set_literals(cached.literals); |
| 1786 } else if (shared->is_compiled()) { | 1788 } else if (shared->is_compiled()) { |
| 1787 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1789 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1788 JSFunction::EnsureLiterals(function); | 1790 JSFunction::EnsureLiterals(function); |
| 1789 } | 1791 } |
| 1790 } | 1792 } |
| 1791 | 1793 |
| 1792 } // namespace internal | 1794 } // namespace internal |
| 1793 } // namespace v8 | 1795 } // namespace v8 |
| OLD | NEW |