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

Unified Diff: src/cpu-profiler.h

Issue 13457002: Isolatify CPU profiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cpu-profiler.h
diff --git a/src/cpu-profiler.h b/src/cpu-profiler.h
index 2ec4c70a8fd101314f4a113e21c2d0a025b7b8ca..89d9c81c152b2d4618a8229eb37bcadaf3cf45a1 100644
--- a/src/cpu-profiler.h
+++ b/src/cpu-profiler.h
@@ -184,84 +184,71 @@ class ProfilerEventsProcessor : public Thread {
unsigned enqueue_order_;
};
-} } // namespace v8::internal
-
-#define PROFILE(isolate, Call) \
- LOG_CODE_EVENT(isolate, Call); \
- do { \
- if (v8::internal::CpuProfiler::is_profiling(isolate)) { \
- v8::internal::CpuProfiler::Call; \
- } \
+#define PROFILE(IsolateGetter, Call) \
+ do { \
+ Isolate* cpu_profiler_isolate = (IsolateGetter); \
+ LOG_CODE_EVENT(cpu_profiler_isolate, Call); \
+ CpuProfiler* cpu_profiler = cpu_profiler_isolate->cpu_profiler(); \
+ if (cpu_profiler->is_profiling()) { \
+ cpu_profiler->Call; \
+ } \
} while (false)
-namespace v8 {
-namespace internal {
-
-
-// TODO(isolates): isolatify this class.
class CpuProfiler {
public:
- static void SetUp();
- static void TearDown();
-
- static void StartProfiling(const char* title);
- static void StartProfiling(String* title, bool record_samples);
- static CpuProfile* StopProfiling(const char* title);
- static CpuProfile* StopProfiling(Object* security_token, String* title);
- static int GetProfilesCount();
- static CpuProfile* GetProfile(Object* security_token, int index);
- static CpuProfile* FindProfile(Object* security_token, unsigned uid);
- static void DeleteAllProfiles();
- static void DeleteProfile(CpuProfile* profile);
- static bool HasDetachedProfiles();
+ explicit CpuProfiler(Isolate* isolate);
+ ~CpuProfiler();
+
+ void StartProfiling(const char* title, bool record_samples = false);
+ void StartProfiling(String* title, bool record_samples);
+ CpuProfile* StopProfiling(const char* title);
+ CpuProfile* StopProfiling(Object* security_token, String* title);
+ int GetProfilesCount();
+ CpuProfile* GetProfile(Object* security_token, int index);
+ CpuProfile* FindProfile(Object* security_token, unsigned uid);
+ void DeleteAllProfiles();
+ void DeleteProfile(CpuProfile* profile);
+ bool HasDetachedProfiles();
// Invoked from stack sampler (thread or signal handler.)
- static TickSample* TickSampleEvent(Isolate* isolate);
+ TickSample* TickSampleEvent();
// Must be called via PROFILE macro, otherwise will crash when
// profiling is not enabled.
- static void CallbackEvent(Name* name, Address entry_point);
- static void CodeCreateEvent(Logger::LogEventsAndTags tag,
- Code* code, const char* comment);
- static void CodeCreateEvent(Logger::LogEventsAndTags tag,
- Code* code, Name* name);
- static void CodeCreateEvent(Logger::LogEventsAndTags tag,
- Code* code,
+ void CallbackEvent(Name* name, Address entry_point);
+ void CodeCreateEvent(Logger::LogEventsAndTags tag,
+ Code* code, const char* comment);
+ void CodeCreateEvent(Logger::LogEventsAndTags tag,
+ Code* code, Name* name);
+ void CodeCreateEvent(Logger::LogEventsAndTags tag,
+ Code* code,
SharedFunctionInfo* shared,
Name* name);
- static void CodeCreateEvent(Logger::LogEventsAndTags tag,
- Code* code,
- SharedFunctionInfo* shared,
- String* source, int line);
- static void CodeCreateEvent(Logger::LogEventsAndTags tag,
- Code* code, int args_count);
- static void CodeMovingGCEvent() {}
- static void CodeMoveEvent(Address from, Address to);
- static void CodeDeleteEvent(Address from);
- static void GetterCallbackEvent(Name* name, Address entry_point);
- static void RegExpCodeCreateEvent(Code* code, String* source);
- static void SetterCallbackEvent(Name* name, Address entry_point);
- static void SharedFunctionInfoMoveEvent(Address from, Address to);
-
- static INLINE(bool is_profiling(Isolate* isolate)) {
- CpuProfiler* profiler = isolate->cpu_profiler();
- return profiler != NULL && profiler->is_profiling_;
- }
+ void CodeCreateEvent(Logger::LogEventsAndTags tag,
+ Code* code,
+ SharedFunctionInfo* shared,
+ String* source, int line);
+ void CodeCreateEvent(Logger::LogEventsAndTags tag,
+ Code* code, int args_count);
+ void CodeMovingGCEvent() {}
+ void CodeMoveEvent(Address from, Address to);
+ void CodeDeleteEvent(Address from);
+ void GetterCallbackEvent(Name* name, Address entry_point);
+ void RegExpCodeCreateEvent(Code* code, String* source);
+ void SetterCallbackEvent(Name* name, Address entry_point);
+ void SharedFunctionInfoMoveEvent(Address from, Address to);
+
+ INLINE(bool is_profiling() const) { return is_profiling_; }
private:
- CpuProfiler();
- ~CpuProfiler();
- void StartCollectingProfile(const char* title, bool record_samples);
- void StartCollectingProfile(String* title, bool record_samples);
void StartProcessorIfNotStarted();
- CpuProfile* StopCollectingProfile(const char* title);
- CpuProfile* StopCollectingProfile(Object* security_token, String* title);
void StopProcessorIfLastProfile(const char* title);
void StopProcessor();
void ResetProfiles();
+ Isolate* isolate_;
CpuProfilesCollection* profiles_;
unsigned next_profile_uid_;
TokenEnumerator* token_enumerator_;
« no previous file with comments | « src/compiler.cc ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698