Chromium Code Reviews| Index: src/profiler/profile-generator.h |
| diff --git a/src/profiler/profile-generator.h b/src/profiler/profile-generator.h |
| index 4e4e66e3b6703399a39cfd9ab33d6c0a42ad3928..fdd87f336f18ddc5ed0c3a86f3a601a02adead0b 100644 |
| --- a/src/profiler/profile-generator.h |
| +++ b/src/profiler/profile-generator.h |
| @@ -114,7 +114,45 @@ class CodeEntry { |
| static const char* const kEmptyBailoutReason; |
| static const char* const kNoDeoptReason; |
| + static const char* const kProgramEntryName; |
| + static const char* const kIdleEntryName; |
| + static const char* const kGarbageCollectorEntryName; |
| + // Used to represent frames for which we have no reliable way to |
| + // detect function. |
| + static const char* const kUnresolvedFunctionName; |
| + |
| + V8_INLINE static CodeEntry* program_entry() { |
|
alph
2016/06/17 10:38:44
Why do you need to move all these entries here?
lpy
2016/06/17 13:55:00
It seems to me that it makes more sense to put it
|
| + return kProgramEntry.Pointer(); |
| + } |
| + V8_INLINE static CodeEntry* idle_entry() { return kIdleEntry.Pointer(); } |
| + V8_INLINE static CodeEntry* gc_entry() { return kGCEntry.Pointer(); } |
| + V8_INLINE static CodeEntry* unresolved_entry() { |
| + return kUnresolvedEntry.Pointer(); |
| + } |
| + |
| private: |
| + struct ProgramEntryCreateTrait { |
| + static CodeEntry* Create(); |
| + }; |
| + struct IdleEntryCreateTrait { |
| + static CodeEntry* Create(); |
| + }; |
| + struct GCEntryCreateTrait { |
| + static CodeEntry* Create(); |
| + }; |
| + struct UnresolvedEntryCreateTrait { |
| + static CodeEntry* Create(); |
| + }; |
| + |
| + static base::LazyDynamicInstance<CodeEntry, ProgramEntryCreateTrait>::type |
| + kProgramEntry; |
| + static base::LazyDynamicInstance<CodeEntry, IdleEntryCreateTrait>::type |
| + kIdleEntry; |
| + static base::LazyDynamicInstance<CodeEntry, GCEntryCreateTrait>::type |
| + kGCEntry; |
| + static base::LazyDynamicInstance<CodeEntry, UnresolvedEntryCreateTrait>::type |
| + kUnresolvedEntry; |
| + |
| class TagField : public BitField<Logger::LogEventsAndTags, 0, 8> {}; |
| class BuiltinIdField : public BitField<Builtins::Name, 8, 24> {}; |
| @@ -300,29 +338,10 @@ class CpuProfilesCollection { |
| bool StartProfiling(const char* title, bool record_samples); |
| CpuProfile* StopProfiling(const char* title); |
| List<CpuProfile*>* profiles() { return &finished_profiles_; } |
| - const char* GetName(Name* name) { |
| - return function_and_resource_names_.GetName(name); |
| - } |
| - const char* GetName(int args_count) { |
| - return function_and_resource_names_.GetName(args_count); |
| - } |
| - const char* GetFunctionName(Name* name) { |
| - return function_and_resource_names_.GetFunctionName(name); |
| - } |
| - const char* GetFunctionName(const char* name) { |
| - return function_and_resource_names_.GetFunctionName(name); |
| - } |
| + const char* GetName(Name* name) { return resource_names_.GetName(name); } |
| bool IsLastProfile(const char* title); |
| void RemoveProfile(CpuProfile* profile); |
| - CodeEntry* NewCodeEntry( |
| - CodeEventListener::LogEventsAndTags tag, const char* name, |
| - const char* name_prefix = CodeEntry::kEmptyNamePrefix, |
| - const char* resource_name = CodeEntry::kEmptyResourceName, |
| - int line_number = v8::CpuProfileNode::kNoLineNumberInfo, |
| - int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, |
| - JITLineInfoTable* line_info = NULL, Address instruction_start = NULL); |
| - |
| // Called from profile generator thread. |
| void AddPathToCurrentProfiles(base::TimeTicks timestamp, |
| const std::vector<CodeEntry*>& path, |
| @@ -332,8 +351,7 @@ class CpuProfilesCollection { |
| static const int kMaxSimultaneousProfiles = 100; |
| private: |
| - StringsStorage function_and_resource_names_; |
| - List<CodeEntry*> code_entries_; |
| + StringsStorage resource_names_; |
| List<CpuProfile*> finished_profiles_; |
| CpuProfiler* profiler_; |
| @@ -353,22 +371,11 @@ class ProfileGenerator { |
| CodeMap* code_map() { return &code_map_; } |
| - static const char* const kProgramEntryName; |
| - static const char* const kIdleEntryName; |
| - static const char* const kGarbageCollectorEntryName; |
| - // Used to represent frames for which we have no reliable way to |
| - // detect function. |
| - static const char* const kUnresolvedFunctionName; |
| - |
| private: |
| CodeEntry* EntryForVMState(StateTag tag); |
| CpuProfilesCollection* profiles_; |
| CodeMap code_map_; |
| - CodeEntry* program_entry_; |
| - CodeEntry* idle_entry_; |
| - CodeEntry* gc_entry_; |
| - CodeEntry* unresolved_entry_; |
| DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
| }; |