Commit c3a16f0a authored by alph's avatar alph Committed by Commit bot

Make use of v8::TickSample instead of v8::internal::TickSample in logger.

BUG=v8:4789

Review-Url: https://codereview.chromium.org/2133533002
Cr-Commit-Position: refs/heads/master@{#37618}
parent b8372411
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <cstdarg> #include <cstdarg>
#include <sstream> #include <sstream>
#include "include/v8-profiler.h"
#include "src/bailout-reason.h" #include "src/bailout-reason.h"
#include "src/base/platform/platform.h" #include "src/base/platform/platform.h"
#include "src/bootstrapper.h" #include "src/bootstrapper.h"
...@@ -21,9 +22,7 @@ ...@@ -21,9 +22,7 @@
#include "src/log-utils.h" #include "src/log-utils.h"
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
#include "src/perf-jit.h" #include "src/perf-jit.h"
#include "src/profiler/cpu-profiler-inl.h"
#include "src/profiler/profiler-listener.h" #include "src/profiler/profiler-listener.h"
#include "src/profiler/tick-sample.h"
#include "src/runtime-profiler.h" #include "src/runtime-profiler.h"
#include "src/string-stream.h" #include "src/string-stream.h"
#include "src/vm-state-inl.h" #include "src/vm-state-inl.h"
...@@ -31,7 +30,6 @@ ...@@ -31,7 +30,6 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
#define DECLARE_EVENT(ignore1, name) name, #define DECLARE_EVENT(ignore1, name) name,
static const char* kLogEventsNames[CodeEventListener::NUMBER_OF_LOG_EVENTS] = { static const char* kLogEventsNames[CodeEventListener::NUMBER_OF_LOG_EVENTS] = {
LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT)}; LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT)};
...@@ -557,7 +555,7 @@ class Profiler: public base::Thread { ...@@ -557,7 +555,7 @@ class Profiler: public base::Thread {
void Disengage(); void Disengage();
// Inserts collected profiling data into buffer. // Inserts collected profiling data into buffer.
void Insert(TickSample* sample) { void Insert(v8::TickSample* sample) {
if (paused_) if (paused_)
return; return;
...@@ -578,7 +576,7 @@ class Profiler: public base::Thread { ...@@ -578,7 +576,7 @@ class Profiler: public base::Thread {
private: private:
// Waits for a signal and removes profiling data. // Waits for a signal and removes profiling data.
bool Remove(TickSample* sample) { bool Remove(v8::TickSample* sample) {
buffer_semaphore_.Wait(); // Wait for an element. buffer_semaphore_.Wait(); // Wait for an element.
*sample = buffer_[base::NoBarrier_Load(&tail_)]; *sample = buffer_[base::NoBarrier_Load(&tail_)];
bool result = overflow_; bool result = overflow_;
...@@ -595,7 +593,7 @@ class Profiler: public base::Thread { ...@@ -595,7 +593,7 @@ class Profiler: public base::Thread {
// Cyclic buffer for communicating profiling samples // Cyclic buffer for communicating profiling samples
// between the signal handler and the worker thread. // between the signal handler and the worker thread.
static const int kBufferSize = 128; static const int kBufferSize = 128;
TickSample buffer_[kBufferSize]; // Buffer storage. v8::TickSample buffer_[kBufferSize]; // Buffer storage.
int head_; // Index to the buffer head. int head_; // Index to the buffer head.
base::Atomic32 tail_; // Index to the buffer tail. base::Atomic32 tail_; // Index to the buffer tail.
bool overflow_; // Tell whether a buffer overflow has occurred. bool overflow_; // Tell whether a buffer overflow has occurred.
...@@ -646,9 +644,8 @@ class Ticker: public sampler::Sampler { ...@@ -646,9 +644,8 @@ class Ticker: public sampler::Sampler {
void SampleStack(const v8::RegisterState& state) override { void SampleStack(const v8::RegisterState& state) override {
if (!profiler_) return; if (!profiler_) return;
Isolate* isolate = reinterpret_cast<Isolate*>(this->isolate()); v8::TickSample sample;
TickSample sample; sample.Init(isolate(), state, v8::TickSample::kIncludeCEntryFrame, true);
sample.Init(isolate, state, TickSample::kIncludeCEntryFrame, true);
profiler_->Insert(&sample); profiler_->Insert(&sample);
} }
...@@ -708,7 +705,7 @@ void Profiler::Disengage() { ...@@ -708,7 +705,7 @@ void Profiler::Disengage() {
// inserting a fake element in the queue and then wait for // inserting a fake element in the queue and then wait for
// the thread to terminate. // the thread to terminate.
base::NoBarrier_Store(&running_, 0); base::NoBarrier_Store(&running_, 0);
TickSample sample; v8::TickSample sample;
// Reset 'paused_' flag, otherwise semaphore may not be signalled. // Reset 'paused_' flag, otherwise semaphore may not be signalled.
resume(); resume();
Insert(&sample); Insert(&sample);
...@@ -719,7 +716,7 @@ void Profiler::Disengage() { ...@@ -719,7 +716,7 @@ void Profiler::Disengage() {
void Profiler::Run() { void Profiler::Run() {
TickSample sample; v8::TickSample sample;
bool overflow = Remove(&sample); bool overflow = Remove(&sample);
while (base::NoBarrier_Load(&running_)) { while (base::NoBarrier_Load(&running_)) {
LOG(isolate_, TickEvent(&sample, overflow)); LOG(isolate_, TickEvent(&sample, overflow));
...@@ -1361,7 +1358,7 @@ void Logger::RuntimeCallTimerEvent() { ...@@ -1361,7 +1358,7 @@ void Logger::RuntimeCallTimerEvent() {
msg.WriteToLogFile(); msg.WriteToLogFile();
} }
void Logger::TickEvent(TickSample* sample, bool overflow) { void Logger::TickEvent(v8::TickSample* sample, bool overflow) {
if (!log_->IsEnabled() || !FLAG_prof_cpp) return; if (!log_->IsEnabled() || !FLAG_prof_cpp) return;
if (FLAG_runtime_call_stats) { if (FLAG_runtime_call_stats) {
RuntimeCallTimerEvent(); RuntimeCallTimerEvent();
......
...@@ -17,9 +17,7 @@ ...@@ -17,9 +17,7 @@
namespace v8 { namespace v8 {
namespace base { struct TickSample;
class Semaphore;
}
namespace sampler { namespace sampler {
class Sampler; class Sampler;
...@@ -65,11 +63,15 @@ namespace internal { ...@@ -65,11 +63,15 @@ namespace internal {
class CodeEventListener; class CodeEventListener;
class CpuProfiler; class CpuProfiler;
class Isolate; class Isolate;
class JitLogger;
class Log; class Log;
class LowLevelLogger;
class PerfBasicLogger;
class PerfJitLogger;
class Profiler; class Profiler;
class Ticker; class ProfilerListener;
class RuntimeCallTimer; class RuntimeCallTimer;
struct TickSample; class Ticker;
#undef LOG #undef LOG
#define LOG(isolate, Call) \ #define LOG(isolate, Call) \
...@@ -84,12 +86,6 @@ struct TickSample; ...@@ -84,12 +86,6 @@ struct TickSample;
if (logger->is_logging_code_events()) logger->Call; \ if (logger->is_logging_code_events()) logger->Call; \
} while (false) } while (false)
class JitLogger;
class PerfBasicLogger;
class LowLevelLogger;
class PerfJitLogger;
class ProfilerListener;
class Logger : public CodeEventListener { class Logger : public CodeEventListener {
public: public:
enum StartEnd { START = 0, END = 1 }; enum StartEnd { START = 0, END = 1 };
......
...@@ -12,11 +12,10 @@ ...@@ -12,11 +12,10 @@
#include "src/profiler/strings-storage.h" #include "src/profiler/strings-storage.h"
namespace v8 { namespace v8 {
namespace internal {
struct TickSample; struct TickSample;
namespace internal {
// Provides a mapping from the offsets within generated code to // Provides a mapping from the offsets within generated code to
// the source line. // the source line.
class JITLineInfoTable : public Malloced { class JITLineInfoTable : public Malloced {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment