| 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 EnsureFeedbackMetadata(info); | 550 EnsureFeedbackMetadata(info); |
| 551 } | 551 } |
| 552 | 552 |
| 553 JSFunction::EnsureLiterals(info->closure()); | 553 JSFunction::EnsureLiterals(info->closure()); |
| 554 | 554 |
| 555 TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); | 555 TimerEventScope<TimerEventRecompileSynchronous> timer(isolate); |
| 556 RuntimeCallTimerScope runtimeTimer(isolate, | 556 RuntimeCallTimerScope runtimeTimer(isolate, |
| 557 &RuntimeCallStats::RecompileSynchronous); | 557 &RuntimeCallStats::RecompileSynchronous); |
| 558 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 558 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 559 "V8.RecompileSynchronous"); | 559 "V8.RecompileSynchronous"); |
| 560 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | |
| 561 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); | |
| 562 | 560 |
| 563 if (job->PrepareJob() != CompilationJob::SUCCEEDED || | 561 if (job->PrepareJob() != CompilationJob::SUCCEEDED || |
| 564 job->ExecuteJob() != CompilationJob::SUCCEEDED || | 562 job->ExecuteJob() != CompilationJob::SUCCEEDED || |
| 565 job->FinalizeJob() != CompilationJob::SUCCEEDED) { | 563 job->FinalizeJob() != CompilationJob::SUCCEEDED) { |
| 566 if (FLAG_trace_opt) { | 564 if (FLAG_trace_opt) { |
| 567 PrintF("[aborted optimizing "); | 565 PrintF("[aborted optimizing "); |
| 568 info->closure()->ShortPrint(); | 566 info->closure()->ShortPrint(); |
| 569 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); | 567 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); |
| 570 } | 568 } |
| 571 return false; | 569 return false; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 EnsureFeedbackMetadata(info); | 605 EnsureFeedbackMetadata(info); |
| 608 } | 606 } |
| 609 | 607 |
| 610 JSFunction::EnsureLiterals(info->closure()); | 608 JSFunction::EnsureLiterals(info->closure()); |
| 611 | 609 |
| 612 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 610 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 613 RuntimeCallTimerScope runtimeTimer(info->isolate(), | 611 RuntimeCallTimerScope runtimeTimer(info->isolate(), |
| 614 &RuntimeCallStats::RecompileSynchronous); | 612 &RuntimeCallStats::RecompileSynchronous); |
| 615 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 613 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 616 "V8.RecompileSynchronous"); | 614 "V8.RecompileSynchronous"); |
| 617 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | |
| 618 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); | |
| 619 | 615 |
| 620 if (job->PrepareJob() != CompilationJob::SUCCEEDED) return false; | 616 if (job->PrepareJob() != CompilationJob::SUCCEEDED) return false; |
| 621 isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); | 617 isolate->optimizing_compile_dispatcher()->QueueForOptimization(job); |
| 622 | 618 |
| 623 if (FLAG_trace_concurrent_recompilation) { | 619 if (FLAG_trace_concurrent_recompilation) { |
| 624 PrintF(" ** Queued "); | 620 PrintF(" ** Queued "); |
| 625 info->closure()->ShortPrint(); | 621 info->closure()->ShortPrint(); |
| 626 PrintF(" for concurrent optimization.\n"); | 622 PrintF(" for concurrent optimization.\n"); |
| 627 } | 623 } |
| 628 return true; | 624 return true; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 const int kMaxOptCount = | 682 const int kMaxOptCount = |
| 687 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; | 683 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
| 688 if (info->shared_info()->opt_count() > kMaxOptCount) { | 684 if (info->shared_info()->opt_count() > kMaxOptCount) { |
| 689 info->AbortOptimization(kOptimizedTooManyTimes); | 685 info->AbortOptimization(kOptimizedTooManyTimes); |
| 690 return MaybeHandle<Code>(); | 686 return MaybeHandle<Code>(); |
| 691 } | 687 } |
| 692 | 688 |
| 693 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); | 689 TimerEventScope<TimerEventOptimizeCode> optimize_code_timer(isolate); |
| 694 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); | 690 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::OptimizeCode); |
| 695 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode"); | 691 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.OptimizeCode"); |
| 696 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | |
| 697 isolate, &tracing::TraceEventStatsTable::OptimizeCode); | |
| 698 | 692 |
| 699 // TurboFan can optimize directly from existing bytecode. | 693 // TurboFan can optimize directly from existing bytecode. |
| 700 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { | 694 if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) { |
| 701 if (!Compiler::EnsureBytecode(info)) { | 695 if (!Compiler::EnsureBytecode(info)) { |
| 702 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); | 696 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); |
| 703 return MaybeHandle<Code>(); | 697 return MaybeHandle<Code>(); |
| 704 } | 698 } |
| 705 info->MarkAsOptimizeFromBytecode(); | 699 info->MarkAsOptimizeFromBytecode(); |
| 706 } | 700 } |
| 707 | 701 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 | 738 |
| 745 CompilationJob::Status FinalizeOptimizedCompilationJob(CompilationJob* job) { | 739 CompilationJob::Status FinalizeOptimizedCompilationJob(CompilationJob* job) { |
| 746 CompilationInfo* info = job->info(); | 740 CompilationInfo* info = job->info(); |
| 747 Isolate* isolate = info->isolate(); | 741 Isolate* isolate = info->isolate(); |
| 748 | 742 |
| 749 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 743 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
| 750 RuntimeCallTimerScope runtimeTimer(isolate, | 744 RuntimeCallTimerScope runtimeTimer(isolate, |
| 751 &RuntimeCallStats::RecompileSynchronous); | 745 &RuntimeCallStats::RecompileSynchronous); |
| 752 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 746 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 753 "V8.RecompileSynchronous"); | 747 "V8.RecompileSynchronous"); |
| 754 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | |
| 755 isolate, &tracing::TraceEventStatsTable::RecompileSynchronous); | |
| 756 | 748 |
| 757 Handle<SharedFunctionInfo> shared = info->shared_info(); | 749 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 758 shared->code()->set_profiler_ticks(0); | 750 shared->code()->set_profiler_ticks(0); |
| 759 | 751 |
| 760 DCHECK(!shared->HasDebugInfo()); | 752 DCHECK(!shared->HasDebugInfo()); |
| 761 | 753 |
| 762 // 1) Optimization on the concurrent thread may have failed. | 754 // 1) Optimization on the concurrent thread may have failed. |
| 763 // 2) The function may have already been optimized by OSR. Simply continue. | 755 // 2) The function may have already been optimized by OSR. Simply continue. |
| 764 // Except when OSR already disabled optimization for some reason. | 756 // Except when OSR already disabled optimization for some reason. |
| 765 // 3) The code may have already been invalidated due to dependency change. | 757 // 3) The code may have already been invalidated due to dependency change. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 } | 954 } |
| 963 | 955 |
| 964 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { | 956 MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { |
| 965 Isolate* isolate = function->GetIsolate(); | 957 Isolate* isolate = function->GetIsolate(); |
| 966 DCHECK(!isolate->has_pending_exception()); | 958 DCHECK(!isolate->has_pending_exception()); |
| 967 DCHECK(!function->is_compiled()); | 959 DCHECK(!function->is_compiled()); |
| 968 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); | 960 TimerEventScope<TimerEventCompileCode> compile_timer(isolate); |
| 969 RuntimeCallTimerScope runtimeTimer(isolate, | 961 RuntimeCallTimerScope runtimeTimer(isolate, |
| 970 &RuntimeCallStats::CompileCodeLazy); | 962 &RuntimeCallStats::CompileCodeLazy); |
| 971 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 963 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); |
| 972 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | |
| 973 isolate, &tracing::TraceEventStatsTable::CompileCodeLazy); | |
| 974 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); | 964 AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); |
| 975 | 965 |
| 976 if (FLAG_turbo_cache_shared_code) { | 966 if (FLAG_turbo_cache_shared_code) { |
| 977 Handle<Code> cached_code; | 967 Handle<Code> cached_code; |
| 978 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) | 968 if (GetCodeFromOptimizedCodeMap(function, BailoutId::None()) |
| 979 .ToHandle(&cached_code)) { | 969 .ToHandle(&cached_code)) { |
| 980 if (FLAG_trace_opt) { | 970 if (FLAG_trace_opt) { |
| 981 PrintF("[found optimized code for "); | 971 PrintF("[found optimized code for "); |
| 982 function->ShortPrint(); | 972 function->ShortPrint(); |
| 983 PrintF(" during unoptimized compile]\n"); | 973 PrintF(" during unoptimized compile]\n"); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); | 1015 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); |
| 1026 SharedFunctionInfo::SetScript(result, script); | 1016 SharedFunctionInfo::SetScript(result, script); |
| 1027 return result; | 1017 return result; |
| 1028 } | 1018 } |
| 1029 | 1019 |
| 1030 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { | 1020 Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { |
| 1031 Isolate* isolate = info->isolate(); | 1021 Isolate* isolate = info->isolate(); |
| 1032 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1022 TimerEventScope<TimerEventCompileCode> timer(isolate); |
| 1033 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1023 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
| 1034 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1024 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); |
| 1035 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | |
| 1036 isolate, &tracing::TraceEventStatsTable::CompileCode); | |
| 1037 PostponeInterruptsScope postpone(isolate); | 1025 PostponeInterruptsScope postpone(isolate); |
| 1038 DCHECK(!isolate->native_context().is_null()); | 1026 DCHECK(!isolate->native_context().is_null()); |
| 1039 ParseInfo* parse_info = info->parse_info(); | 1027 ParseInfo* parse_info = info->parse_info(); |
| 1040 Handle<Script> script = parse_info->script(); | 1028 Handle<Script> script = parse_info->script(); |
| 1041 | 1029 |
| 1042 // Create a canonical handle scope before internalizing parsed values if | 1030 // Create a canonical handle scope before internalizing parsed values if |
| 1043 // compiling bytecode. This is required for off-thread bytecode generation. | 1031 // compiling bytecode. This is required for off-thread bytecode generation. |
| 1044 std::unique_ptr<CanonicalHandleScope> canonical; | 1032 std::unique_ptr<CanonicalHandleScope> canonical; |
| 1045 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate)); | 1033 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate)); |
| 1046 | 1034 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 // parsing statistics. | 1089 // parsing statistics. |
| 1102 RuntimeCallTimerScope runtimeTimer( | 1090 RuntimeCallTimerScope runtimeTimer( |
| 1103 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval | 1091 isolate, parse_info->is_eval() ? &RuntimeCallStats::CompileEval |
| 1104 : &RuntimeCallStats::Compile); | 1092 : &RuntimeCallStats::Compile); |
| 1105 HistogramTimer* rate = parse_info->is_eval() | 1093 HistogramTimer* rate = parse_info->is_eval() |
| 1106 ? info->isolate()->counters()->compile_eval() | 1094 ? info->isolate()->counters()->compile_eval() |
| 1107 : info->isolate()->counters()->compile(); | 1095 : info->isolate()->counters()->compile(); |
| 1108 HistogramTimerScope timer(rate); | 1096 HistogramTimerScope timer(rate); |
| 1109 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1097 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 1110 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); | 1098 parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile"); |
| 1111 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | |
| 1112 isolate, | |
| 1113 (parse_info->is_eval() ? &tracing::TraceEventStatsTable::CompileEval | |
| 1114 : &tracing::TraceEventStatsTable::Compile)); | |
| 1115 | 1099 |
| 1116 // Allocate a shared function info object. | 1100 // Allocate a shared function info object. |
| 1117 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); | 1101 DCHECK_EQ(kNoSourcePosition, lit->function_token_position()); |
| 1118 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); | 1102 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); |
| 1119 result->set_is_toplevel(true); | 1103 result->set_is_toplevel(true); |
| 1120 if (parse_info->is_eval()) { | 1104 if (parse_info->is_eval()) { |
| 1121 // Eval scripts cannot be (re-)compiled without context. | 1105 // Eval scripts cannot be (re-)compiled without context. |
| 1122 result->set_allows_lazy_compilation_without_context(false); | 1106 result->set_allows_lazy_compilation_without_context(false); |
| 1123 } | 1107 } |
| 1124 parse_info->set_shared_info(result); | 1108 parse_info->set_shared_info(result); |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 context, language_mode); | 1573 context, language_mode); |
| 1590 if (maybe_result.is_null() && FLAG_serialize_toplevel && | 1574 if (maybe_result.is_null() && FLAG_serialize_toplevel && |
| 1591 compile_options == ScriptCompiler::kConsumeCodeCache && | 1575 compile_options == ScriptCompiler::kConsumeCodeCache && |
| 1592 !isolate->debug()->is_loaded()) { | 1576 !isolate->debug()->is_loaded()) { |
| 1593 // Then check cached code provided by embedder. | 1577 // Then check cached code provided by embedder. |
| 1594 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); | 1578 HistogramTimerScope timer(isolate->counters()->compile_deserialize()); |
| 1595 RuntimeCallTimerScope runtimeTimer(isolate, | 1579 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1596 &RuntimeCallStats::CompileDeserialize); | 1580 &RuntimeCallStats::CompileDeserialize); |
| 1597 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1581 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 1598 "V8.CompileDeserialize"); | 1582 "V8.CompileDeserialize"); |
| 1599 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | |
| 1600 isolate, &tracing::TraceEventStatsTable::CompileDeserialize); | |
| 1601 Handle<SharedFunctionInfo> result; | 1583 Handle<SharedFunctionInfo> result; |
| 1602 if (CodeSerializer::Deserialize(isolate, *cached_data, source) | 1584 if (CodeSerializer::Deserialize(isolate, *cached_data, source) |
| 1603 .ToHandle(&result)) { | 1585 .ToHandle(&result)) { |
| 1604 // Promote to per-isolate compilation cache. | 1586 // Promote to per-isolate compilation cache. |
| 1605 compilation_cache->PutScript(source, context, language_mode, result); | 1587 compilation_cache->PutScript(source, context, language_mode, result); |
| 1606 return result; | 1588 return result; |
| 1607 } | 1589 } |
| 1608 // Deserializer failed. Fall through to compile. | 1590 // Deserializer failed. Fall through to compile. |
| 1609 } | 1591 } |
| 1610 } | 1592 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 if (extension == NULL && !result.is_null()) { | 1647 if (extension == NULL && !result.is_null()) { |
| 1666 compilation_cache->PutScript(source, context, language_mode, result); | 1648 compilation_cache->PutScript(source, context, language_mode, result); |
| 1667 if (FLAG_serialize_toplevel && | 1649 if (FLAG_serialize_toplevel && |
| 1668 compile_options == ScriptCompiler::kProduceCodeCache) { | 1650 compile_options == ScriptCompiler::kProduceCodeCache) { |
| 1669 HistogramTimerScope histogram_timer( | 1651 HistogramTimerScope histogram_timer( |
| 1670 isolate->counters()->compile_serialize()); | 1652 isolate->counters()->compile_serialize()); |
| 1671 RuntimeCallTimerScope runtimeTimer(isolate, | 1653 RuntimeCallTimerScope runtimeTimer(isolate, |
| 1672 &RuntimeCallStats::CompileSerialize); | 1654 &RuntimeCallStats::CompileSerialize); |
| 1673 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), | 1655 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), |
| 1674 "V8.CompileSerialize"); | 1656 "V8.CompileSerialize"); |
| 1675 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | |
| 1676 isolate, &tracing::TraceEventStatsTable::CompileSerialize); | |
| 1677 *cached_data = CodeSerializer::Serialize(isolate, result, source); | 1657 *cached_data = CodeSerializer::Serialize(isolate, result, source); |
| 1678 if (FLAG_profile_deserialization) { | 1658 if (FLAG_profile_deserialization) { |
| 1679 PrintF("[Compiling and serializing took %0.3f ms]\n", | 1659 PrintF("[Compiling and serializing took %0.3f ms]\n", |
| 1680 timer.Elapsed().InMillisecondsF()); | 1660 timer.Elapsed().InMillisecondsF()); |
| 1681 } | 1661 } |
| 1682 } | 1662 } |
| 1683 } | 1663 } |
| 1684 | 1664 |
| 1685 if (result.is_null()) { | 1665 if (result.is_null()) { |
| 1686 isolate->ReportPendingMessages(); | 1666 isolate->ReportPendingMessages(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 lazy &= !(FLAG_serialize_eager && info.will_serialize()); | 1765 lazy &= !(FLAG_serialize_eager && info.will_serialize()); |
| 1786 | 1766 |
| 1787 // Consider compiling eagerly when compiling bytecode for Ignition. | 1767 // Consider compiling eagerly when compiling bytecode for Ignition. |
| 1788 lazy &= | 1768 lazy &= |
| 1789 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); | 1769 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); |
| 1790 | 1770 |
| 1791 // Generate code | 1771 // Generate code |
| 1792 TimerEventScope<TimerEventCompileCode> timer(isolate); | 1772 TimerEventScope<TimerEventCompileCode> timer(isolate); |
| 1793 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); | 1773 RuntimeCallTimerScope runtimeTimer(isolate, &RuntimeCallStats::CompileCode); |
| 1794 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); | 1774 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); |
| 1795 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | |
| 1796 isolate, &tracing::TraceEventStatsTable::CompileCode); | |
| 1797 | 1775 |
| 1798 // Create a canonical handle scope if compiling ignition bytecode. This is | 1776 // Create a canonical handle scope if compiling ignition bytecode. This is |
| 1799 // required by the constant array builder to de-duplicate common objects | 1777 // required by the constant array builder to de-duplicate common objects |
| 1800 // without dereferencing handles. | 1778 // without dereferencing handles. |
| 1801 std::unique_ptr<CanonicalHandleScope> canonical; | 1779 std::unique_ptr<CanonicalHandleScope> canonical; |
| 1802 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info.isolate())); | 1780 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(info.isolate())); |
| 1803 | 1781 |
| 1804 if (lazy) { | 1782 if (lazy) { |
| 1805 info.SetCode(isolate->builtins()->CompileLazy()); | 1783 info.SetCode(isolate->builtins()->CompileLazy()); |
| 1806 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { | 1784 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 DCHECK(shared->is_compiled()); | 1888 DCHECK(shared->is_compiled()); |
| 1911 function->set_literals(cached.literals); | 1889 function->set_literals(cached.literals); |
| 1912 } else if (shared->is_compiled()) { | 1890 } else if (shared->is_compiled()) { |
| 1913 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1891 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
| 1914 JSFunction::EnsureLiterals(function); | 1892 JSFunction::EnsureLiterals(function); |
| 1915 } | 1893 } |
| 1916 } | 1894 } |
| 1917 | 1895 |
| 1918 } // namespace internal | 1896 } // namespace internal |
| 1919 } // namespace v8 | 1897 } // namespace v8 |
| OLD | NEW |