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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 // be generated lazily once deopt is triggered. | 1300 // be generated lazily once deopt is triggered. |
1300 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { | 1301 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { |
1301 DCHECK_NOT_NULL(info->literal()); | 1302 DCHECK_NOT_NULL(info->literal()); |
1302 DCHECK_NOT_NULL(info->scope()); | 1303 DCHECK_NOT_NULL(info->scope()); |
1303 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1304 Handle<SharedFunctionInfo> shared = info->shared_info(); |
1304 if (!shared->has_deoptimization_support()) { | 1305 if (!shared->has_deoptimization_support()) { |
1305 Zone zone(info->isolate()->allocator()); | 1306 Zone zone(info->isolate()->allocator()); |
1306 CompilationInfo unoptimized(info->parse_info(), info->closure()); | 1307 CompilationInfo unoptimized(info->parse_info(), info->closure()); |
1307 unoptimized.EnableDeoptimizationSupport(); | 1308 unoptimized.EnableDeoptimizationSupport(); |
1308 | 1309 |
1309 // TODO(4280): For now we do not switch generators to baseline code because | 1310 // TODO(4280): For now we do not switch generators or async functions to |
1310 // there might be suspended activations stored in generator objects on the | 1311 // baseline code because there might be suspended activations stored in |
1311 // heap. We could eventually go directly to TurboFan in this case. | 1312 // generator objects on the heap. We could eventually go directly to |
1312 if (shared->is_generator()) return false; | 1313 // TurboFan in this case. |
| 1314 if (shared->is_resumable()) return false; |
1313 | 1315 |
1314 // TODO(4280): For now we disable switching to baseline code in the presence | 1316 // TODO(4280): For now we disable switching to baseline code in the presence |
1315 // of interpreter activations of the given function. The reasons are: | 1317 // of interpreter activations of the given function. The reasons are: |
1316 // 1) The debugger assumes each function is either full-code or bytecode. | 1318 // 1) The debugger assumes each function is either full-code or bytecode. |
1317 // 2) The underlying bytecode is cleared below, breaking stack unwinding. | 1319 // 2) The underlying bytecode is cleared below, breaking stack unwinding. |
1318 // The expensive check for activations only needs to be done when the given | 1320 // The expensive check for activations only needs to be done when the given |
1319 // function has bytecode, otherwise we can be sure there are no activations. | 1321 // function has bytecode, otherwise we can be sure there are no activations. |
1320 if (shared->HasBytecodeArray()) { | 1322 if (shared->HasBytecodeArray()) { |
1321 InterpreterActivationsFinder activations_finder(*shared); | 1323 InterpreterActivationsFinder activations_finder(*shared); |
1322 if (HasInterpreterActivations(info->isolate(), &activations_finder)) { | 1324 if (HasInterpreterActivations(info->isolate(), &activations_finder)) { |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 MaybeHandle<Code> code; | 1795 MaybeHandle<Code> code; |
1794 if (cached.code != nullptr) code = handle(cached.code); | 1796 if (cached.code != nullptr) code = handle(cached.code); |
1795 Handle<Context> native_context(function->context()->native_context()); | 1797 Handle<Context> native_context(function->context()->native_context()); |
1796 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1798 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
1797 literals, BailoutId::None()); | 1799 literals, BailoutId::None()); |
1798 } | 1800 } |
1799 } | 1801 } |
1800 | 1802 |
1801 } // namespace internal | 1803 } // namespace internal |
1802 } // namespace v8 | 1804 } // namespace v8 |
OLD | NEW |