Chromium Code Reviews| Index: src/cpu-profiler.h |
| diff --git a/src/cpu-profiler.h b/src/cpu-profiler.h |
| index 2ec4c70a8fd101314f4a113e21c2d0a025b7b8ca..7177016d2aa75c7faace816666adee5886fdc64a 100644 |
| --- a/src/cpu-profiler.h |
| +++ b/src/cpu-profiler.h |
| @@ -184,84 +184,70 @@ class ProfilerEventsProcessor : public Thread { |
| unsigned enqueue_order_; |
| }; |
| -} } // namespace v8::internal |
| - |
| #define PROFILE(isolate, Call) \ |
|
Sven Panne
2013/03/19 11:54:53
Don't use a macro parameter more than once, assign
yurys
2013/03/19 12:25:11
Done.
|
| LOG_CODE_EVENT(isolate, Call); \ |
| do { \ |
| - if (v8::internal::CpuProfiler::is_profiling(isolate)) { \ |
| - v8::internal::CpuProfiler::Call; \ |
| + CpuProfiler* cpu_profiler = isolate->cpu_profiler(); \ |
|
alph
2013/03/19 11:44:28
nit: put macro argument in parentheses
yurys
2013/03/19 12:25:11
Done.
|
| + if (cpu_profiler->is_profiling()) { \ |
|
yurys
2013/03/19 10:42:06
I don't think we have to check if cpu_profiler is
|
| + 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_; |