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

Side by Side Diff: src/log.cc

Issue 2079273003: Revert of Refactor CpuProfiler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months 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 | « src/log.h ('k') | src/profiler/cpu-profiler.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/log.h" 5 #include "src/log.h"
6 6
7 #include <cstdarg> 7 #include <cstdarg>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
11 #include "src/base/platform/platform.h" 11 #include "src/base/platform/platform.h"
12 #include "src/bootstrapper.h" 12 #include "src/bootstrapper.h"
13 #include "src/code-stubs.h" 13 #include "src/code-stubs.h"
14 #include "src/counters.h" 14 #include "src/counters.h"
15 #include "src/deoptimizer.h" 15 #include "src/deoptimizer.h"
16 #include "src/global-handles.h" 16 #include "src/global-handles.h"
17 #include "src/interpreter/bytecodes.h" 17 #include "src/interpreter/bytecodes.h"
18 #include "src/interpreter/interpreter.h" 18 #include "src/interpreter/interpreter.h"
19 #include "src/libsampler/v8-sampler.h" 19 #include "src/libsampler/v8-sampler.h"
20 #include "src/log-inl.h" 20 #include "src/log-inl.h"
21 #include "src/log-utils.h" 21 #include "src/log-utils.h"
22 #include "src/macro-assembler.h" 22 #include "src/macro-assembler.h"
23 #include "src/perf-jit.h" 23 #include "src/perf-jit.h"
24 #include "src/profiler/cpu-profiler-inl.h" 24 #include "src/profiler/cpu-profiler-inl.h"
25 #include "src/profiler/profiler-listener.h"
26 #include "src/runtime-profiler.h" 25 #include "src/runtime-profiler.h"
27 #include "src/string-stream.h" 26 #include "src/string-stream.h"
28 #include "src/vm-state-inl.h" 27 #include "src/vm-state-inl.h"
29 28
30 namespace v8 { 29 namespace v8 {
31 namespace internal { 30 namespace internal {
32 31
33 32
34 #define DECLARE_EVENT(ignore1, name) name, 33 #define DECLARE_EVENT(ignore1, name) name,
35 static const char* kLogEventsNames[CodeEventListener::NUMBER_OF_LOG_EVENTS] = { 34 static const char* kLogEventsNames[CodeEventListener::NUMBER_OF_LOG_EVENTS] = {
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 } 1782 }
1784 1783
1785 if (FLAG_log_internal_timer_events || FLAG_prof_cpp) timer_.Start(); 1784 if (FLAG_log_internal_timer_events || FLAG_prof_cpp) timer_.Start();
1786 1785
1787 if (FLAG_prof_cpp) { 1786 if (FLAG_prof_cpp) {
1788 profiler_ = new Profiler(isolate); 1787 profiler_ = new Profiler(isolate);
1789 is_logging_ = true; 1788 is_logging_ = true;
1790 profiler_->Engage(); 1789 profiler_->Engage();
1791 } 1790 }
1792 1791
1793 profiler_listener_.reset();
1794
1795 if (is_logging_) { 1792 if (is_logging_) {
1796 addCodeEventListener(this); 1793 addCodeEventListener(this);
1797 } 1794 }
1798 1795
1799 return true; 1796 return true;
1800 } 1797 }
1801 1798
1802 1799
1803 void Logger::SetCodeEventHandler(uint32_t options, 1800 void Logger::SetCodeEventHandler(uint32_t options,
1804 JitCodeEventHandler event_handler) { 1801 JitCodeEventHandler event_handler) {
1805 if (jit_logger_) { 1802 if (jit_logger_) {
1806 removeCodeEventListener(jit_logger_); 1803 removeCodeEventListener(jit_logger_);
1807 delete jit_logger_; 1804 delete jit_logger_;
1808 jit_logger_ = NULL; 1805 jit_logger_ = NULL;
1809 } 1806 }
1810 1807
1811 if (event_handler) { 1808 if (event_handler) {
1812 jit_logger_ = new JitLogger(event_handler); 1809 jit_logger_ = new JitLogger(event_handler);
1813 addCodeEventListener(jit_logger_); 1810 addCodeEventListener(jit_logger_);
1814 if (options & kJitCodeEventEnumExisting) { 1811 if (options & kJitCodeEventEnumExisting) {
1815 HandleScope scope(isolate_); 1812 HandleScope scope(isolate_);
1816 LogCodeObjects(); 1813 LogCodeObjects();
1817 LogCompiledFunctions(); 1814 LogCompiledFunctions();
1818 } 1815 }
1819 } 1816 }
1820 } 1817 }
1821 1818
1822 void Logger::SetUpProfilerListener() {
1823 if (!is_initialized_) return;
1824 if (profiler_listener_.get() == nullptr) {
1825 profiler_listener_.reset(new ProfilerListener(isolate_));
1826 }
1827 addCodeEventListener(profiler_listener_.get());
1828 }
1829
1830 void Logger::TearDownProfilerListener() {
1831 if (profiler_listener_->HasObservers()) return;
1832 removeCodeEventListener(profiler_listener_.get());
1833 }
1834 1819
1835 sampler::Sampler* Logger::sampler() { 1820 sampler::Sampler* Logger::sampler() {
1836 return ticker_; 1821 return ticker_;
1837 } 1822 }
1838 1823
1839 1824
1840 FILE* Logger::TearDown() { 1825 FILE* Logger::TearDown() {
1841 if (!is_initialized_) return NULL; 1826 if (!is_initialized_) return NULL;
1842 is_initialized_ = false; 1827 is_initialized_ = false;
1843 1828
(...skipping 24 matching lines...) Expand all
1868 delete ll_logger_; 1853 delete ll_logger_;
1869 ll_logger_ = NULL; 1854 ll_logger_ = NULL;
1870 } 1855 }
1871 1856
1872 if (jit_logger_) { 1857 if (jit_logger_) {
1873 removeCodeEventListener(jit_logger_); 1858 removeCodeEventListener(jit_logger_);
1874 delete jit_logger_; 1859 delete jit_logger_;
1875 jit_logger_ = NULL; 1860 jit_logger_ = NULL;
1876 } 1861 }
1877 1862
1878 if (profiler_listener_.get() != nullptr) {
1879 removeCodeEventListener(profiler_listener_.get());
1880 }
1881
1882 return log_->Close(); 1863 return log_->Close();
1883 } 1864 }
1884 1865
1885 } // namespace internal 1866 } // namespace internal
1886 } // namespace v8 1867 } // namespace v8
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/profiler/cpu-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698