From: yurys@chromium.org Date: Tue, 19 Mar 2013 12:44:10 +0000 (+0000) Subject: Isolatify CPU profiler X-Git-Tag: upstream/4.7.83~14816 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8e9bebabde32c353056cfcaea35e08aa34def03;p=platform%2Fupstream%2Fv8.git Isolatify CPU profiler BUG=None Review URL: https://codereview.chromium.org/12706020 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13987 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/api.cc b/src/api.cc index 26db0de..dfa5765 100644 --- a/src/api.cc +++ b/src/api.cc @@ -6478,11 +6478,12 @@ const CpuProfileNode* CpuProfileNode::GetChild(int index) const { void CpuProfile::Delete() { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfile::Delete"); - i::CpuProfiler::DeleteProfile(reinterpret_cast(this)); - if (i::CpuProfiler::GetProfilesCount() == 0 && - !i::CpuProfiler::HasDetachedProfiles()) { + i::CpuProfiler* profiler = isolate->cpu_profiler(); + ASSERT(profiler != NULL); + profiler->DeleteProfile(reinterpret_cast(this)); + if (profiler->GetProfilesCount() == 0 && !profiler->HasDetachedProfiles()) { // If this was the last profile, clean up all accessory data as well. - i::CpuProfiler::DeleteAllProfiles(); + profiler->DeleteAllProfiles(); } } @@ -6525,7 +6526,9 @@ int CpuProfile::GetSamplesCount() const { int CpuProfiler::GetProfilesCount() { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount"); - return i::CpuProfiler::GetProfilesCount(); + i::CpuProfiler* profiler = isolate->cpu_profiler(); + ASSERT(profiler != NULL); + return profiler->GetProfilesCount(); } @@ -6533,8 +6536,10 @@ const CpuProfile* CpuProfiler::GetProfile(int index, Handle security_token) { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile"); + i::CpuProfiler* profiler = isolate->cpu_profiler(); + ASSERT(profiler != NULL); return reinterpret_cast( - i::CpuProfiler::GetProfile( + profiler->GetProfile( security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), index)); } @@ -6544,8 +6549,10 @@ const CpuProfile* CpuProfiler::FindProfile(unsigned uid, Handle security_token) { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile"); + i::CpuProfiler* profiler = isolate->cpu_profiler(); + ASSERT(profiler != NULL); return reinterpret_cast( - i::CpuProfiler::FindProfile( + profiler->FindProfile( security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), uid)); } @@ -6554,7 +6561,9 @@ const CpuProfile* CpuProfiler::FindProfile(unsigned uid, void CpuProfiler::StartProfiling(Handle title, bool record_samples) { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling"); - i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title), record_samples); + i::CpuProfiler* profiler = isolate->cpu_profiler(); + ASSERT(profiler != NULL); + profiler->StartProfiling(*Utils::OpenHandle(*title), record_samples); } @@ -6562,8 +6571,10 @@ const CpuProfile* CpuProfiler::StopProfiling(Handle title, Handle security_token) { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling"); + i::CpuProfiler* profiler = isolate->cpu_profiler(); + ASSERT(profiler != NULL); return reinterpret_cast( - i::CpuProfiler::StopProfiling( + profiler->StopProfiling( security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), *Utils::OpenHandle(*title))); } @@ -6572,7 +6583,9 @@ const CpuProfile* CpuProfiler::StopProfiling(Handle title, void CpuProfiler::DeleteAllProfiles() { i::Isolate* isolate = i::Isolate::Current(); IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles"); - i::CpuProfiler::DeleteAllProfiles(); + i::CpuProfiler* profiler = isolate->cpu_profiler(); + ASSERT(profiler != NULL); + profiler->DeleteAllProfiles(); } diff --git a/src/codegen.cc b/src/codegen.cc index 508e221..90ab2b5 100644 --- a/src/codegen.cc +++ b/src/codegen.cc @@ -171,7 +171,8 @@ void CodeGenerator::PrintCode(Handle code, CompilationInfo* info) { bool CodeGenerator::ShouldGenerateLog(Expression* type) { ASSERT(type != NULL); Isolate* isolate = Isolate::Current(); - if (!isolate->logger()->is_logging() && !CpuProfiler::is_profiling(isolate)) { + if (!isolate->logger()->is_logging() && + !isolate->cpu_profiler()->is_profiling()) { return false; } Handle name = Handle::cast(type->AsLiteral()->handle()); diff --git a/src/compiler.cc b/src/compiler.cc index 21ea25f..2c4dae5 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -1134,7 +1134,7 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, // script name and line number. Check explicitly whether logging is // enabled as finding the line number is not free. if (info->isolate()->logger()->is_logging_code_events() || - CpuProfiler::is_profiling(info->isolate())) { + info->isolate()->cpu_profiler()->is_profiling()) { Handle