| 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 if (!info->is_optimizing_from_bytecode()) { | 660 if (!info->is_optimizing_from_bytecode()) { |
| 661 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; | 661 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; |
| 662 EnsureFeedbackMetadata(info); | 662 EnsureFeedbackMetadata(info); |
| 663 } | 663 } |
| 664 | 664 |
| 665 JSFunction::EnsureLiterals(info->closure()); | 665 JSFunction::EnsureLiterals(info->closure()); |
| 666 | 666 |
| 667 TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); | 667 TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); |
| 668 RuntimeCallTimerScope runtimeTimer(isolate, | 668 RuntimeCallTimerScope runtimeTimer(isolate, |
| 669 &RuntimeCallStats::RecompileSynchronous); | 669 &RuntimeCallStats::RecompileSynchronous); |
| 670 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 670 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 671 "V8.RecompileSynchronous"); | 671 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 672 | 672 |
| 673 if (job->CreateGraph() != CompilationJob::SUCCEEDED || | 673 if (job->CreateGraph() != CompilationJob::SUCCEEDED || |
| 674 job->OptimizeGraph() != CompilationJob::SUCCEEDED || | 674 job->OptimizeGraph() != CompilationJob::SUCCEEDED || |
| 675 job->GenerateCode() != CompilationJob::SUCCEEDED) { | 675 job->GenerateCode() != CompilationJob::SUCCEEDED) { |
| 676 if (FLAG_trace_opt) { | 676 if (FLAG_trace_opt) { |
| 677 PrintF("[aborted optimizing "); | 677 PrintF("[aborted optimizing "); |
| 678 info->closure()->ShortPrint(); | 678 info->closure()->ShortPrint(); |
| 679 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); | 679 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); |
| 680 } | 680 } |
| 681 return false; | 681 return false; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 | 723 |
| 724 JSFunction::EnsureLiterals(info->closure()); | 724 JSFunction::EnsureLiterals(info->closure()); |
| 725 | 725 |
| 726 // Reopen handles in the new CompilationHandleScope. | 726 // Reopen handles in the new CompilationHandleScope. |
| 727 info->ReopenHandlesInNewHandleScope(); | 727 info->ReopenHandlesInNewHandleScope(); |
| 728 info->parse_info()->ReopenHandlesInNewHandleScope(); | 728 info->parse_info()->ReopenHandlesInNewHandleScope(); |
| 729 | 729 |
| 730 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 730 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 731 RuntimeCallTimerScope runtimeTimer(info->isolate(), | 731 RuntimeCallTimerScope runtimeTimer(info->isolate(), |
| 732 &RuntimeCallStats::RecompileSynchronous); | 732 &RuntimeCallStats::RecompileSynchronous); |
| 733 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 733 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 734 "V8.RecompileSynchronous"); | 734 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 735 | 735 |
| 736 if (job->CreateGraph() != CompilationJob::SUCCEEDED) return false; | 736 if (job->CreateGraph() != CompilationJob::SUCCEEDED) return false; |
| 737 isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); | 737 isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); |
| 738 | 738 |
| 739 if (FLAG_trace_concurrent_recompilation) { | 739 if (FLAG_trace_concurrent_recompilation) { |
| 740 PrintF(" ** Queued "); | 740 PrintF(" ** Queued "); |
| 741 info->closure()->ShortPrint(); | 741 info->closure()->ShortPrint(); |
| 742 PrintF(" for concurrent optimization.\n"); | 742 PrintF(" for concurrent optimization.\n"); |
| 743 } | 743 } |
| 744 return true; | 744 return true; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 const int kMaxOptCount = | 802 const int kMaxOptCount = |
| 803 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; | 803 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
| 804 if (info->shared_info()->opt_count() > kMaxOptCount) { | 804 if (info->shared_info()->opt_count() > kMaxOptCount) { |
| 805 info->AbortOptimization(kOptimizedTooManyTimes); | 805 info->AbortOptimization(kOptimizedTooManyTimes); |
| 806 return MaybeHandle<Code>(); | 806 return MaybeHandle<Code>(); |
| 807 } | 807 } |
| 808 | 808 |
| 809 CanonicalHandleScope canonical(isolate); | 809 CanonicalHandleScope canonical(isolate); |
| 810 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); | 810 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); |
| 811 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); | 811 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); |
| 812 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode"); | 812 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 813 isolate, &tracing::TraceEventStatsTable::OptimizeCode); |
| 813 | 814 |
| 814 // TurboFan can optimize directly from existing bytecode. | 815 // TurboFan can optimize directly from existing bytecode. |
| 815 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { | 816 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { |
| 816 if (!Compiler::EnsureBytecode(info)) { | 817 if (!Compiler::EnsureBytecode(info)) { |
| 817 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); | 818 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); |
| 818 return MaybeHandle<Code>(); | 819 return MaybeHandle<Code>(); |
| 819 } | 820 } |
| 820 info->MarkAsOptimizeFromBytecode(); | 821 info->MarkAsOptimizeFromBytecode(); |
| 821 } | 822 } |
| 822 | 823 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 return info.code(); | 996 return info.code(); |
| 996 } | 997 } |
| 997 | 998 |
| 998 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { | 999 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { |
| 999 Isolate* isolate = function->GetIsolate(); | 1000 Isolate* isolate = function->GetIsolate(); |
| 1000 DCHECK(!isolate->has_pending_exception()); | 1001 DCHECK(!isolate->has_pending_exception()); |
| 1001 DCHECK(!function->is_compiled()); | 1002 DCHECK(!function->is_compiled()); |
| 1002 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); | 1003 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); |
| 1003 RuntimeCallTimerScope runtimeTimer(isolate, | 1004 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1004 &RuntimeCallStats::CompileCodeLazy); | 1005 &RuntimeCallStats::CompileCodeLazy); |
| 1005 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1006 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1007 isolate, &tracing::TraceEventStatsTable::CompileCodeLazy); |
| 1006 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); | 1008 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); |
| 1007 | 1009 |
| 1008 if (FLAG_turbo_cache_shared_code) { | 1010 if (FLAG_turbo_cache_shared_code) { |
| 1009 Handle<Code> cached_code; | 1011 Handle<Code> cached_code; |
| 1010 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) | 1012 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) |
| 1011 .ToHandle(&cached_code)) { | 1013 .ToHandle(&cached_code)) { |
| 1012 if (FLAG_trace_opt) { | 1014 if (FLAG_trace_opt) { |
| 1013 PrintF("[found optimized code for "); | 1015 PrintF("[found optimized code for "); |
| 1014 function->ShortPrint(); | 1016 function->ShortPrint(); |
| 1015 PrintF(" during unoptimized compile]\n"); | 1017 PrintF(" during unoptimized compile]\n"); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 code, scope_info); | 1052 code, scope_info); |
| 1051 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); | 1053 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); |
| 1052 SharedFunctionInfo::SetScript(result, script); | 1054 SharedFunctionInfo::SetScript(result, script); |
| 1053 return result; | 1055 return result; |
| 1054 } | 1056 } |
| 1055 | 1057 |
| 1056 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { | 1058 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { |
| 1057 Isolate* isolate = info->isolate(); | 1059 Isolate* isolate = info->isolate(); |
| 1058 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1060 TimerEventScope<TimerEventCompileCode> timer(isolate); |
| 1059 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1061 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
| 1060 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1062 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1063 isolate, &tracing::TraceEventStatsTable::CompileCode); |
| 1061 PostponeInterruptsScope postpone(isolate); | 1064 PostponeInterruptsScope postpone(isolate); |
| 1062 DCHECK(!isolate->native_context().is_null()); | 1065 DCHECK(!isolate->native_context().is_null()); |
| 1063 ParseInfo* parse_info = info->parse_info(); | 1066 ParseInfo* parse_info = info->parse_info(); |
| 1064 Handle<Script> script = parse_info->script(); | 1067 Handle<Script> script = parse_info->script(); |
| 1065 | 1068 |
| 1066 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? | 1069 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? |
| 1067 FixedArray* array = isolate->native_context()->embedder_data(); | 1070 FixedArray* array = isolate->native_context()->embedder_data(); |
| 1068 script->set_context_data(array->get(v8::Context::kDebugIdIndex)); | 1071 script->set_context_data(array->get(v8::Context::kDebugIdIndex)); |
| 1069 | 1072 |
| 1070 isolate->debug()->OnBeforeCompile(script); | 1073 isolate->debug()->OnBeforeCompile(script); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 // Measure how long it takes to do the compilation; only take the | 1120 // Measure how long it takes to do the compilation; only take the |
| 1118 // rest of the function into account to avoid overlap with the | 1121 // rest of the function into account to avoid overlap with the |
| 1119 // parsing statistics. | 1122 // parsing statistics. |
| 1120 RuntimeCallTimerScope runtimeTimer( | 1123 RuntimeCallTimerScope runtimeTimer( |
| 1121 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval | 1124 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval |
| 1122 : &RuntimeCallStats::Compile); | 1125 : &RuntimeCallStats::Compile); |
| 1123 HistogramTimer* rate = parse_info->is_eval() | 1126 HistogramTimer* rate = parse_info->is_eval() |
| 1124 ? info->isolate()->counters()->compile_eval() | 1127 ? info->isolate()->counters()->compile_eval() |
| 1125 : info->isolate()->counters()->compile(); | 1128 : info->isolate()->counters()->compile(); |
| 1126 HistogramTimerScope timer(rate); | 1129 HistogramTimerScope timer(rate); |
| 1127 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1130 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1128 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); | 1131 isolate, |
| 1132 (parse_info->is_eval() ? &tracing::TraceEventStatsTable::CompileEval |
| 1133 : &tracing::TraceEventStatsTable::Compile)); |
| 1129 | 1134 |
| 1130 // Allocate a shared function info object. | 1135 // Allocate a shared function info object. |
| 1131 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); | 1136 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); |
| 1132 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); | 1137 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); |
| 1133 result->set_is_toplevel(true); | 1138 result->set_is_toplevel(true); |
| 1134 if (parse_info->is_eval()) { | 1139 if (parse_info->is_eval()) { |
| 1135 // Eval scripts cannot be (re-)compiled without context. | 1140 // Eval scripts cannot be (re-)compiled without context. |
| 1136 result->set_allows_lazy_compilation_without_context(false); | 1141 result->set_allows_lazy_compilation_without_context(false); |
| 1137 } | 1142 } |
| 1138 parse_info->set_shared_info(result); | 1143 parse_info->set_shared_info(result); |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 maybe_result = compilation_cache->LookupScript( | 1593 maybe_result = compilation_cache->LookupScript( |
| 1589 source, script_name, line_offset, column_offset, resource_options, | 1594 source, script_name, line_offset, column_offset, resource_options, |
| 1590 context, language_mode); | 1595 context, language_mode); |
| 1591 if (maybe_result.is_null() && FLAG_serialize_toplevel && | 1596 if (maybe_result.is_null() && FLAG_serialize_toplevel && |
| 1592 compile_options == ScriptCompiler::kConsumeCodeCache && | 1597 compile_options == ScriptCompiler::kConsumeCodeCache && |
| 1593 !isolate->debug()->is_loaded()) { | 1598 !isolate->debug()->is_loaded()) { |
| 1594 // Then check cached code provided by embedder. | 1599 // Then check cached code provided by embedder. |
| 1595 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); | 1600 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); |
| 1596 RuntimeCallTimerScope runtimeTimer(isolate, | 1601 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1597 &RuntimeCallStats::CompileDeserialize); | 1602 &RuntimeCallStats::CompileDeserialize); |
| 1598 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1603 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1599 "V8.CompileDeserialize"); | 1604 isolate, &tracing::TraceEventStatsTable::CompileDeserialize); |
| 1600 Handle<SharedFunctionInfo> result; | 1605 Handle<SharedFunctionInfo> result; |
| 1601 if (CodeSerializer::Deserialize(isolate, *cached_data, source) | 1606 if (CodeSerializer::Deserialize(isolate, *cached_data, source) |
| 1602 .ToHandle(&result)) { | 1607 .ToHandle(&result)) { |
| 1603 // Promote to per-isolate compilation cache. | 1608 // Promote to per-isolate compilation cache. |
| 1604 compilation_cache->PutScript(source, context, language_mode, result); | 1609 compilation_cache->PutScript(source, context, language_mode, result); |
| 1605 return result; | 1610 return result; |
| 1606 } | 1611 } |
| 1607 // Deserializer failed. Fall through to compile. | 1612 // Deserializer failed. Fall through to compile. |
| 1608 } | 1613 } |
| 1609 } | 1614 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); | 1667 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); |
| 1663 result = CompileToplevel(&info); | 1668 result = CompileToplevel(&info); |
| 1664 if (extension == NULL && !result.is_null()) { | 1669 if (extension == NULL && !result.is_null()) { |
| 1665 compilation_cache->PutScript(source, context, language_mode, result); | 1670 compilation_cache->PutScript(source, context, language_mode, result); |
| 1666 if (FLAG_serialize_toplevel && | 1671 if (FLAG_serialize_toplevel && |
| 1667 compile_options == ScriptCompiler::kProduceCodeCache) { | 1672 compile_options == ScriptCompiler::kProduceCodeCache) { |
| 1668 HistogramTimerScope histogram_timer( | 1673 HistogramTimerScope histogram_timer( |
| 1669 isolate->counters()->compile_serialize()); | 1674 isolate->counters()->compile_serialize()); |
| 1670 RuntimeCallTimerScope runtimeTimer(isolate, | 1675 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1671 &RuntimeCallStats::CompileSerialize); | 1676 &RuntimeCallStats::CompileSerialize); |
| 1672 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1677 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1673 "V8.CompileSerialize"); | 1678 isolate, &tracing::TraceEventStatsTable::CompileSerialize); |
| 1674 *cached_data = CodeSerializer::Serialize(isolate, result, source); | 1679 *cached_data = CodeSerializer::Serialize(isolate, result, source); |
| 1675 if (FLAG_profile_deserialization) { | 1680 if (FLAG_profile_deserialization) { |
| 1676 PrintF("[Compiling and serializing took %0.3f ms]\n", | 1681 PrintF("[Compiling and serializing took %0.3f ms]\n", |
| 1677 timer.Elapsed().InMillisecondsF()); | 1682 timer.Elapsed().InMillisecondsF()); |
| 1678 } | 1683 } |
| 1679 } | 1684 } |
| 1680 } | 1685 } |
| 1681 | 1686 |
| 1682 if (result.is_null()) { | 1687 if (result.is_null()) { |
| 1683 isolate->ReportPendingMessages(); | 1688 isolate->ReportPendingMessages(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1780 // Consider compiling eagerly when targeting the code cache. | 1785 // Consider compiling eagerly when targeting the code cache. |
| 1781 lazy &= !(FLAG_serialize_eager && info.will_serialize()); | 1786 lazy &= !(FLAG_serialize_eager && info.will_serialize()); |
| 1782 | 1787 |
| 1783 // Consider compiling eagerly when compiling bytecode for Ignition. | 1788 // Consider compiling eagerly when compiling bytecode for Ignition. |
| 1784 lazy &= | 1789 lazy &= |
| 1785 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); | 1790 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); |
| 1786 | 1791 |
| 1787 // Generate code | 1792 // Generate code |
| 1788 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1793 TimerEventScope<TimerEventCompileCode> timer(isolate); |
| 1789 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1794 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
| 1790 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1795 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1796 isolate, &tracing::TraceEventStatsTable::CompileCode); |
| 1791 if (lazy) { | 1797 if (lazy) { |
| 1792 info.SetCode(isolate->builtins()->CompileLazy()); | 1798 info.SetCode(isolate->builtins()->CompileLazy()); |
| 1793 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { | 1799 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { |
| 1794 // Code generation will ensure that the feedback vector is present and | 1800 // Code generation will ensure that the feedback vector is present and |
| 1795 // appropriately sized. | 1801 // appropriately sized. |
| 1796 DCHECK(!info.code().is_null()); | 1802 DCHECK(!info.code().is_null()); |
| 1797 if (literal->should_eager_compile() && | 1803 if (literal->should_eager_compile() && |
| 1798 literal->should_be_used_once_hint()) { | 1804 literal->should_be_used_once_hint()) { |
| 1799 info.code()->MarkToBeExecutedOnce(isolate); | 1805 info.code()->MarkToBeExecutedOnce(isolate); |
| 1800 } | 1806 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 void Compiler::FinalizeCompilationJob(CompilationJob* raw_job) { | 1861 void Compiler::FinalizeCompilationJob(CompilationJob* raw_job) { |
| 1856 // Take ownership of compilation job. Deleting job also tears down the zone. | 1862 // Take ownership of compilation job. Deleting job also tears down the zone. |
| 1857 std::unique_ptr<CompilationJob> job(raw_job); | 1863 std::unique_ptr<CompilationJob> job(raw_job); |
| 1858 CompilationInfo* info = job->info(); | 1864 CompilationInfo* info = job->info(); |
| 1859 Isolate* isolate = info->isolate(); | 1865 Isolate* isolate = info->isolate(); |
| 1860 | 1866 |
| 1861 VMState<COMPILER> state(isolate); | 1867 VMState<COMPILER> state(isolate); |
| 1862 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 1868 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 1863 RuntimeCallTimerScope runtimeTimer(isolate, | 1869 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1864 &RuntimeCallStats::RecompileSynchronous); | 1870 &RuntimeCallStats::RecompileSynchronous); |
| 1865 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1871 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1866 "V8.RecompileSynchronous"); | 1872 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 1867 | 1873 |
| 1868 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1874 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 1869 shared->code()->set_profiler_ticks(0); | 1875 shared->code()->set_profiler_ticks(0); |
| 1870 | 1876 |
| 1871 DCHECK(!shared->HasDebugInfo()); | 1877 DCHECK(!shared->HasDebugInfo()); |
| 1872 | 1878 |
| 1873 // 1) Optimization on the concurrent thread may have failed. | 1879 // 1) Optimization on the concurrent thread may have failed. |
| 1874 // 2) The function may have already been optimized by OSR. Simply continue. | 1880 // 2) The function may have already been optimized by OSR. Simply continue. |
| 1875 // Except when OSR already disabled optimization for some reason. | 1881 // Except when OSR already disabled optimization for some reason. |
| 1876 // 3) The code may have already been invalidated due to dependency change. | 1882 // 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... |
| 1927 DCHECK(shared->is_compiled()); | 1933 DCHECK(shared->is_compiled()); |
| 1928 function->set_literals(cached.literals); | 1934 function->set_literals(cached.literals); |
| 1929 } else if (shared->is_compiled()) { | 1935 } else if (shared->is_compiled()) { |
| 1930 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1936 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1931 JSFunction::EnsureLiterals(function); | 1937 JSFunction::EnsureLiterals(function); |
| 1932 } | 1938 } |
| 1933 } | 1939 } |
| 1934 | 1940 |
| 1935 } // namespace internal | 1941 } // namespace internal |
| 1936 } // namespace v8 | 1942 } // namespace v8 |
| OLD | NEW |