| 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 | 766 |
| 767 // Reset profiler ticks, function is no longer considered hot. | 767 // Reset profiler ticks, function is no longer considered hot. |
| 768 if (shared->is_compiled()) { | 768 if (shared->is_compiled()) { |
| 769 shared->code()->set_profiler_ticks(0); | 769 shared->code()->set_profiler_ticks(0); |
| 770 } | 770 } |
| 771 | 771 |
| 772 VMState<COMPILER> state(isolate); | 772 VMState<COMPILER> state(isolate); |
| 773 DCHECK(!isolate->has_pending_exception()); | 773 DCHECK(!isolate->has_pending_exception()); |
| 774 PostponeInterruptsScope postpone(isolate); | 774 PostponeInterruptsScope postpone(isolate); |
| 775 bool use_turbofan = UseTurboFan(shared); | 775 bool use_turbofan = UseTurboFan(shared); |
| 776 base::SmartPointer<CompilationJob> job( | 776 std::unique_ptr<CompilationJob> job( |
| 777 use_turbofan ? compiler::Pipeline::NewCompilationJob(function) | 777 use_turbofan ? compiler::Pipeline::NewCompilationJob(function) |
| 778 : new HCompilationJob(function)); | 778 : new HCompilationJob(function)); |
| 779 CompilationInfo* info = job->info(); | 779 CompilationInfo* info = job->info(); |
| 780 ParseInfo* parse_info = info->parse_info(); | 780 ParseInfo* parse_info = info->parse_info(); |
| 781 | 781 |
| 782 info->SetOptimizingForOsr(osr_ast_id, osr_frame); | 782 info->SetOptimizingForOsr(osr_ast_id, osr_frame); |
| 783 | 783 |
| 784 // Do not use Crankshaft/TurboFan if we need to be able to set break points. | 784 // Do not use Crankshaft/TurboFan if we need to be able to set break points. |
| 785 if (info->shared_info()->HasDebugInfo()) { | 785 if (info->shared_info()->HasDebugInfo()) { |
| 786 info->AbortOptimization(kFunctionBeingDebugged); | 786 info->AbortOptimization(kFunctionBeingDebugged); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 809 if (IsEvalToplevel(shared)) { | 809 if (IsEvalToplevel(shared)) { |
| 810 parse_info->set_eval(); | 810 parse_info->set_eval(); |
| 811 if (function->context()->IsNativeContext()) parse_info->set_global(); | 811 if (function->context()->IsNativeContext()) parse_info->set_global(); |
| 812 parse_info->set_toplevel(); | 812 parse_info->set_toplevel(); |
| 813 parse_info->set_allow_lazy_parsing(false); | 813 parse_info->set_allow_lazy_parsing(false); |
| 814 parse_info->set_lazy(false); | 814 parse_info->set_lazy(false); |
| 815 } | 815 } |
| 816 | 816 |
| 817 if (mode == Compiler::CONCURRENT) { | 817 if (mode == Compiler::CONCURRENT) { |
| 818 if (GetOptimizedCodeLater(job.get())) { | 818 if (GetOptimizedCodeLater(job.get())) { |
| 819 job.Detach(); // The background recompile job owns this now. | 819 job.release(); // The background recompile job owns this now. |
| 820 return isolate->builtins()->InOptimizationQueue(); | 820 return isolate->builtins()->InOptimizationQueue(); |
| 821 } | 821 } |
| 822 } else { | 822 } else { |
| 823 if (GetOptimizedCodeNow(job.get())) return info->code(); | 823 if (GetOptimizedCodeNow(job.get())) return info->code(); |
| 824 } | 824 } |
| 825 | 825 |
| 826 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); | 826 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); |
| 827 return MaybeHandle<Code>(); | 827 return MaybeHandle<Code>(); |
| 828 } | 828 } |
| 829 | 829 |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function, | 1809 MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function, |
| 1810 BailoutId osr_ast_id, | 1810 BailoutId osr_ast_id, |
| 1811 JavaScriptFrame* osr_frame) { | 1811 JavaScriptFrame* osr_frame) { |
| 1812 DCHECK(!osr_ast_id.IsNone()); | 1812 DCHECK(!osr_ast_id.IsNone()); |
| 1813 DCHECK_NOT_NULL(osr_frame); | 1813 DCHECK_NOT_NULL(osr_frame); |
| 1814 return GetOptimizedCode(function, NOT_CONCURRENT, osr_ast_id, osr_frame); | 1814 return GetOptimizedCode(function, NOT_CONCURRENT, osr_ast_id, osr_frame); |
| 1815 } | 1815 } |
| 1816 | 1816 |
| 1817 void Compiler::FinalizeCompilationJob(CompilationJob* raw_job) { | 1817 void Compiler::FinalizeCompilationJob(CompilationJob* raw_job) { |
| 1818 // Take ownership of compilation job. Deleting job also tears down the zone. | 1818 // Take ownership of compilation job. Deleting job also tears down the zone. |
| 1819 base::SmartPointer<CompilationJob> job(raw_job); | 1819 std::unique_ptr<CompilationJob> job(raw_job); |
| 1820 CompilationInfo* info = job->info(); | 1820 CompilationInfo* info = job->info(); |
| 1821 Isolate* isolate = info->isolate(); | 1821 Isolate* isolate = info->isolate(); |
| 1822 | 1822 |
| 1823 VMState<COMPILER> state(isolate); | 1823 VMState<COMPILER> state(isolate); |
| 1824 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 1824 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 1825 RuntimeCallTimerScope runtimeTimer(isolate, | 1825 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1826 &RuntimeCallStats::RecompileSynchronous); | 1826 &RuntimeCallStats::RecompileSynchronous); |
| 1827 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1827 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 1828 "V8.RecompileSynchronous"); | 1828 "V8.RecompileSynchronous"); |
| 1829 | 1829 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 DCHECK(shared->is_compiled()); | 1889 DCHECK(shared->is_compiled()); |
| 1890 function->set_literals(cached.literals); | 1890 function->set_literals(cached.literals); |
| 1891 } else if (shared->is_compiled()) { | 1891 } else if (shared->is_compiled()) { |
| 1892 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1892 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1893 JSFunction::EnsureLiterals(function); | 1893 JSFunction::EnsureLiterals(function); |
| 1894 } | 1894 } |
| 1895 } | 1895 } |
| 1896 | 1896 |
| 1897 } // namespace internal | 1897 } // namespace internal |
| 1898 } // namespace v8 | 1898 } // namespace v8 |
| OLD | NEW |