Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: src/compiler.cc

Issue 2497933002: [Interpreter] Fix runtime-profiler ticks for Interpreted functions. (Closed)
Patch Set: Review comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/runtime-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 function->ShortPrint(); 633 function->ShortPrint();
634 if (!osr_ast_id.IsNone()) { 634 if (!osr_ast_id.IsNone()) {
635 PrintF(" at OSR AST id %d", osr_ast_id.ToInt()); 635 PrintF(" at OSR AST id %d", osr_ast_id.ToInt());
636 } 636 }
637 PrintF("]\n"); 637 PrintF("]\n");
638 } 638 }
639 return cached_code; 639 return cached_code;
640 } 640 }
641 641
642 // Reset profiler ticks, function is no longer considered hot. 642 // Reset profiler ticks, function is no longer considered hot.
643 if (shared->is_compiled()) { 643 if (shared->HasBaselineCode()) {
644 shared->code()->set_profiler_ticks(0); 644 shared->code()->set_profiler_ticks(0);
645 } else if (shared->HasBytecodeArray()) {
646 shared->set_profiler_ticks(0);
645 } 647 }
646 648
647 VMState<COMPILER> state(isolate); 649 VMState<COMPILER> state(isolate);
648 DCHECK(!isolate->has_pending_exception()); 650 DCHECK(!isolate->has_pending_exception());
649 PostponeInterruptsScope postpone(isolate); 651 PostponeInterruptsScope postpone(isolate);
650 bool use_turbofan = UseTurboFan(shared) || ignition_osr; 652 bool use_turbofan = UseTurboFan(shared) || ignition_osr;
651 std::unique_ptr<CompilationJob> job( 653 std::unique_ptr<CompilationJob> job(
652 use_turbofan ? compiler::Pipeline::NewCompilationJob(function) 654 use_turbofan ? compiler::Pipeline::NewCompilationJob(function)
653 : new HCompilationJob(function)); 655 : new HCompilationJob(function));
654 CompilationInfo* info = job->info(); 656 CompilationInfo* info = job->info();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 CompilationInfo* info = job->info(); 729 CompilationInfo* info = job->info();
728 Isolate* isolate = info->isolate(); 730 Isolate* isolate = info->isolate();
729 731
730 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); 732 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate());
731 RuntimeCallTimerScope runtimeTimer(isolate, 733 RuntimeCallTimerScope runtimeTimer(isolate,
732 &RuntimeCallStats::RecompileSynchronous); 734 &RuntimeCallStats::RecompileSynchronous);
733 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), 735 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
734 "V8.RecompileSynchronous"); 736 "V8.RecompileSynchronous");
735 737
736 Handle<SharedFunctionInfo> shared = info->shared_info(); 738 Handle<SharedFunctionInfo> shared = info->shared_info();
737 shared->code()->set_profiler_ticks(0); 739
740 // Reset profiler ticks, function is no longer considered hot.
741 if (shared->HasBaselineCode()) {
742 shared->code()->set_profiler_ticks(0);
743 } else if (shared->HasBytecodeArray()) {
744 shared->set_profiler_ticks(0);
745 }
738 746
739 DCHECK(!shared->HasDebugInfo()); 747 DCHECK(!shared->HasDebugInfo());
740 748
741 // 1) Optimization on the concurrent thread may have failed. 749 // 1) Optimization on the concurrent thread may have failed.
742 // 2) The function may have already been optimized by OSR. Simply continue. 750 // 2) The function may have already been optimized by OSR. Simply continue.
743 // Except when OSR already disabled optimization for some reason. 751 // Except when OSR already disabled optimization for some reason.
744 // 3) The code may have already been invalidated due to dependency change. 752 // 3) The code may have already been invalidated due to dependency change.
745 // 4) Code generation may have failed. 753 // 4) Code generation may have failed.
746 if (job->state() == CompilationJob::State::kReadyToFinalize) { 754 if (job->state() == CompilationJob::State::kReadyToFinalize) {
747 if (shared->optimization_disabled()) { 755 if (shared->optimization_disabled()) {
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 DCHECK(shared->is_compiled()); 1719 DCHECK(shared->is_compiled());
1712 function->set_literals(cached.literals); 1720 function->set_literals(cached.literals);
1713 } else if (shared->is_compiled()) { 1721 } else if (shared->is_compiled()) {
1714 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1722 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1715 JSFunction::EnsureLiterals(function); 1723 JSFunction::EnsureLiterals(function);
1716 } 1724 }
1717 } 1725 }
1718 1726
1719 } // namespace internal 1727 } // namespace internal
1720 } // namespace v8 1728 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698