| 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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 if (!info->is_optimizing_from_bytecode()) { | 729 if (!info->is_optimizing_from_bytecode()) { |
| 730 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; | 730 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; |
| 731 EnsureFeedbackMetadata(info); | 731 EnsureFeedbackMetadata(info); |
| 732 } | 732 } |
| 733 | 733 |
| 734 JSFunction::EnsureLiterals(info->closure()); | 734 JSFunction::EnsureLiterals(info->closure()); |
| 735 | 735 |
| 736 TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); | 736 TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); |
| 737 RuntimeCallTimerScope runtimeTimer(isolate, | 737 RuntimeCallTimerScope runtimeTimer(isolate, |
| 738 &RuntimeCallStats::RecompileSynchronous); | 738 &RuntimeCallStats::RecompileSynchronous); |
| 739 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 740 "V8.RecompileSynchronous"); |
| 739 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 741 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 740 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); | 742 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 741 | 743 |
| 742 if (job->PrepareJob() != CompilationJob::SUCCEEDED || | 744 if (job->PrepareJob() != CompilationJob::SUCCEEDED || |
| 743 job->ExecuteJob() != CompilationJob::SUCCEEDED || | 745 job->ExecuteJob() != CompilationJob::SUCCEEDED || |
| 744 job->FinalizeJob() != CompilationJob::SUCCEEDED) { | 746 job->FinalizeJob() != CompilationJob::SUCCEEDED) { |
| 745 if (FLAG_trace_opt) { | 747 if (FLAG_trace_opt) { |
| 746 PrintF("[aborted optimizing "); | 748 PrintF("[aborted optimizing "); |
| 747 info->closure()->ShortPrint(); | 749 info->closure()->ShortPrint(); |
| 748 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); | 750 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 if (!info->is_optimizing_from_bytecode()) { | 786 if (!info->is_optimizing_from_bytecode()) { |
| 785 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; | 787 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; |
| 786 EnsureFeedbackMetadata(info); | 788 EnsureFeedbackMetadata(info); |
| 787 } | 789 } |
| 788 | 790 |
| 789 JSFunction::EnsureLiterals(info->closure()); | 791 JSFunction::EnsureLiterals(info->closure()); |
| 790 | 792 |
| 791 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 793 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 792 RuntimeCallTimerScope runtimeTimer(info->isolate(), | 794 RuntimeCallTimerScope runtimeTimer(info->isolate(), |
| 793 &RuntimeCallStats::RecompileSynchronous); | 795 &RuntimeCallStats::RecompileSynchronous); |
| 796 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 797 "V8.RecompileSynchronous"); |
| 794 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 798 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 795 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); | 799 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 796 | 800 |
| 797 if (job->PrepareJob() != CompilationJob::SUCCEEDED) return false; | 801 if (job->PrepareJob() != CompilationJob::SUCCEEDED) return false; |
| 798 isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); | 802 isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); |
| 799 | 803 |
| 800 if (FLAG_trace_concurrent_recompilation) { | 804 if (FLAG_trace_concurrent_recompilation) { |
| 801 PrintF(" ** Queued "); | 805 PrintF(" ** Queued "); |
| 802 info->closure()->ShortPrint(); | 806 info->closure()->ShortPrint(); |
| 803 PrintF(" for concurrent optimization.\n"); | 807 PrintF(" for concurrent optimization.\n"); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 // Limit the number of times we try to optimize functions. | 866 // Limit the number of times we try to optimize functions. |
| 863 const int kMaxOptCount = | 867 const int kMaxOptCount = |
| 864 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; | 868 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
| 865 if (info->shared_info()->opt_count() > kMaxOptCount) { | 869 if (info->shared_info()->opt_count() > kMaxOptCount) { |
| 866 info->AbortOptimization(kOptimizedTooManyTimes); | 870 info->AbortOptimization(kOptimizedTooManyTimes); |
| 867 return MaybeHandle<Code>(); | 871 return MaybeHandle<Code>(); |
| 868 } | 872 } |
| 869 | 873 |
| 870 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); | 874 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); |
| 871 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); | 875 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); |
| 876 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode"); |
| 872 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 877 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 873 isolate, &tracing::TraceEventStatsTable::OptimizeCode); | 878 isolate, &tracing::TraceEventStatsTable::OptimizeCode); |
| 874 | 879 |
| 875 // TurboFan can optimize directly from existing bytecode. | 880 // TurboFan can optimize directly from existing bytecode. |
| 876 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { | 881 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { |
| 877 if (!Compiler::EnsureBytecode(info)) { | 882 if (!Compiler::EnsureBytecode(info)) { |
| 878 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); | 883 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); |
| 879 return MaybeHandle<Code>(); | 884 return MaybeHandle<Code>(); |
| 880 } | 885 } |
| 881 info->MarkAsOptimizeFromBytecode(); | 886 info->MarkAsOptimizeFromBytecode(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 return MaybeHandle<Code>(); | 923 return MaybeHandle<Code>(); |
| 919 } | 924 } |
| 920 | 925 |
| 921 CompilationJob::Status FinalizeOptimizedCompilationJob(CompilationJob* job) { | 926 CompilationJob::Status FinalizeOptimizedCompilationJob(CompilationJob* job) { |
| 922 CompilationInfo* info = job->info(); | 927 CompilationInfo* info = job->info(); |
| 923 Isolate* isolate = info->isolate(); | 928 Isolate* isolate = info->isolate(); |
| 924 | 929 |
| 925 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 930 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 926 RuntimeCallTimerScope runtimeTimer(isolate, | 931 RuntimeCallTimerScope runtimeTimer(isolate, |
| 927 &RuntimeCallStats::RecompileSynchronous); | 932 &RuntimeCallStats::RecompileSynchronous); |
| 933 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 934 "V8.RecompileSynchronous"); |
| 928 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 935 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 929 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); | 936 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); |
| 930 | 937 |
| 931 Handle<SharedFunctionInfo> shared = info->shared_info(); | 938 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 932 shared->code()->set_profiler_ticks(0); | 939 shared->code()->set_profiler_ticks(0); |
| 933 | 940 |
| 934 DCHECK(!shared->HasDebugInfo()); | 941 DCHECK(!shared->HasDebugInfo()); |
| 935 | 942 |
| 936 // 1) Optimization on the concurrent thread may have failed. | 943 // 1) Optimization on the concurrent thread may have failed. |
| 937 // 2) The function may have already been optimized by OSR. Simply continue. | 944 // 2) The function may have already been optimized by OSR. Simply continue. |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 return info.code(); | 1142 return info.code(); |
| 1136 } | 1143 } |
| 1137 | 1144 |
| 1138 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { | 1145 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { |
| 1139 Isolate* isolate = function->GetIsolate(); | 1146 Isolate* isolate = function->GetIsolate(); |
| 1140 DCHECK(!isolate->has_pending_exception()); | 1147 DCHECK(!isolate->has_pending_exception()); |
| 1141 DCHECK(!function->is_compiled()); | 1148 DCHECK(!function->is_compiled()); |
| 1142 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); | 1149 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); |
| 1143 RuntimeCallTimerScope runtimeTimer(isolate, | 1150 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1144 &RuntimeCallStats::CompileCodeLazy); | 1151 &RuntimeCallStats::CompileCodeLazy); |
| 1152 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); |
| 1145 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 1153 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1146 isolate, &tracing::TraceEventStatsTable::CompileCodeLazy); | 1154 isolate, &tracing::TraceEventStatsTable::CompileCodeLazy); |
| 1147 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); | 1155 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); |
| 1148 | 1156 |
| 1149 if (FLAG_turbo_cache_shared_code) { | 1157 if (FLAG_turbo_cache_shared_code) { |
| 1150 Handle<Code> cached_code; | 1158 Handle<Code> cached_code; |
| 1151 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) | 1159 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) |
| 1152 .ToHandle(&cached_code)) { | 1160 .ToHandle(&cached_code)) { |
| 1153 if (FLAG_trace_opt) { | 1161 if (FLAG_trace_opt) { |
| 1154 PrintF("[found optimized code for "); | 1162 PrintF("[found optimized code for "); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 code, scope_info); | 1205 code, scope_info); |
| 1198 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); | 1206 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); |
| 1199 SharedFunctionInfo::SetScript(result, script); | 1207 SharedFunctionInfo::SetScript(result, script); |
| 1200 return result; | 1208 return result; |
| 1201 } | 1209 } |
| 1202 | 1210 |
| 1203 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { | 1211 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { |
| 1204 Isolate* isolate = info->isolate(); | 1212 Isolate* isolate = info->isolate(); |
| 1205 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1213 TimerEventScope<TimerEventCompileCode> timer(isolate); |
| 1206 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1214 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
| 1215 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); |
| 1207 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 1216 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1208 isolate, &tracing::TraceEventStatsTable::CompileCode); | 1217 isolate, &tracing::TraceEventStatsTable::CompileCode); |
| 1209 PostponeInterruptsScope postpone(isolate); | 1218 PostponeInterruptsScope postpone(isolate); |
| 1210 DCHECK(!isolate->native_context().is_null()); | 1219 DCHECK(!isolate->native_context().is_null()); |
| 1211 ParseInfo* parse_info = info->parse_info(); | 1220 ParseInfo* parse_info = info->parse_info(); |
| 1212 Handle<Script> script = parse_info->script(); | 1221 Handle<Script> script = parse_info->script(); |
| 1213 | 1222 |
| 1214 // Create a canonical handle scope before internalizing parsed values if | 1223 // Create a canonical handle scope before internalizing parsed values if |
| 1215 // compiling bytecode. This is required for off-thread bytecode generation. | 1224 // compiling bytecode. This is required for off-thread bytecode generation. |
| 1216 std::unique_ptr<CanonicalHandleScope> canonical; | 1225 std::unique_ptr<CanonicalHandleScope> canonical; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 // Measure how long it takes to do the compilation; only take the | 1280 // Measure how long it takes to do the compilation; only take the |
| 1272 // rest of the function into account to avoid overlap with the | 1281 // rest of the function into account to avoid overlap with the |
| 1273 // parsing statistics. | 1282 // parsing statistics. |
| 1274 RuntimeCallTimerScope runtimeTimer( | 1283 RuntimeCallTimerScope runtimeTimer( |
| 1275 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval | 1284 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval |
| 1276 : &RuntimeCallStats::Compile); | 1285 : &RuntimeCallStats::Compile); |
| 1277 HistogramTimer* rate = parse_info->is_eval() | 1286 HistogramTimer* rate = parse_info->is_eval() |
| 1278 ? info->isolate()->counters()->compile_eval() | 1287 ? info->isolate()->counters()->compile_eval() |
| 1279 : info->isolate()->counters()->compile(); | 1288 : info->isolate()->counters()->compile(); |
| 1280 HistogramTimerScope timer(rate); | 1289 HistogramTimerScope timer(rate); |
| 1290 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 1291 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); |
| 1281 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 1292 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1282 isolate, | 1293 isolate, |
| 1283 (parse_info->is_eval() ? &tracing::TraceEventStatsTable::CompileEval | 1294 (parse_info->is_eval() ? &tracing::TraceEventStatsTable::CompileEval |
| 1284 : &tracing::TraceEventStatsTable::Compile)); | 1295 : &tracing::TraceEventStatsTable::Compile)); |
| 1285 | 1296 |
| 1286 // Allocate a shared function info object. | 1297 // Allocate a shared function info object. |
| 1287 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); | 1298 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); |
| 1288 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); | 1299 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); |
| 1289 result->set_is_toplevel(true); | 1300 result->set_is_toplevel(true); |
| 1290 if (parse_info->is_eval()) { | 1301 if (parse_info->is_eval()) { |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 maybe_result = compilation_cache->LookupScript( | 1768 maybe_result = compilation_cache->LookupScript( |
| 1758 source, script_name, line_offset, column_offset, resource_options, | 1769 source, script_name, line_offset, column_offset, resource_options, |
| 1759 context, language_mode); | 1770 context, language_mode); |
| 1760 if (maybe_result.is_null() && FLAG_serialize_toplevel && | 1771 if (maybe_result.is_null() && FLAG_serialize_toplevel && |
| 1761 compile_options == ScriptCompiler::kConsumeCodeCache && | 1772 compile_options == ScriptCompiler::kConsumeCodeCache && |
| 1762 !isolate->debug()->is_loaded()) { | 1773 !isolate->debug()->is_loaded()) { |
| 1763 // Then check cached code provided by embedder. | 1774 // Then check cached code provided by embedder. |
| 1764 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); | 1775 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); |
| 1765 RuntimeCallTimerScope runtimeTimer(isolate, | 1776 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1766 &RuntimeCallStats::CompileDeserialize); | 1777 &RuntimeCallStats::CompileDeserialize); |
| 1778 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 1779 "V8.CompileDeserialize"); |
| 1767 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 1780 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1768 isolate, &tracing::TraceEventStatsTable::CompileDeserialize); | 1781 isolate, &tracing::TraceEventStatsTable::CompileDeserialize); |
| 1769 Handle<SharedFunctionInfo> result; | 1782 Handle<SharedFunctionInfo> result; |
| 1770 if (CodeSerializer::Deserialize(isolate, *cached_data, source) | 1783 if (CodeSerializer::Deserialize(isolate, *cached_data, source) |
| 1771 .ToHandle(&result)) { | 1784 .ToHandle(&result)) { |
| 1772 // Promote to per-isolate compilation cache. | 1785 // Promote to per-isolate compilation cache. |
| 1773 compilation_cache->PutScript(source, context, language_mode, result); | 1786 compilation_cache->PutScript(source, context, language_mode, result); |
| 1774 return result; | 1787 return result; |
| 1775 } | 1788 } |
| 1776 // Deserializer failed. Fall through to compile. | 1789 // Deserializer failed. Fall through to compile. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); | 1844 static_cast<LanguageMode>(parse_info.language_mode() | language_mode)); |
| 1832 result = CompileToplevel(&info); | 1845 result = CompileToplevel(&info); |
| 1833 if (extension == NULL && !result.is_null()) { | 1846 if (extension == NULL && !result.is_null()) { |
| 1834 compilation_cache->PutScript(source, context, language_mode, result); | 1847 compilation_cache->PutScript(source, context, language_mode, result); |
| 1835 if (FLAG_serialize_toplevel && | 1848 if (FLAG_serialize_toplevel && |
| 1836 compile_options == ScriptCompiler::kProduceCodeCache) { | 1849 compile_options == ScriptCompiler::kProduceCodeCache) { |
| 1837 HistogramTimerScope histogram_timer( | 1850 HistogramTimerScope histogram_timer( |
| 1838 isolate->counters()->compile_serialize()); | 1851 isolate->counters()->compile_serialize()); |
| 1839 RuntimeCallTimerScope runtimeTimer(isolate, | 1852 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1840 &RuntimeCallStats::CompileSerialize); | 1853 &RuntimeCallStats::CompileSerialize); |
| 1854 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 1855 "V8.CompileSerialize"); |
| 1841 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 1856 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1842 isolate, &tracing::TraceEventStatsTable::CompileSerialize); | 1857 isolate, &tracing::TraceEventStatsTable::CompileSerialize); |
| 1843 *cached_data = CodeSerializer::Serialize(isolate, result, source); | 1858 *cached_data = CodeSerializer::Serialize(isolate, result, source); |
| 1844 if (FLAG_profile_deserialization) { | 1859 if (FLAG_profile_deserialization) { |
| 1845 PrintF("[Compiling and serializing took %0.3f ms]\n", | 1860 PrintF("[Compiling and serializing took %0.3f ms]\n", |
| 1846 timer.Elapsed().InMillisecondsF()); | 1861 timer.Elapsed().InMillisecondsF()); |
| 1847 } | 1862 } |
| 1848 } | 1863 } |
| 1849 } | 1864 } |
| 1850 | 1865 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 // Consider compiling eagerly when targeting the code cache. | 1965 // Consider compiling eagerly when targeting the code cache. |
| 1951 lazy &= !(FLAG_serialize_eager && info.will_serialize()); | 1966 lazy &= !(FLAG_serialize_eager && info.will_serialize()); |
| 1952 | 1967 |
| 1953 // Consider compiling eagerly when compiling bytecode for Ignition. | 1968 // Consider compiling eagerly when compiling bytecode for Ignition. |
| 1954 lazy &= | 1969 lazy &= |
| 1955 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); | 1970 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); |
| 1956 | 1971 |
| 1957 // Generate code | 1972 // Generate code |
| 1958 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1973 TimerEventScope<TimerEventCompileCode> timer(isolate); |
| 1959 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1974 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
| 1975 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); |
| 1960 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 1976 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1961 isolate, &tracing::TraceEventStatsTable::CompileCode); | 1977 isolate, &tracing::TraceEventStatsTable::CompileCode); |
| 1962 | 1978 |
| 1963 // Create a canonical handle scope if compiling ignition bytecode. This is | 1979 // Create a canonical handle scope if compiling ignition bytecode. This is |
| 1964 // required by the constant array builder to de-duplicate common objects | 1980 // required by the constant array builder to de-duplicate common objects |
| 1965 // without dereferencing handles. | 1981 // without dereferencing handles. |
| 1966 std::unique_ptr<CanonicalHandleScope> canonical; | 1982 std::unique_ptr<CanonicalHandleScope> canonical; |
| 1967 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info.isolate())); | 1983 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info.isolate())); |
| 1968 | 1984 |
| 1969 if (lazy) { | 1985 if (lazy) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 DCHECK(shared->is_compiled()); | 2091 DCHECK(shared->is_compiled()); |
| 2076 function->set_literals(cached.literals); | 2092 function->set_literals(cached.literals); |
| 2077 } else if (shared->is_compiled()) { | 2093 } else if (shared->is_compiled()) { |
| 2078 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 2094 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 2079 JSFunction::EnsureLiterals(function); | 2095 JSFunction::EnsureLiterals(function); |
| 2080 } | 2096 } |
| 2081 } | 2097 } |
| 2082 | 2098 |
| 2083 } // namespace internal | 2099 } // namespace internal |
| 2084 } // namespace v8 | 2100 } // namespace v8 |
| OLD | NEW |