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 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/asmjs/asm-js.h" | 10 #include "src/asmjs/asm-js.h" |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 DCHECK_IMPLIES(!has_script, ShouldUseIgnition(shared, false)); | 899 DCHECK_IMPLIES(!has_script, ShouldUseIgnition(shared, false)); |
900 std::unique_ptr<CompilationJob> job( | 900 std::unique_ptr<CompilationJob> job( |
901 use_turbofan ? compiler::Pipeline::NewCompilationJob(function, has_script) | 901 use_turbofan ? compiler::Pipeline::NewCompilationJob(function, has_script) |
902 : new HCompilationJob(function)); | 902 : new HCompilationJob(function)); |
903 CompilationInfo* info = job->info(); | 903 CompilationInfo* info = job->info(); |
904 ParseInfo* parse_info = info->parse_info(); | 904 ParseInfo* parse_info = info->parse_info(); |
905 | 905 |
906 info->SetOptimizingForOsr(osr_ast_id, osr_frame); | 906 info->SetOptimizingForOsr(osr_ast_id, osr_frame); |
907 | 907 |
908 // Do not use Crankshaft/TurboFan if we need to be able to set break points. | 908 // Do not use Crankshaft/TurboFan if we need to be able to set break points. |
909 if (info->shared_info()->HasDebugInfo()) { | 909 if (info->shared_info()->HasBreakInfo()) { |
910 info->AbortOptimization(kFunctionBeingDebugged); | 910 info->AbortOptimization(kFunctionBeingDebugged); |
911 return MaybeHandle<Code>(); | 911 return MaybeHandle<Code>(); |
912 } | 912 } |
913 | 913 |
914 // Do not use Crankshaft/TurboFan when %NeverOptimizeFunction was applied. | 914 // Do not use Crankshaft/TurboFan when %NeverOptimizeFunction was applied. |
915 if (shared->optimization_disabled() && | 915 if (shared->optimization_disabled() && |
916 shared->disable_optimization_reason() == kOptimizationDisabledForTest) { | 916 shared->disable_optimization_reason() == kOptimizationDisabledForTest) { |
917 info->AbortOptimization(kOptimizationDisabledForTest); | 917 info->AbortOptimization(kOptimizationDisabledForTest); |
918 return MaybeHandle<Code>(); | 918 return MaybeHandle<Code>(); |
919 } | 919 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 shared->code()->set_profiler_ticks(0); | 999 shared->code()->set_profiler_ticks(0); |
1000 } else if (shared->HasBytecodeArray()) { | 1000 } else if (shared->HasBytecodeArray()) { |
1001 shared->set_profiler_ticks(0); | 1001 shared->set_profiler_ticks(0); |
1002 } | 1002 } |
1003 | 1003 |
1004 shared->set_has_concurrent_optimization_job(false); | 1004 shared->set_has_concurrent_optimization_job(false); |
1005 | 1005 |
1006 // Shared function no longer needs to be tiered up. | 1006 // Shared function no longer needs to be tiered up. |
1007 shared->set_marked_for_tier_up(false); | 1007 shared->set_marked_for_tier_up(false); |
1008 | 1008 |
1009 DCHECK(!shared->HasDebugInfo()); | 1009 DCHECK(!shared->HasBreakInfo()); |
1010 | 1010 |
1011 // 1) Optimization on the concurrent thread may have failed. | 1011 // 1) Optimization on the concurrent thread may have failed. |
1012 // 2) The function may have already been optimized by OSR. Simply continue. | 1012 // 2) The function may have already been optimized by OSR. Simply continue. |
1013 // Except when OSR already disabled optimization for some reason. | 1013 // Except when OSR already disabled optimization for some reason. |
1014 // 3) The code may have already been invalidated due to dependency change. | 1014 // 3) The code may have already been invalidated due to dependency change. |
1015 // 4) Code generation may have failed. | 1015 // 4) Code generation may have failed. |
1016 if (job->state() == CompilationJob::State::kReadyToFinalize) { | 1016 if (job->state() == CompilationJob::State::kReadyToFinalize) { |
1017 if (shared->optimization_disabled()) { | 1017 if (shared->optimization_disabled()) { |
1018 job->RetryOptimization(kOptimizationDisabled); | 1018 job->RetryOptimization(kOptimizationDisabled); |
1019 } else if (info->dependencies()->HasAborted()) { | 1019 } else if (info->dependencies()->HasAborted()) { |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 // Caching of optimized code enabled and optimized code found. | 1898 // Caching of optimized code enabled and optimized code found. |
1899 DCHECK(!code->marked_for_deoptimization()); | 1899 DCHECK(!code->marked_for_deoptimization()); |
1900 DCHECK(function->shared()->is_compiled()); | 1900 DCHECK(function->shared()->is_compiled()); |
1901 function->ReplaceCode(code); | 1901 function->ReplaceCode(code); |
1902 } | 1902 } |
1903 } | 1903 } |
1904 } | 1904 } |
1905 | 1905 |
1906 } // namespace internal | 1906 } // namespace internal |
1907 } // namespace v8 | 1907 } // namespace v8 |
OLD | NEW |