Remove Isolate::cpu_profiler() usage in api.cc
Driveby: some surrounding code refactoring/cleanup. BUG=v8:4789 Review-Url: https://codereview.chromium.org/2056253003 Cr-Commit-Position: refs/heads/master@{#36993}
This commit is contained in:
parent
9d12ad0df0
commit
231ae291d3
@ -8252,9 +8252,8 @@ const std::vector<CpuProfileDeoptInfo>& CpuProfileNode::GetDeoptInfos() const {
|
||||
|
||||
void CpuProfile::Delete() {
|
||||
i::CpuProfile* profile = reinterpret_cast<i::CpuProfile*>(this);
|
||||
i::Isolate* isolate = profile->top_down()->isolate();
|
||||
i::CpuProfiler* profiler = isolate->cpu_profiler();
|
||||
DCHECK(profiler != NULL);
|
||||
i::CpuProfiler* profiler = profile->cpu_profiler();
|
||||
DCHECK(profiler != nullptr);
|
||||
profiler->DeleteProfile(profile);
|
||||
}
|
||||
|
||||
|
@ -499,15 +499,12 @@ CpuProfiler::CpuProfiler(Isolate* isolate)
|
||||
: isolate_(isolate),
|
||||
sampling_interval_(base::TimeDelta::FromMicroseconds(
|
||||
FLAG_cpu_profiler_sampling_interval)),
|
||||
profiles_(new CpuProfilesCollection(isolate->heap())),
|
||||
generator_(NULL),
|
||||
processor_(NULL),
|
||||
profiles_(new CpuProfilesCollection(isolate)),
|
||||
is_profiling_(false) {
|
||||
profiles_->set_cpu_profiler(this);
|
||||
}
|
||||
|
||||
|
||||
CpuProfiler::CpuProfiler(Isolate* isolate,
|
||||
CpuProfilesCollection* test_profiles,
|
||||
CpuProfiler::CpuProfiler(Isolate* isolate, CpuProfilesCollection* test_profiles,
|
||||
ProfileGenerator* test_generator,
|
||||
ProfilerEventsProcessor* test_processor)
|
||||
: isolate_(isolate),
|
||||
@ -517,28 +514,25 @@ CpuProfiler::CpuProfiler(Isolate* isolate,
|
||||
generator_(test_generator),
|
||||
processor_(test_processor),
|
||||
is_profiling_(false) {
|
||||
profiles_->set_cpu_profiler(this);
|
||||
}
|
||||
|
||||
|
||||
CpuProfiler::~CpuProfiler() {
|
||||
DCHECK(!is_profiling_);
|
||||
delete profiles_;
|
||||
}
|
||||
|
||||
|
||||
void CpuProfiler::set_sampling_interval(base::TimeDelta value) {
|
||||
DCHECK(!is_profiling_);
|
||||
sampling_interval_ = value;
|
||||
}
|
||||
|
||||
|
||||
void CpuProfiler::ResetProfiles() {
|
||||
delete profiles_;
|
||||
profiles_ = new CpuProfilesCollection(isolate()->heap());
|
||||
profiles_.reset(new CpuProfilesCollection(isolate_));
|
||||
profiles_->set_cpu_profiler(this);
|
||||
}
|
||||
|
||||
void CpuProfiler::CollectSample() {
|
||||
if (processor_ != NULL) {
|
||||
if (processor_) {
|
||||
processor_->AddCurrentStack(isolate_);
|
||||
}
|
||||
}
|
||||
@ -557,7 +551,7 @@ void CpuProfiler::StartProfiling(String* title, bool record_samples) {
|
||||
|
||||
|
||||
void CpuProfiler::StartProcessorIfNotStarted() {
|
||||
if (processor_ != NULL) {
|
||||
if (processor_) {
|
||||
processor_->AddCurrentStack(isolate_);
|
||||
return;
|
||||
}
|
||||
@ -565,10 +559,10 @@ void CpuProfiler::StartProcessorIfNotStarted() {
|
||||
// Disable logging when using the new implementation.
|
||||
saved_is_logging_ = logger->is_logging_;
|
||||
logger->is_logging_ = false;
|
||||
generator_ = new ProfileGenerator(profiles_);
|
||||
sampler::Sampler* sampler = logger->sampler();
|
||||
processor_ = new ProfilerEventsProcessor(
|
||||
generator_, sampler, sampling_interval_);
|
||||
generator_.reset(new ProfileGenerator(profiles_.get()));
|
||||
processor_.reset(new ProfilerEventsProcessor(generator_.get(), sampler,
|
||||
sampling_interval_));
|
||||
is_profiling_ = true;
|
||||
isolate_->set_is_profiling(true);
|
||||
// Enumerate stuff we already have in the heap.
|
||||
@ -588,10 +582,10 @@ void CpuProfiler::StartProcessorIfNotStarted() {
|
||||
|
||||
|
||||
CpuProfile* CpuProfiler::StopProfiling(const char* title) {
|
||||
if (!is_profiling_) return NULL;
|
||||
if (!is_profiling_) return nullptr;
|
||||
StopProcessorIfLastProfile(title);
|
||||
CpuProfile* result = profiles_->StopProfiling(title);
|
||||
if (result != NULL) {
|
||||
if (result) {
|
||||
result->Print();
|
||||
}
|
||||
return result;
|
||||
@ -599,7 +593,7 @@ CpuProfile* CpuProfiler::StopProfiling(const char* title) {
|
||||
|
||||
|
||||
CpuProfile* CpuProfiler::StopProfiling(String* title) {
|
||||
if (!is_profiling_) return NULL;
|
||||
if (!is_profiling_) return nullptr;
|
||||
const char* profile_title = profiles_->GetName(title);
|
||||
StopProcessorIfLastProfile(profile_title);
|
||||
return profiles_->StopProfiling(profile_title);
|
||||
@ -607,7 +601,9 @@ CpuProfile* CpuProfiler::StopProfiling(String* title) {
|
||||
|
||||
|
||||
void CpuProfiler::StopProcessorIfLastProfile(const char* title) {
|
||||
if (profiles_->IsLastProfile(title)) StopProcessor();
|
||||
if (profiles_->IsLastProfile(title)) {
|
||||
StopProcessor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -618,10 +614,8 @@ void CpuProfiler::StopProcessor() {
|
||||
is_profiling_ = false;
|
||||
isolate_->set_is_profiling(false);
|
||||
processor_->StopSynchronously();
|
||||
delete processor_;
|
||||
delete generator_;
|
||||
processor_ = NULL;
|
||||
generator_ = NULL;
|
||||
processor_.reset();
|
||||
generator_.reset();
|
||||
sampler->SetHasProcessingThread(false);
|
||||
sampler->DecreaseProfilingDepth();
|
||||
logger->is_logging_ = saved_is_logging_;
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef V8_PROFILER_CPU_PROFILER_H_
|
||||
#define V8_PROFILER_CPU_PROFILER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/allocation.h"
|
||||
#include "src/base/atomic-utils.h"
|
||||
#include "src/base/atomicops.h"
|
||||
@ -193,8 +195,7 @@ class CpuProfiler : public CodeEventListener {
|
||||
public:
|
||||
explicit CpuProfiler(Isolate* isolate);
|
||||
|
||||
CpuProfiler(Isolate* isolate,
|
||||
CpuProfilesCollection* test_collection,
|
||||
CpuProfiler(Isolate* isolate, CpuProfilesCollection* profiles,
|
||||
ProfileGenerator* test_generator,
|
||||
ProfilerEventsProcessor* test_processor);
|
||||
|
||||
@ -241,8 +242,8 @@ class CpuProfiler : public CodeEventListener {
|
||||
|
||||
bool is_profiling() const { return is_profiling_; }
|
||||
|
||||
ProfileGenerator* generator() const { return generator_; }
|
||||
ProfilerEventsProcessor* processor() const { return processor_; }
|
||||
ProfileGenerator* generator() const { return generator_.get(); }
|
||||
ProfilerEventsProcessor* processor() const { return processor_.get(); }
|
||||
Isolate* isolate() const { return isolate_; }
|
||||
|
||||
private:
|
||||
@ -255,11 +256,11 @@ class CpuProfiler : public CodeEventListener {
|
||||
void RecordDeoptInlinedFrames(CodeEntry* entry, AbstractCode* abstract_code);
|
||||
Name* InferScriptName(Name* name, SharedFunctionInfo* info);
|
||||
|
||||
Isolate* isolate_;
|
||||
Isolate* const isolate_;
|
||||
base::TimeDelta sampling_interval_;
|
||||
CpuProfilesCollection* profiles_;
|
||||
ProfileGenerator* generator_;
|
||||
ProfilerEventsProcessor* processor_;
|
||||
std::unique_ptr<CpuProfilesCollection> profiles_;
|
||||
std::unique_ptr<ProfileGenerator> generator_;
|
||||
std::unique_ptr<ProfilerEventsProcessor> processor_;
|
||||
bool saved_is_logging_;
|
||||
bool is_profiling_;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/global-handles.h"
|
||||
#include "src/profiler/cpu-profiler.h"
|
||||
#include "src/profiler/profile-generator-inl.h"
|
||||
#include "src/profiler/tick-sample.h"
|
||||
#include "src/unicode.h"
|
||||
@ -365,12 +366,13 @@ void ProfileTree::TraverseDepthFirst(Callback* callback) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CpuProfile::CpuProfile(Isolate* isolate, const char* title, bool record_samples)
|
||||
CpuProfile::CpuProfile(CpuProfiler* profiler, const char* title,
|
||||
bool record_samples)
|
||||
: title_(title),
|
||||
record_samples_(record_samples),
|
||||
start_time_(base::TimeTicks::HighResolutionNow()),
|
||||
top_down_(isolate) {}
|
||||
top_down_(profiler->isolate()),
|
||||
profiler_(profiler) {}
|
||||
|
||||
void CpuProfile::AddPath(base::TimeTicks timestamp,
|
||||
const std::vector<CodeEntry*>& path, int src_line,
|
||||
@ -432,12 +434,11 @@ void CodeMap::Print() {
|
||||
}
|
||||
}
|
||||
|
||||
CpuProfilesCollection::CpuProfilesCollection(Heap* heap)
|
||||
: function_and_resource_names_(heap),
|
||||
isolate_(heap->isolate()),
|
||||
CpuProfilesCollection::CpuProfilesCollection(Isolate* isolate)
|
||||
: function_and_resource_names_(isolate->heap()),
|
||||
profiler_(nullptr),
|
||||
current_profiles_semaphore_(1) {}
|
||||
|
||||
|
||||
static void DeleteCodeEntry(CodeEntry** entry_ptr) {
|
||||
delete *entry_ptr;
|
||||
}
|
||||
@ -470,7 +471,7 @@ bool CpuProfilesCollection::StartProfiling(const char* title,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
current_profiles_.Add(new CpuProfile(isolate_, title, record_samples));
|
||||
current_profiles_.Add(new CpuProfile(profiler_, title, record_samples));
|
||||
current_profiles_semaphore_.Signal();
|
||||
return true;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ class ProfileTree {
|
||||
|
||||
class CpuProfile {
|
||||
public:
|
||||
CpuProfile(Isolate* isolate, const char* title, bool record_samples);
|
||||
CpuProfile(CpuProfiler* profiler, const char* title, bool record_samples);
|
||||
|
||||
// Add pc -> ... -> main() call path to the profile.
|
||||
void AddPath(base::TimeTicks timestamp, const std::vector<CodeEntry*>& path,
|
||||
@ -246,6 +246,7 @@ class CpuProfile {
|
||||
|
||||
base::TimeTicks start_time() const { return start_time_; }
|
||||
base::TimeTicks end_time() const { return end_time_; }
|
||||
CpuProfiler* cpu_profiler() const { return profiler_; }
|
||||
|
||||
void UpdateTicksScale();
|
||||
|
||||
@ -259,6 +260,7 @@ class CpuProfile {
|
||||
List<ProfileNode*> samples_;
|
||||
List<base::TimeTicks> timestamps_;
|
||||
ProfileTree top_down_;
|
||||
CpuProfiler* const profiler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CpuProfile);
|
||||
};
|
||||
@ -289,9 +291,10 @@ class CodeMap {
|
||||
|
||||
class CpuProfilesCollection {
|
||||
public:
|
||||
explicit CpuProfilesCollection(Heap* heap);
|
||||
explicit CpuProfilesCollection(Isolate* isolate);
|
||||
~CpuProfilesCollection();
|
||||
|
||||
void set_cpu_profiler(CpuProfiler* profiler) { profiler_ = profiler; }
|
||||
bool StartProfiling(const char* title, bool record_samples);
|
||||
CpuProfile* StopProfiling(const char* title);
|
||||
List<CpuProfile*>* profiles() { return &finished_profiles_; }
|
||||
@ -330,8 +333,7 @@ class CpuProfilesCollection {
|
||||
StringsStorage function_and_resource_names_;
|
||||
List<CodeEntry*> code_entries_;
|
||||
List<CpuProfile*> finished_profiles_;
|
||||
|
||||
Isolate* isolate_;
|
||||
CpuProfiler* profiler_;
|
||||
|
||||
// Accessed by VM thread and profile generator thread.
|
||||
List<CpuProfile*> current_profiles_;
|
||||
|
@ -31,12 +31,12 @@
|
||||
|
||||
#include "include/v8-profiler.h"
|
||||
#include "src/base/platform/platform.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/profiler/cpu-profiler-inl.h"
|
||||
#include "src/utils.h"
|
||||
#include "test/cctest/cctest.h"
|
||||
#include "test/cctest/profiler-extension.h"
|
||||
|
||||
using i::CodeEntry;
|
||||
using i::CpuProfile;
|
||||
using i::CpuProfiler;
|
||||
@ -47,8 +47,6 @@ using i::ProfileNode;
|
||||
using i::ProfilerEventsProcessor;
|
||||
using i::ScopedVector;
|
||||
using i::Vector;
|
||||
using v8::base::SmartPointer;
|
||||
|
||||
|
||||
// Helper methods
|
||||
static v8::Local<v8::Function> GetFunction(v8::Local<v8::Context> env,
|
||||
@ -57,30 +55,26 @@ static v8::Local<v8::Function> GetFunction(v8::Local<v8::Context> env,
|
||||
env->Global()->Get(env, v8_str(name)).ToLocalChecked());
|
||||
}
|
||||
|
||||
|
||||
static size_t offset(const char* src, const char* substring) {
|
||||
const char* it = strstr(src, substring);
|
||||
CHECK(it);
|
||||
return static_cast<size_t>(it - src);
|
||||
}
|
||||
|
||||
|
||||
static const char* reason(const i::Deoptimizer::DeoptReason reason) {
|
||||
return i::Deoptimizer::GetDeoptReason(reason);
|
||||
}
|
||||
|
||||
|
||||
TEST(StartStop) {
|
||||
i::Isolate* isolate = CcTest::i_isolate();
|
||||
CpuProfilesCollection profiles(isolate->heap());
|
||||
CpuProfilesCollection profiles(CcTest::i_isolate());
|
||||
ProfileGenerator generator(&profiles);
|
||||
SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
|
||||
&generator, NULL, v8::base::TimeDelta::FromMicroseconds(100)));
|
||||
std::unique_ptr<ProfilerEventsProcessor> processor(
|
||||
new ProfilerEventsProcessor(&generator, nullptr,
|
||||
v8::base::TimeDelta::FromMicroseconds(100)));
|
||||
processor->Start();
|
||||
processor->StopSynchronously();
|
||||
}
|
||||
|
||||
|
||||
static void EnqueueTickSampleEvent(ProfilerEventsProcessor* proc,
|
||||
i::Address frame1,
|
||||
i::Address frame2 = NULL,
|
||||
@ -157,13 +151,13 @@ TEST(CodeEvents) {
|
||||
i::AbstractCode* args3_code = CreateCode(&env);
|
||||
i::AbstractCode* args4_code = CreateCode(&env);
|
||||
|
||||
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap());
|
||||
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate);
|
||||
ProfileGenerator* generator = new ProfileGenerator(profiles);
|
||||
ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(
|
||||
generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100));
|
||||
CpuProfiler profiler(isolate, profiles, generator, processor);
|
||||
profiles->StartProfiling("", false);
|
||||
ProfileGenerator generator(profiles);
|
||||
SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
|
||||
&generator, NULL, v8::base::TimeDelta::FromMicroseconds(100)));
|
||||
processor->Start();
|
||||
CpuProfiler profiler(isolate, profiles, &generator, processor.get());
|
||||
|
||||
// Enqueue code creation events.
|
||||
const char* aaa_str = "aaa";
|
||||
@ -177,26 +171,27 @@ TEST(CodeEvents) {
|
||||
profiler.CodeCreateEvent(i::Logger::STUB_TAG, args4_code, 4);
|
||||
|
||||
// Enqueue a tick event to enable code events processing.
|
||||
EnqueueTickSampleEvent(processor.get(), aaa_code->address());
|
||||
EnqueueTickSampleEvent(processor, aaa_code->address());
|
||||
|
||||
processor->StopSynchronously();
|
||||
|
||||
// Check the state of profile generator.
|
||||
CodeEntry* aaa = generator.code_map()->FindEntry(aaa_code->address());
|
||||
CodeEntry* aaa = generator->code_map()->FindEntry(aaa_code->address());
|
||||
CHECK(aaa);
|
||||
CHECK_EQ(0, strcmp(aaa_str, aaa->name()));
|
||||
|
||||
CodeEntry* comment = generator.code_map()->FindEntry(comment_code->address());
|
||||
CodeEntry* comment =
|
||||
generator->code_map()->FindEntry(comment_code->address());
|
||||
CHECK(comment);
|
||||
CHECK_EQ(0, strcmp("comment", comment->name()));
|
||||
|
||||
CodeEntry* args5 = generator.code_map()->FindEntry(args5_code->address());
|
||||
CodeEntry* args5 = generator->code_map()->FindEntry(args5_code->address());
|
||||
CHECK(args5);
|
||||
CHECK_EQ(0, strcmp("5", args5->name()));
|
||||
|
||||
CHECK(!generator.code_map()->FindEntry(comment2_code->address()));
|
||||
CHECK(!generator->code_map()->FindEntry(comment2_code->address()));
|
||||
|
||||
CodeEntry* comment2 = generator.code_map()->FindEntry(moved_code->address());
|
||||
CodeEntry* comment2 = generator->code_map()->FindEntry(moved_code->address());
|
||||
CHECK(comment2);
|
||||
CHECK_EQ(0, strcmp("comment2", comment2->name()));
|
||||
}
|
||||
@ -216,28 +211,26 @@ TEST(TickEvents) {
|
||||
i::AbstractCode* frame2_code = CreateCode(&env);
|
||||
i::AbstractCode* frame3_code = CreateCode(&env);
|
||||
|
||||
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap());
|
||||
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate);
|
||||
ProfileGenerator* generator = new ProfileGenerator(profiles);
|
||||
ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(
|
||||
generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100));
|
||||
CpuProfiler profiler(isolate, profiles, generator, processor);
|
||||
profiles->StartProfiling("", false);
|
||||
ProfileGenerator generator(profiles);
|
||||
SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
|
||||
&generator, NULL, v8::base::TimeDelta::FromMicroseconds(100)));
|
||||
processor->Start();
|
||||
CpuProfiler profiler(isolate, profiles, &generator, processor.get());
|
||||
|
||||
profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame1_code, "bbb");
|
||||
profiler.CodeCreateEvent(i::Logger::STUB_TAG, frame2_code, 5);
|
||||
profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, frame3_code, "ddd");
|
||||
|
||||
EnqueueTickSampleEvent(processor.get(), frame1_code->instruction_start());
|
||||
EnqueueTickSampleEvent(processor, frame1_code->instruction_start());
|
||||
EnqueueTickSampleEvent(
|
||||
processor.get(),
|
||||
processor,
|
||||
frame2_code->instruction_start() + frame2_code->ExecutableSize() / 2,
|
||||
frame1_code->instruction_start() + frame2_code->ExecutableSize() / 2);
|
||||
EnqueueTickSampleEvent(
|
||||
processor.get(),
|
||||
frame3_code->instruction_end() - 1,
|
||||
frame2_code->instruction_end() - 1,
|
||||
frame1_code->instruction_end() - 1);
|
||||
EnqueueTickSampleEvent(processor, frame3_code->instruction_end() - 1,
|
||||
frame2_code->instruction_end() - 1,
|
||||
frame1_code->instruction_end() - 1);
|
||||
|
||||
processor->StopSynchronously();
|
||||
CpuProfile* profile = profiles->StopProfiling("");
|
||||
@ -283,13 +276,13 @@ TEST(Issue1398) {
|
||||
|
||||
i::AbstractCode* code = CreateCode(&env);
|
||||
|
||||
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap());
|
||||
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate);
|
||||
ProfileGenerator* generator = new ProfileGenerator(profiles);
|
||||
ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(
|
||||
generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100));
|
||||
CpuProfiler profiler(isolate, profiles, generator, processor);
|
||||
profiles->StartProfiling("", false);
|
||||
ProfileGenerator generator(profiles);
|
||||
SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
|
||||
&generator, NULL, v8::base::TimeDelta::FromMicroseconds(100)));
|
||||
processor->Start();
|
||||
CpuProfiler profiler(isolate, profiles, &generator, processor.get());
|
||||
|
||||
profiler.CodeCreateEvent(i::Logger::BUILTIN_TAG, code, "bbb");
|
||||
|
||||
@ -1021,13 +1014,13 @@ static void TickLines(bool optimize) {
|
||||
i::Address code_address = code->instruction_start();
|
||||
CHECK(code_address);
|
||||
|
||||
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate->heap());
|
||||
CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate);
|
||||
ProfileGenerator* generator = new ProfileGenerator(profiles);
|
||||
ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(
|
||||
generator, nullptr, v8::base::TimeDelta::FromMicroseconds(100));
|
||||
CpuProfiler profiler(isolate, profiles, generator, processor);
|
||||
profiles->StartProfiling("", false);
|
||||
ProfileGenerator generator(profiles);
|
||||
SmartPointer<ProfilerEventsProcessor> processor(new ProfilerEventsProcessor(
|
||||
&generator, NULL, v8::base::TimeDelta::FromMicroseconds(100)));
|
||||
processor->Start();
|
||||
CpuProfiler profiler(isolate, profiles, &generator, processor.get());
|
||||
|
||||
// Enqueue code creation events.
|
||||
i::Handle<i::String> str = factory->NewStringFromAsciiChecked(func_name);
|
||||
@ -1037,7 +1030,7 @@ static void TickLines(bool optimize) {
|
||||
line, column);
|
||||
|
||||
// Enqueue a tick event to enable code events processing.
|
||||
EnqueueTickSampleEvent(processor.get(), code_address);
|
||||
EnqueueTickSampleEvent(processor, code_address);
|
||||
|
||||
processor->StopSynchronously();
|
||||
|
||||
@ -1045,7 +1038,7 @@ static void TickLines(bool optimize) {
|
||||
CHECK(profile);
|
||||
|
||||
// Check the state of profile generator.
|
||||
CodeEntry* func_entry = generator.code_map()->FindEntry(code_address);
|
||||
CodeEntry* func_entry = generator->code_map()->FindEntry(code_address);
|
||||
CHECK(func_entry);
|
||||
CHECK_EQ(0, strcmp(func_name, func_entry->name()));
|
||||
const i::JITLineInfoTable* line_info = func_entry->line_info();
|
||||
|
@ -344,7 +344,8 @@ class TestSetup {
|
||||
|
||||
TEST(RecordTickSample) {
|
||||
TestSetup test_setup;
|
||||
CpuProfilesCollection profiles(CcTest::heap());
|
||||
CpuProfilesCollection profiles(CcTest::i_isolate());
|
||||
profiles.set_cpu_profiler(CcTest::i_isolate()->cpu_profiler());
|
||||
profiles.StartProfiling("", false);
|
||||
ProfileGenerator generator(&profiles);
|
||||
CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa");
|
||||
@ -410,7 +411,8 @@ static void CheckNodeIds(ProfileNode* node, unsigned* expectedId) {
|
||||
|
||||
TEST(SampleIds) {
|
||||
TestSetup test_setup;
|
||||
CpuProfilesCollection profiles(CcTest::heap());
|
||||
CpuProfilesCollection profiles(CcTest::i_isolate());
|
||||
profiles.set_cpu_profiler(CcTest::i_isolate()->cpu_profiler());
|
||||
profiles.StartProfiling("", true);
|
||||
ProfileGenerator generator(&profiles);
|
||||
CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa");
|
||||
@ -461,7 +463,8 @@ TEST(SampleIds) {
|
||||
|
||||
TEST(NoSamples) {
|
||||
TestSetup test_setup;
|
||||
CpuProfilesCollection profiles(CcTest::heap());
|
||||
CpuProfilesCollection profiles(CcTest::i_isolate());
|
||||
profiles.set_cpu_profiler(CcTest::i_isolate()->cpu_profiler());
|
||||
profiles.StartProfiling("", false);
|
||||
ProfileGenerator generator(&profiles);
|
||||
CodeEntry* entry1 = profiles.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa");
|
||||
@ -544,7 +547,8 @@ TEST(RecordStackTraceAtStartProfiling) {
|
||||
|
||||
|
||||
TEST(Issue51919) {
|
||||
CpuProfilesCollection collection(CcTest::heap());
|
||||
CpuProfilesCollection collection(CcTest::i_isolate());
|
||||
collection.set_cpu_profiler(CcTest::i_isolate()->cpu_profiler());
|
||||
i::EmbeddedVector<char*,
|
||||
CpuProfilesCollection::kMaxSimultaneousProfiles> titles;
|
||||
for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) {
|
||||
@ -618,16 +622,12 @@ TEST(ProfileNodeScriptId) {
|
||||
CHECK_EQ(script_a->GetUnboundScript()->GetId(), current->GetScriptId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static const char* line_number_test_source_existing_functions =
|
||||
"function foo_at_the_first_line() {\n"
|
||||
"}\n"
|
||||
"foo_at_the_first_line();\n"
|
||||
"function lazy_func_at_forth_line() {}\n";
|
||||
|
||||
|
||||
static const char* line_number_test_source_profile_time_functions =
|
||||
"// Empty first line\n"
|
||||
"function bar_at_the_second_line() {\n"
|
||||
@ -652,7 +652,6 @@ int GetFunctionLineNumber(LocalContext* env, const char* name) {
|
||||
return func_entry->line_number();
|
||||
}
|
||||
|
||||
|
||||
TEST(LineNumber) {
|
||||
i::FLAG_use_inlining = false;
|
||||
|
||||
@ -683,8 +682,6 @@ TEST(LineNumber) {
|
||||
profiler->StopProfiling("LineNumber");
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(BailoutReason) {
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION);
|
||||
|
Loading…
Reference in New Issue
Block a user