| 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 if (!info->is_optimizing_from_bytecode()) { | 665 if (!info->is_optimizing_from_bytecode()) { |
| 666 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; | 666 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; |
| 667 EnsureFeedbackMetadata(info); | 667 EnsureFeedbackMetadata(info); |
| 668 } | 668 } |
| 669 | 669 |
| 670 JSFunction::EnsureLiterals(info->closure()); | 670 JSFunction::EnsureLiterals(info->closure()); |
| 671 | 671 |
| 672 TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); | 672 TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); |
| 673 RuntimeCallTimerScope runtimeTimer(isolate, | 673 RuntimeCallTimerScope runtimeTimer(isolate, |
| 674 &RuntimeCallStats::RecompileSynchronous); | 674 &RuntimeCallStats::RecompileSynchronous); |
| 675 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 675 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 676 "V8.RecompileSynchronous"); | 676 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 677 | 677 |
| 678 if (job->CreateGraph() != CompilationJob::SUCCEEDED || | 678 if (job->CreateGraph() != CompilationJob::SUCCEEDED || |
| 679 job->OptimizeGraph() != CompilationJob::SUCCEEDED || | 679 job->OptimizeGraph() != CompilationJob::SUCCEEDED || |
| 680 job->GenerateCode() != CompilationJob::SUCCEEDED) { | 680 job->GenerateCode() != CompilationJob::SUCCEEDED) { |
| 681 if (FLAG_trace_opt) { | 681 if (FLAG_trace_opt) { |
| 682 PrintF("[aborted optimizing "); | 682 PrintF("[aborted optimizing "); |
| 683 info->closure()->ShortPrint(); | 683 info->closure()->ShortPrint(); |
| 684 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); | 684 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); |
| 685 } | 685 } |
| 686 return false; | 686 return false; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 728 |
| 729 JSFunction::EnsureLiterals(info->closure()); | 729 JSFunction::EnsureLiterals(info->closure()); |
| 730 | 730 |
| 731 // Reopen handles in the new CompilationHandleScope. | 731 // Reopen handles in the new CompilationHandleScope. |
| 732 info->ReopenHandlesInNewHandleScope(); | 732 info->ReopenHandlesInNewHandleScope(); |
| 733 info->parse_info()->ReopenHandlesInNewHandleScope(); | 733 info->parse_info()->ReopenHandlesInNewHandleScope(); |
| 734 | 734 |
| 735 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 735 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 736 RuntimeCallTimerScope runtimeTimer(info->isolate(), | 736 RuntimeCallTimerScope runtimeTimer(info->isolate(), |
| 737 &RuntimeCallStats::RecompileSynchronous); | 737 &RuntimeCallStats::RecompileSynchronous); |
| 738 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 738 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 739 "V8.RecompileSynchronous"); | 739 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 740 | 740 |
| 741 if (job->CreateGraph() != CompilationJob::SUCCEEDED) return false; | 741 if (job->CreateGraph() != CompilationJob::SUCCEEDED) return false; |
| 742 isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); | 742 isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); |
| 743 | 743 |
| 744 if (FLAG_trace_concurrent_recompilation) { | 744 if (FLAG_trace_concurrent_recompilation) { |
| 745 PrintF(" ** Queued "); | 745 PrintF(" ** Queued "); |
| 746 info->closure()->ShortPrint(); | 746 info->closure()->ShortPrint(); |
| 747 PrintF(" for concurrent optimization.\n"); | 747 PrintF(" for concurrent optimization.\n"); |
| 748 } | 748 } |
| 749 return true; | 749 return true; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 const int kMaxOptCount = | 807 const int kMaxOptCount = |
| 808 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; | 808 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
| 809 if (info->shared_info()->opt_count() > kMaxOptCount) { | 809 if (info->shared_info()->opt_count() > kMaxOptCount) { |
| 810 info->AbortOptimization(kOptimizedTooManyTimes); | 810 info->AbortOptimization(kOptimizedTooManyTimes); |
| 811 return MaybeHandle<Code>(); | 811 return MaybeHandle<Code>(); |
| 812 } | 812 } |
| 813 | 813 |
| 814 CanonicalHandleScope canonical(isolate); | 814 CanonicalHandleScope canonical(isolate); |
| 815 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); | 815 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); |
| 816 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); | 816 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); |
| 817 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode"); | 817 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 818 isolate, &tracing::TraceEventStatsTable::OptimizeCode); |
| 818 | 819 |
| 819 // TurboFan can optimize directly from existing bytecode. | 820 // TurboFan can optimize directly from existing bytecode. |
| 820 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { | 821 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { |
| 821 if (!Compiler::EnsureBytecode(info)) { | 822 if (!Compiler::EnsureBytecode(info)) { |
| 822 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); | 823 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); |
| 823 return MaybeHandle<Code>(); | 824 return MaybeHandle<Code>(); |
| 824 } | 825 } |
| 825 info->MarkAsOptimizeFromBytecode(); | 826 info->MarkAsOptimizeFromBytecode(); |
| 826 } | 827 } |
| 827 | 828 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 return info.code(); | 1007 return info.code(); |
| 1007 } | 1008 } |
| 1008 | 1009 |
| 1009 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { | 1010 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { |
| 1010 Isolate* isolate = function->GetIsolate(); | 1011 Isolate* isolate = function->GetIsolate(); |
| 1011 DCHECK(!isolate->has_pending_exception()); | 1012 DCHECK(!isolate->has_pending_exception()); |
| 1012 DCHECK(!function->is_compiled()); | 1013 DCHECK(!function->is_compiled()); |
| 1013 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); | 1014 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); |
| 1014 RuntimeCallTimerScope runtimeTimer(isolate, | 1015 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1015 &RuntimeCallStats::CompileCodeLazy); | 1016 &RuntimeCallStats::CompileCodeLazy); |
| 1016 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1017 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1018 isolate, &tracing::TraceEventStatsTable::CompileCodeLazy); |
| 1017 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); | 1019 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); |
| 1018 | 1020 |
| 1019 if (FLAG_turbo_cache_shared_code) { | 1021 if (FLAG_turbo_cache_shared_code) { |
| 1020 Handle<Code> cached_code; | 1022 Handle<Code> cached_code; |
| 1021 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) | 1023 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) |
| 1022 .ToHandle(&cached_code)) { | 1024 .ToHandle(&cached_code)) { |
| 1023 if (FLAG_trace_opt) { | 1025 if (FLAG_trace_opt) { |
| 1024 PrintF("[found optimized code for "); | 1026 PrintF("[found optimized code for "); |
| 1025 function->ShortPrint(); | 1027 function->ShortPrint(); |
| 1026 PrintF(" during unoptimized compile]\n"); | 1028 PrintF(" during unoptimized compile]\n"); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 code, scope_info); | 1063 code, scope_info); |
| 1062 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); | 1064 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); |
| 1063 SharedFunctionInfo::SetScript(result, script); | 1065 SharedFunctionInfo::SetScript(result, script); |
| 1064 return result; | 1066 return result; |
| 1065 } | 1067 } |
| 1066 | 1068 |
| 1067 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { | 1069 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { |
| 1068 Isolate* isolate = info->isolate(); | 1070 Isolate* isolate = info->isolate(); |
| 1069 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1071 TimerEventScope<TimerEventCompileCode> timer(isolate); |
| 1070 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1072 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
| 1071 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1073 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1074 isolate, &tracing::TraceEventStatsTable::CompileCode); |
| 1072 PostponeInterruptsScope postpone(isolate); | 1075 PostponeInterruptsScope postpone(isolate); |
| 1073 DCHECK(!isolate->native_context().is_null()); | 1076 DCHECK(!isolate->native_context().is_null()); |
| 1074 ParseInfo* parse_info = info->parse_info(); | 1077 ParseInfo* parse_info = info->parse_info(); |
| 1075 Handle<Script> script = parse_info->script(); | 1078 Handle<Script> script = parse_info->script(); |
| 1076 | 1079 |
| 1077 // Create a canonical handle scope if compiling ignition bytecode. This is | 1080 // Create a canonical handle scope if compiling ignition bytecode. This is |
| 1078 // required by the constant array builder to de-duplicate common objects | 1081 // required by the constant array builder to de-duplicate common objects |
| 1079 // without dereferencing handles. | 1082 // without dereferencing handles. |
| 1080 std::unique_ptr<CanonicalHandleScope> canonical; | 1083 std::unique_ptr<CanonicalHandleScope> canonical; |
| 1081 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate)); | 1084 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate)); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 // Measure how long it takes to do the compilation; only take the | 1138 // Measure how long it takes to do the compilation; only take the |
| 1136 // rest of the function into account to avoid overlap with the | 1139 // rest of the function into account to avoid overlap with the |
| 1137 // parsing statistics. | 1140 // parsing statistics. |
| 1138 RuntimeCallTimerScope runtimeTimer( | 1141 RuntimeCallTimerScope runtimeTimer( |
| 1139 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval | 1142 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval |
| 1140 : &RuntimeCallStats::Compile); | 1143 : &RuntimeCallStats::Compile); |
| 1141 HistogramTimer* rate = parse_info->is_eval() | 1144 HistogramTimer* rate = parse_info->is_eval() |
| 1142 ? info->isolate()->counters()->compile_eval() | 1145 ? info->isolate()->counters()->compile_eval() |
| 1143 : info->isolate()->counters()->compile(); | 1146 : info->isolate()->counters()->compile(); |
| 1144 HistogramTimerScope timer(rate); | 1147 HistogramTimerScope timer(rate); |
| 1145 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1148 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1146 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); | 1149 isolate, |
| 1150 (parse_info->is_eval() ? &tracing::TraceEventStatsTable::CompileEval |
| 1151 : &tracing::TraceEventStatsTable::Compile)); |
| 1147 | 1152 |
| 1148 // Allocate a shared function info object. | 1153 // Allocate a shared function info object. |
| 1149 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); | 1154 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); |
| 1150 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); | 1155 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); |
| 1151 result->set_is_toplevel(true); | 1156 result->set_is_toplevel(true); |
| 1152 if (parse_info->is_eval()) { | 1157 if (parse_info->is_eval()) { |
| 1153 // Eval scripts cannot be (re-)compiled without context. | 1158 // Eval scripts cannot be (re-)compiled without context. |
| 1154 result->set_allows_lazy_compilation_without_context(false); | 1159 result->set_allows_lazy_compilation_without_context(false); |
| 1155 } | 1160 } |
| 1156 parse_info->set_shared_info(result); | 1161 parse_info->set_shared_info(result); |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 maybe_result = compilation_cache->LookupScript( | 1611 maybe_result = compilation_cache->LookupScript( |
| 1607 source, script_name, line_offset, column_offset, resource_options, | 1612 source, script_name, line_offset, column_offset, resource_options, |
| 1608 context, language_mode); | 1613 context, language_mode); |
| 1609 if (maybe_result.is_null() && FLAG_serialize_toplevel && | 1614 if (maybe_result.is_null() && FLAG_serialize_toplevel && |
| 1610 compile_options == ScriptCompiler::kConsumeCodeCache && | 1615 compile_options == ScriptCompiler::kConsumeCodeCache && |
| 1611 !isolate->debug()->is_loaded()) { | 1616 !isolate->debug()->is_loaded()) { |
| 1612 // Then check cached code provided by embedder. | 1617 // Then check cached code provided by embedder. |
| 1613 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); | 1618 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); |
| 1614 RuntimeCallTimerScope runtimeTimer(isolate, | 1619 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1615 &RuntimeCallStats::CompileDeserialize); | 1620 &RuntimeCallStats::CompileDeserialize); |
| 1616 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1621 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1617 "V8.CompileDeserialize"); | 1622 isolate, &tracing::TraceEventStatsTable::CompileDeserialize); |
| 1618 Handle<SharedFunctionInfo> result; | 1623 Handle<SharedFunctionInfo> result; |
| 1619 if (CodeSerializer::Deserialize(isolate, *cached_data, source) | 1624 if (CodeSerializer::Deserialize(isolate, *cached_data, source) |
| 1620 .ToHandle(&result)) { | 1625 .ToHandle(&result)) { |
| 1621 // Promote to per-isolate compilation cache. | 1626 // Promote to per-isolate compilation cache. |
| 1622 compilation_cache->PutScript(source, context, language_mode, result); | 1627 compilation_cache->PutScript(source, context, language_mode, result); |
| 1623 return result; | 1628 return result; |
| 1624 } | 1629 } |
| 1625 // Deserializer failed. Fall through to compile. | 1630 // Deserializer failed. Fall through to compile. |
| 1626 } | 1631 } |
| 1627 } | 1632 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); | 1685 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); |
| 1681 result = CompileToplevel(&info); | 1686 result = CompileToplevel(&info); |
| 1682 if (extension == NULL && !result.is_null()) { | 1687 if (extension == NULL && !result.is_null()) { |
| 1683 compilation_cache->PutScript(source, context, language_mode, result); | 1688 compilation_cache->PutScript(source, context, language_mode, result); |
| 1684 if (FLAG_serialize_toplevel && | 1689 if (FLAG_serialize_toplevel && |
| 1685 compile_options == ScriptCompiler::kProduceCodeCache) { | 1690 compile_options == ScriptCompiler::kProduceCodeCache) { |
| 1686 HistogramTimerScope histogram_timer( | 1691 HistogramTimerScope histogram_timer( |
| 1687 isolate->counters()->compile_serialize()); | 1692 isolate->counters()->compile_serialize()); |
| 1688 RuntimeCallTimerScope runtimeTimer(isolate, | 1693 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1689 &RuntimeCallStats::CompileSerialize); | 1694 &RuntimeCallStats::CompileSerialize); |
| 1690 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1695 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1691 "V8.CompileSerialize"); | 1696 isolate, &tracing::TraceEventStatsTable::CompileSerialize); |
| 1692 *cached_data = CodeSerializer::Serialize(isolate, result, source); | 1697 *cached_data = CodeSerializer::Serialize(isolate, result, source); |
| 1693 if (FLAG_profile_deserialization) { | 1698 if (FLAG_profile_deserialization) { |
| 1694 PrintF("[Compiling and serializing took %0.3f ms]\n", | 1699 PrintF("[Compiling and serializing took %0.3f ms]\n", |
| 1695 timer.Elapsed().InMillisecondsF()); | 1700 timer.Elapsed().InMillisecondsF()); |
| 1696 } | 1701 } |
| 1697 } | 1702 } |
| 1698 } | 1703 } |
| 1699 | 1704 |
| 1700 if (result.is_null()) { | 1705 if (result.is_null()) { |
| 1701 isolate->ReportPendingMessages(); | 1706 isolate->ReportPendingMessages(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 // Consider compiling eagerly when targeting the code cache. | 1802 // Consider compiling eagerly when targeting the code cache. |
| 1798 lazy &= !(FLAG_serialize_eager && info.will_serialize()); | 1803 lazy &= !(FLAG_serialize_eager && info.will_serialize()); |
| 1799 | 1804 |
| 1800 // Consider compiling eagerly when compiling bytecode for Ignition. | 1805 // Consider compiling eagerly when compiling bytecode for Ignition. |
| 1801 lazy &= | 1806 lazy &= |
| 1802 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); | 1807 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); |
| 1803 | 1808 |
| 1804 // Generate code | 1809 // Generate code |
| 1805 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1810 TimerEventScope<TimerEventCompileCode> timer(isolate); |
| 1806 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1811 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
| 1807 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1812 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1813 isolate, &tracing::TraceEventStatsTable::CompileCode); |
| 1808 if (lazy) { | 1814 if (lazy) { |
| 1809 info.SetCode(isolate->builtins()->CompileLazy()); | 1815 info.SetCode(isolate->builtins()->CompileLazy()); |
| 1810 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { | 1816 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { |
| 1811 // Code generation will ensure that the feedback vector is present and | 1817 // Code generation will ensure that the feedback vector is present and |
| 1812 // appropriately sized. | 1818 // appropriately sized. |
| 1813 DCHECK(!info.code().is_null()); | 1819 DCHECK(!info.code().is_null()); |
| 1814 if (literal->should_eager_compile() && | 1820 if (literal->should_eager_compile() && |
| 1815 literal->should_be_used_once_hint()) { | 1821 literal->should_be_used_once_hint()) { |
| 1816 info.code()->MarkToBeExecutedOnce(isolate); | 1822 info.code()->MarkToBeExecutedOnce(isolate); |
| 1817 } | 1823 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1872 void Compiler::FinalizeCompilationJob(CompilationJob* raw_job) { | 1878 void Compiler::FinalizeCompilationJob(CompilationJob* raw_job) { |
| 1873 // Take ownership of compilation job. Deleting job also tears down the zone. | 1879 // Take ownership of compilation job. Deleting job also tears down the zone. |
| 1874 std::unique_ptr<CompilationJob> job(raw_job); | 1880 std::unique_ptr<CompilationJob> job(raw_job); |
| 1875 CompilationInfo* info = job->info(); | 1881 CompilationInfo* info = job->info(); |
| 1876 Isolate* isolate = info->isolate(); | 1882 Isolate* isolate = info->isolate(); |
| 1877 | 1883 |
| 1878 VMState<COMPILER> state(isolate); | 1884 VMState<COMPILER> state(isolate); |
| 1879 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 1885 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 1880 RuntimeCallTimerScope runtimeTimer(isolate, | 1886 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1881 &RuntimeCallStats::RecompileSynchronous); | 1887 &RuntimeCallStats::RecompileSynchronous); |
| 1882 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1888 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1883 "V8.RecompileSynchronous"); | 1889 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 1884 | 1890 |
| 1885 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1891 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 1886 shared->code()->set_profiler_ticks(0); | 1892 shared->code()->set_profiler_ticks(0); |
| 1887 | 1893 |
| 1888 DCHECK(!shared->HasDebugInfo()); | 1894 DCHECK(!shared->HasDebugInfo()); |
| 1889 | 1895 |
| 1890 // 1) Optimization on the concurrent thread may have failed. | 1896 // 1) Optimization on the concurrent thread may have failed. |
| 1891 // 2) The function may have already been optimized by OSR. Simply continue. | 1897 // 2) The function may have already been optimized by OSR. Simply continue. |
| 1892 // Except when OSR already disabled optimization for some reason. | 1898 // Except when OSR already disabled optimization for some reason. |
| 1893 // 3) The code may have already been invalidated due to dependency change. | 1899 // 3) The code may have already been invalidated due to dependency change. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 DCHECK(shared->is_compiled()); | 1950 DCHECK(shared->is_compiled()); |
| 1945 function->set_literals(cached.literals); | 1951 function->set_literals(cached.literals); |
| 1946 } else if (shared->is_compiled()) { | 1952 } else if (shared->is_compiled()) { |
| 1947 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1953 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1948 JSFunction::EnsureLiterals(function); | 1954 JSFunction::EnsureLiterals(function); |
| 1949 } | 1955 } |
| 1950 } | 1956 } |
| 1951 | 1957 |
| 1952 } // namespace internal | 1958 } // namespace internal |
| 1953 } // namespace v8 | 1959 } // namespace v8 |
| OLD | NEW |