| 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 if (!info->is_optimizing_from_bytecode()) { | 656 if (!info->is_optimizing_from_bytecode()) { |
| 657 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; | 657 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; |
| 658 EnsureFeedbackMetadata(info); | 658 EnsureFeedbackMetadata(info); |
| 659 } | 659 } |
| 660 | 660 |
| 661 JSFunction::EnsureLiterals(info->closure()); | 661 JSFunction::EnsureLiterals(info->closure()); |
| 662 | 662 |
| 663 TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); | 663 TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); |
| 664 RuntimeCallTimerScope runtimeTimer(isolate, | 664 RuntimeCallTimerScope runtimeTimer(isolate, |
| 665 &RuntimeCallStats::RecompileSynchronous); | 665 &RuntimeCallStats::RecompileSynchronous); |
| 666 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 666 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 667 "V8.RecompileSynchronous"); | 667 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 668 | 668 |
| 669 if (job->CreateGraph() != CompilationJob::SUCCEEDED || | 669 if (job->CreateGraph() != CompilationJob::SUCCEEDED || |
| 670 job->OptimizeGraph() != CompilationJob::SUCCEEDED || | 670 job->OptimizeGraph() != CompilationJob::SUCCEEDED || |
| 671 job->GenerateCode() != CompilationJob::SUCCEEDED) { | 671 job->GenerateCode() != CompilationJob::SUCCEEDED) { |
| 672 if (FLAG_trace_opt) { | 672 if (FLAG_trace_opt) { |
| 673 PrintF("[aborted optimizing "); | 673 PrintF("[aborted optimizing "); |
| 674 info->closure()->ShortPrint(); | 674 info->closure()->ShortPrint(); |
| 675 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); | 675 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); |
| 676 } | 676 } |
| 677 return false; | 677 return false; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 | 719 |
| 720 JSFunction::EnsureLiterals(info->closure()); | 720 JSFunction::EnsureLiterals(info->closure()); |
| 721 | 721 |
| 722 // Reopen handles in the new CompilationHandleScope. | 722 // Reopen handles in the new CompilationHandleScope. |
| 723 info->ReopenHandlesInNewHandleScope(); | 723 info->ReopenHandlesInNewHandleScope(); |
| 724 info->parse_info()->ReopenHandlesInNewHandleScope(); | 724 info->parse_info()->ReopenHandlesInNewHandleScope(); |
| 725 | 725 |
| 726 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 726 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 727 RuntimeCallTimerScope runtimeTimer(info->isolate(), | 727 RuntimeCallTimerScope runtimeTimer(info->isolate(), |
| 728 &RuntimeCallStats::RecompileSynchronous); | 728 &RuntimeCallStats::RecompileSynchronous); |
| 729 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 729 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 730 "V8.RecompileSynchronous"); | 730 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 731 | 731 |
| 732 if (job->CreateGraph() != CompilationJob::SUCCEEDED) return false; | 732 if (job->CreateGraph() != CompilationJob::SUCCEEDED) return false; |
| 733 isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); | 733 isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); |
| 734 | 734 |
| 735 if (FLAG_trace_concurrent_recompilation) { | 735 if (FLAG_trace_concurrent_recompilation) { |
| 736 PrintF(" ** Queued "); | 736 PrintF(" ** Queued "); |
| 737 info->closure()->ShortPrint(); | 737 info->closure()->ShortPrint(); |
| 738 PrintF(" for concurrent optimization.\n"); | 738 PrintF(" for concurrent optimization.\n"); |
| 739 } | 739 } |
| 740 return true; | 740 return true; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 const int kMaxOptCount = | 793 const int kMaxOptCount = |
| 794 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; | 794 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
| 795 if (info->shared_info()->opt_count() > kMaxOptCount) { | 795 if (info->shared_info()->opt_count() > kMaxOptCount) { |
| 796 info->AbortOptimization(kOptimizedTooManyTimes); | 796 info->AbortOptimization(kOptimizedTooManyTimes); |
| 797 return MaybeHandle<Code>(); | 797 return MaybeHandle<Code>(); |
| 798 } | 798 } |
| 799 | 799 |
| 800 CanonicalHandleScope canonical(isolate); | 800 CanonicalHandleScope canonical(isolate); |
| 801 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); | 801 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); |
| 802 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); | 802 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); |
| 803 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode"); | 803 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 804 isolate, &tracing::TraceEventStatsTable::OptimizeCode); |
| 804 | 805 |
| 805 // TurboFan can optimize directly from existing bytecode. | 806 // TurboFan can optimize directly from existing bytecode. |
| 806 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { | 807 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { |
| 807 if (!Compiler::EnsureBytecode(info)) { | 808 if (!Compiler::EnsureBytecode(info)) { |
| 808 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); | 809 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); |
| 809 return MaybeHandle<Code>(); | 810 return MaybeHandle<Code>(); |
| 810 } | 811 } |
| 811 info->MarkAsOptimizeFromBytecode(); | 812 info->MarkAsOptimizeFromBytecode(); |
| 812 } | 813 } |
| 813 | 814 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 return info.code(); | 987 return info.code(); |
| 987 } | 988 } |
| 988 | 989 |
| 989 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { | 990 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { |
| 990 Isolate* isolate = function->GetIsolate(); | 991 Isolate* isolate = function->GetIsolate(); |
| 991 DCHECK(!isolate->has_pending_exception()); | 992 DCHECK(!isolate->has_pending_exception()); |
| 992 DCHECK(!function->is_compiled()); | 993 DCHECK(!function->is_compiled()); |
| 993 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); | 994 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); |
| 994 RuntimeCallTimerScope runtimeTimer(isolate, | 995 RuntimeCallTimerScope runtimeTimer(isolate, |
| 995 &RuntimeCallStats::CompileCodeLazy); | 996 &RuntimeCallStats::CompileCodeLazy); |
| 996 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 997 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 998 isolate, &tracing::TraceEventStatsTable::CompileCodeLazy); |
| 997 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); | 999 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); |
| 998 | 1000 |
| 999 if (FLAG_turbo_cache_shared_code) { | 1001 if (FLAG_turbo_cache_shared_code) { |
| 1000 Handle<Code> cached_code; | 1002 Handle<Code> cached_code; |
| 1001 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) | 1003 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) |
| 1002 .ToHandle(&cached_code)) { | 1004 .ToHandle(&cached_code)) { |
| 1003 if (FLAG_trace_opt) { | 1005 if (FLAG_trace_opt) { |
| 1004 PrintF("[found optimized code for "); | 1006 PrintF("[found optimized code for "); |
| 1005 function->ShortPrint(); | 1007 function->ShortPrint(); |
| 1006 PrintF(" during unoptimized compile]\n"); | 1008 PrintF(" during unoptimized compile]\n"); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 code, scope_info); | 1043 code, scope_info); |
| 1042 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); | 1044 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); |
| 1043 SharedFunctionInfo::SetScript(result, script); | 1045 SharedFunctionInfo::SetScript(result, script); |
| 1044 return result; | 1046 return result; |
| 1045 } | 1047 } |
| 1046 | 1048 |
| 1047 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { | 1049 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { |
| 1048 Isolate* isolate = info->isolate(); | 1050 Isolate* isolate = info->isolate(); |
| 1049 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1051 TimerEventScope<TimerEventCompileCode> timer(isolate); |
| 1050 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1052 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
| 1051 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1053 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1054 isolate, &tracing::TraceEventStatsTable::CompileCode); |
| 1052 PostponeInterruptsScope postpone(isolate); | 1055 PostponeInterruptsScope postpone(isolate); |
| 1053 DCHECK(!isolate->native_context().is_null()); | 1056 DCHECK(!isolate->native_context().is_null()); |
| 1054 ParseInfo* parse_info = info->parse_info(); | 1057 ParseInfo* parse_info = info->parse_info(); |
| 1055 Handle<Script> script = parse_info->script(); | 1058 Handle<Script> script = parse_info->script(); |
| 1056 | 1059 |
| 1057 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? | 1060 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? |
| 1058 FixedArray* array = isolate->native_context()->embedder_data(); | 1061 FixedArray* array = isolate->native_context()->embedder_data(); |
| 1059 script->set_context_data(array->get(v8::Context::kDebugIdIndex)); | 1062 script->set_context_data(array->get(v8::Context::kDebugIdIndex)); |
| 1060 | 1063 |
| 1061 isolate->debug()->OnBeforeCompile(script); | 1064 isolate->debug()->OnBeforeCompile(script); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 // Measure how long it takes to do the compilation; only take the | 1111 // Measure how long it takes to do the compilation; only take the |
| 1109 // rest of the function into account to avoid overlap with the | 1112 // rest of the function into account to avoid overlap with the |
| 1110 // parsing statistics. | 1113 // parsing statistics. |
| 1111 RuntimeCallTimerScope runtimeTimer( | 1114 RuntimeCallTimerScope runtimeTimer( |
| 1112 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval | 1115 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval |
| 1113 : &RuntimeCallStats::Compile); | 1116 : &RuntimeCallStats::Compile); |
| 1114 HistogramTimer* rate = parse_info->is_eval() | 1117 HistogramTimer* rate = parse_info->is_eval() |
| 1115 ? info->isolate()->counters()->compile_eval() | 1118 ? info->isolate()->counters()->compile_eval() |
| 1116 : info->isolate()->counters()->compile(); | 1119 : info->isolate()->counters()->compile(); |
| 1117 HistogramTimerScope timer(rate); | 1120 HistogramTimerScope timer(rate); |
| 1118 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1121 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1119 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); | 1122 isolate, |
| 1123 (parse_info->is_eval() ? &tracing::TraceEventStatsTable::CompileEval |
| 1124 : &tracing::TraceEventStatsTable::Compile)); |
| 1120 | 1125 |
| 1121 // Allocate a shared function info object. | 1126 // Allocate a shared function info object. |
| 1122 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); | 1127 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); |
| 1123 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); | 1128 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); |
| 1124 result->set_is_toplevel(true); | 1129 result->set_is_toplevel(true); |
| 1125 if (parse_info->is_eval()) { | 1130 if (parse_info->is_eval()) { |
| 1126 // Eval scripts cannot be (re-)compiled without context. | 1131 // Eval scripts cannot be (re-)compiled without context. |
| 1127 result->set_allows_lazy_compilation_without_context(false); | 1132 result->set_allows_lazy_compilation_without_context(false); |
| 1128 } | 1133 } |
| 1129 parse_info->set_shared_info(result); | 1134 parse_info->set_shared_info(result); |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 maybe_result = compilation_cache->LookupScript( | 1584 maybe_result = compilation_cache->LookupScript( |
| 1580 source, script_name, line_offset, column_offset, resource_options, | 1585 source, script_name, line_offset, column_offset, resource_options, |
| 1581 context, language_mode); | 1586 context, language_mode); |
| 1582 if (maybe_result.is_null() && FLAG_serialize_toplevel && | 1587 if (maybe_result.is_null() && FLAG_serialize_toplevel && |
| 1583 compile_options == ScriptCompiler::kConsumeCodeCache && | 1588 compile_options == ScriptCompiler::kConsumeCodeCache && |
| 1584 !isolate->debug()->is_loaded()) { | 1589 !isolate->debug()->is_loaded()) { |
| 1585 // Then check cached code provided by embedder. | 1590 // Then check cached code provided by embedder. |
| 1586 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); | 1591 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); |
| 1587 RuntimeCallTimerScope runtimeTimer(isolate, | 1592 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1588 &RuntimeCallStats::CompileDeserialize); | 1593 &RuntimeCallStats::CompileDeserialize); |
| 1589 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1594 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1590 "V8.CompileDeserialize"); | 1595 isolate, &tracing::TraceEventStatsTable::CompileDeserialize); |
| 1591 Handle<SharedFunctionInfo> result; | 1596 Handle<SharedFunctionInfo> result; |
| 1592 if (CodeSerializer::Deserialize(isolate, *cached_data, source) | 1597 if (CodeSerializer::Deserialize(isolate, *cached_data, source) |
| 1593 .ToHandle(&result)) { | 1598 .ToHandle(&result)) { |
| 1594 // Promote to per-isolate compilation cache. | 1599 // Promote to per-isolate compilation cache. |
| 1595 compilation_cache->PutScript(source, context, language_mode, result); | 1600 compilation_cache->PutScript(source, context, language_mode, result); |
| 1596 return result; | 1601 return result; |
| 1597 } | 1602 } |
| 1598 // Deserializer failed. Fall through to compile. | 1603 // Deserializer failed. Fall through to compile. |
| 1599 } | 1604 } |
| 1600 } | 1605 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); | 1658 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); |
| 1654 result = CompileToplevel(&info); | 1659 result = CompileToplevel(&info); |
| 1655 if (extension == NULL && !result.is_null()) { | 1660 if (extension == NULL && !result.is_null()) { |
| 1656 compilation_cache->PutScript(source, context, language_mode, result); | 1661 compilation_cache->PutScript(source, context, language_mode, result); |
| 1657 if (FLAG_serialize_toplevel && | 1662 if (FLAG_serialize_toplevel && |
| 1658 compile_options == ScriptCompiler::kProduceCodeCache) { | 1663 compile_options == ScriptCompiler::kProduceCodeCache) { |
| 1659 HistogramTimerScope histogram_timer( | 1664 HistogramTimerScope histogram_timer( |
| 1660 isolate->counters()->compile_serialize()); | 1665 isolate->counters()->compile_serialize()); |
| 1661 RuntimeCallTimerScope runtimeTimer(isolate, | 1666 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1662 &RuntimeCallStats::CompileSerialize); | 1667 &RuntimeCallStats::CompileSerialize); |
| 1663 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1668 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1664 "V8.CompileSerialize"); | 1669 isolate, &tracing::TraceEventStatsTable::CompileSerialize); |
| 1665 *cached_data = CodeSerializer::Serialize(isolate, result, source); | 1670 *cached_data = CodeSerializer::Serialize(isolate, result, source); |
| 1666 if (FLAG_profile_deserialization) { | 1671 if (FLAG_profile_deserialization) { |
| 1667 PrintF("[Compiling and serializing took %0.3f ms]\n", | 1672 PrintF("[Compiling and serializing took %0.3f ms]\n", |
| 1668 timer.Elapsed().InMillisecondsF()); | 1673 timer.Elapsed().InMillisecondsF()); |
| 1669 } | 1674 } |
| 1670 } | 1675 } |
| 1671 } | 1676 } |
| 1672 | 1677 |
| 1673 if (result.is_null()) { | 1678 if (result.is_null()) { |
| 1674 isolate->ReportPendingMessages(); | 1679 isolate->ReportPendingMessages(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 // Consider compiling eagerly when targeting the code cache. | 1776 // Consider compiling eagerly when targeting the code cache. |
| 1772 lazy &= !(FLAG_serialize_eager && info.will_serialize()); | 1777 lazy &= !(FLAG_serialize_eager && info.will_serialize()); |
| 1773 | 1778 |
| 1774 // Consider compiling eagerly when compiling bytecode for Ignition. | 1779 // Consider compiling eagerly when compiling bytecode for Ignition. |
| 1775 lazy &= | 1780 lazy &= |
| 1776 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); | 1781 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); |
| 1777 | 1782 |
| 1778 // Generate code | 1783 // Generate code |
| 1779 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1784 TimerEventScope<TimerEventCompileCode> timer(isolate); |
| 1780 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1785 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
| 1781 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1786 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1787 isolate, &tracing::TraceEventStatsTable::CompileCode); |
| 1782 if (lazy) { | 1788 if (lazy) { |
| 1783 info.SetCode(isolate->builtins()->CompileLazy()); | 1789 info.SetCode(isolate->builtins()->CompileLazy()); |
| 1784 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { | 1790 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { |
| 1785 // Code generation will ensure that the feedback vector is present and | 1791 // Code generation will ensure that the feedback vector is present and |
| 1786 // appropriately sized. | 1792 // appropriately sized. |
| 1787 DCHECK(!info.code().is_null()); | 1793 DCHECK(!info.code().is_null()); |
| 1788 if (literal->should_eager_compile() && | 1794 if (literal->should_eager_compile() && |
| 1789 literal->should_be_used_once_hint()) { | 1795 literal->should_be_used_once_hint()) { |
| 1790 info.code()->MarkToBeExecutedOnce(isolate); | 1796 info.code()->MarkToBeExecutedOnce(isolate); |
| 1791 } | 1797 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 void Compiler::FinalizeCompilationJob(CompilationJob* raw_job) { | 1852 void Compiler::FinalizeCompilationJob(CompilationJob* raw_job) { |
| 1847 // Take ownership of compilation job. Deleting job also tears down the zone. | 1853 // Take ownership of compilation job. Deleting job also tears down the zone. |
| 1848 std::unique_ptr<CompilationJob> job(raw_job); | 1854 std::unique_ptr<CompilationJob> job(raw_job); |
| 1849 CompilationInfo* info = job->info(); | 1855 CompilationInfo* info = job->info(); |
| 1850 Isolate* isolate = info->isolate(); | 1856 Isolate* isolate = info->isolate(); |
| 1851 | 1857 |
| 1852 VMState<COMPILER> state(isolate); | 1858 VMState<COMPILER> state(isolate); |
| 1853 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 1859 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 1854 RuntimeCallTimerScope runtimeTimer(isolate, | 1860 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1855 &RuntimeCallStats::RecompileSynchronous); | 1861 &RuntimeCallStats::RecompileSynchronous); |
| 1856 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1862 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1857 "V8.RecompileSynchronous"); | 1863 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 1858 | 1864 |
| 1859 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1865 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 1860 shared->code()->set_profiler_ticks(0); | 1866 shared->code()->set_profiler_ticks(0); |
| 1861 | 1867 |
| 1862 DCHECK(!shared->HasDebugInfo()); | 1868 DCHECK(!shared->HasDebugInfo()); |
| 1863 | 1869 |
| 1864 // 1) Optimization on the concurrent thread may have failed. | 1870 // 1) Optimization on the concurrent thread may have failed. |
| 1865 // 2) The function may have already been optimized by OSR. Simply continue. | 1871 // 2) The function may have already been optimized by OSR. Simply continue. |
| 1866 // Except when OSR already disabled optimization for some reason. | 1872 // Except when OSR already disabled optimization for some reason. |
| 1867 // 3) The code may have already been invalidated due to dependency change. | 1873 // 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... |
| 1918 DCHECK(shared->is_compiled()); | 1924 DCHECK(shared->is_compiled()); |
| 1919 function->set_literals(cached.literals); | 1925 function->set_literals(cached.literals); |
| 1920 } else if (shared->is_compiled()) { | 1926 } else if (shared->is_compiled()) { |
| 1921 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1927 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1922 JSFunction::EnsureLiterals(function); | 1928 JSFunction::EnsureLiterals(function); |
| 1923 } | 1929 } |
| 1924 } | 1930 } |
| 1925 | 1931 |
| 1926 } // namespace internal | 1932 } // namespace internal |
| 1927 } // namespace v8 | 1933 } // namespace v8 |
| OLD | NEW |