summaryrefslogtreecommitdiff
path: root/deps/v8/src/cpu-profiler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/cpu-profiler.cc')
-rw-r--r--deps/v8/src/cpu-profiler.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/deps/v8/src/cpu-profiler.cc b/deps/v8/src/cpu-profiler.cc
index da19a4501d..f13c0eefab 100644
--- a/deps/v8/src/cpu-profiler.cc
+++ b/deps/v8/src/cpu-profiler.cc
@@ -34,6 +34,7 @@
#include "frames-inl.h"
#include "hashmap.h"
#include "log-inl.h"
+#include "vm-state-inl.h"
#include "../include/v8-profiler.h"
@@ -223,7 +224,7 @@ void ProfilerEventsProcessor::RegExpCodeCreateEvent(
void ProfilerEventsProcessor::AddCurrentStack() {
TickSampleEventRecord record;
TickSample* sample = &record.sample;
- sample->state = VMState::current_state();
+ sample->state = Top::current_vm_state();
sample->pc = reinterpret_cast<Address>(sample); // Not NULL.
sample->frames_count = 0;
for (StackTraceFrameIterator it;
@@ -314,6 +315,7 @@ void ProfilerEventsProcessor::Run() {
CpuProfiler* CpuProfiler::singleton_ = NULL;
+Atomic32 CpuProfiler::is_profiling_ = false;
void CpuProfiler::StartProfiling(const char* title) {
ASSERT(singleton_ != NULL);
@@ -435,7 +437,7 @@ void CpuProfiler::FunctionCreateEvent(JSFunction* function) {
}
singleton_->processor_->FunctionCreateEvent(
function->address(),
- function->code()->address(),
+ function->shared()->code()->address(),
security_token_id);
}
@@ -525,6 +527,7 @@ void CpuProfiler::StartProcessorIfNotStarted() {
Logger::logging_nesting_ = 0;
generator_ = new ProfileGenerator(profiles_);
processor_ = new ProfilerEventsProcessor(generator_);
+ NoBarrier_Store(&is_profiling_, true);
processor_->Start();
// Enumerate stuff we already have in the heap.
if (Heap::HasBeenSetup()) {
@@ -539,7 +542,9 @@ void CpuProfiler::StartProcessorIfNotStarted() {
Logger::LogAccessorCallbacks();
}
// Enable stack sampling.
- reinterpret_cast<Sampler*>(Logger::ticker_)->Start();
+ Sampler* sampler = reinterpret_cast<Sampler*>(Logger::ticker_);
+ if (!sampler->IsActive()) sampler->Start();
+ sampler->IncreaseProfilingDepth();
}
}
@@ -570,12 +575,15 @@ CpuProfile* CpuProfiler::StopCollectingProfile(Object* security_token,
void CpuProfiler::StopProcessorIfLastProfile(const char* title) {
if (profiles_->IsLastProfile(title)) {
- reinterpret_cast<Sampler*>(Logger::ticker_)->Stop();
+ Sampler* sampler = reinterpret_cast<Sampler*>(Logger::ticker_);
+ sampler->DecreaseProfilingDepth();
+ sampler->Stop();
processor_->Stop();
processor_->Join();
delete processor_;
delete generator_;
processor_ = NULL;
+ NoBarrier_Store(&is_profiling_, false);
generator_ = NULL;
Logger::logging_nesting_ = saved_logging_nesting_;
}