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