| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PROFILER_PROFILE_GENERATOR_H_ | 5 #ifndef V8_PROFILER_PROFILE_GENERATOR_H_ |
| 6 #define V8_PROFILER_PROFILE_GENERATOR_H_ | 6 #define V8_PROFILER_PROFILE_GENERATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include "include/v8-profiler.h" | 9 #include "include/v8-profiler.h" |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // pc_offset -> source line | 31 // pc_offset -> source line |
| 32 typedef std::map<int, int> PcOffsetMap; | 32 typedef std::map<int, int> PcOffsetMap; |
| 33 PcOffsetMap pc_offset_map_; | 33 PcOffsetMap pc_offset_map_; |
| 34 DISALLOW_COPY_AND_ASSIGN(JITLineInfoTable); | 34 DISALLOW_COPY_AND_ASSIGN(JITLineInfoTable); |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 | 37 |
| 38 class CodeEntry { | 38 class CodeEntry { |
| 39 public: | 39 public: |
| 40 // CodeEntry doesn't own name strings, just references them. | 40 // CodeEntry doesn't own name strings, just references them. |
| 41 inline CodeEntry(Logger::LogEventsAndTags tag, const char* name, | 41 inline CodeEntry(CodeEventListener::LogEventsAndTags tag, const char* name, |
| 42 const char* name_prefix = CodeEntry::kEmptyNamePrefix, | 42 const char* name_prefix = CodeEntry::kEmptyNamePrefix, |
| 43 const char* resource_name = CodeEntry::kEmptyResourceName, | 43 const char* resource_name = CodeEntry::kEmptyResourceName, |
| 44 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, | 44 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, |
| 45 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, | 45 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, |
| 46 JITLineInfoTable* line_info = NULL, | 46 JITLineInfoTable* line_info = NULL, |
| 47 Address instruction_start = NULL); | 47 Address instruction_start = NULL); |
| 48 ~CodeEntry(); | 48 ~CodeEntry(); |
| 49 | 49 |
| 50 // Container describing inlined frames at eager deopt points. Is eventually | 50 // Container describing inlined frames at eager deopt points. Is eventually |
| 51 // being translated into v8::CpuProfileDeoptFrame by the profiler. | 51 // being translated into v8::CpuProfileDeoptFrame by the profiler. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 int GetSourceLine(int pc_offset) const; | 99 int GetSourceLine(int pc_offset) const; |
| 100 | 100 |
| 101 void AddInlineStack(int pc_offset, std::vector<CodeEntry*>& inline_stack); | 101 void AddInlineStack(int pc_offset, std::vector<CodeEntry*>& inline_stack); |
| 102 const std::vector<CodeEntry*>* GetInlineStack(int pc_offset) const; | 102 const std::vector<CodeEntry*>* GetInlineStack(int pc_offset) const; |
| 103 | 103 |
| 104 void AddDeoptInlinedFrames(int deopt_id, std::vector<DeoptInlinedFrame>&); | 104 void AddDeoptInlinedFrames(int deopt_id, std::vector<DeoptInlinedFrame>&); |
| 105 bool HasDeoptInlinedFramesFor(int deopt_id) const; | 105 bool HasDeoptInlinedFramesFor(int deopt_id) const; |
| 106 | 106 |
| 107 Address instruction_start() const { return instruction_start_; } | 107 Address instruction_start() const { return instruction_start_; } |
| 108 Logger::LogEventsAndTags tag() const { return TagField::decode(bit_field_); } | 108 CodeEventListener::LogEventsAndTags tag() const { |
| 109 return TagField::decode(bit_field_); |
| 110 } |
| 109 | 111 |
| 110 static const char* const kEmptyNamePrefix; | 112 static const char* const kEmptyNamePrefix; |
| 111 static const char* const kEmptyResourceName; | 113 static const char* const kEmptyResourceName; |
| 112 static const char* const kEmptyBailoutReason; | 114 static const char* const kEmptyBailoutReason; |
| 113 static const char* const kNoDeoptReason; | 115 static const char* const kNoDeoptReason; |
| 114 | 116 |
| 115 private: | 117 private: |
| 116 class TagField : public BitField<Logger::LogEventsAndTags, 0, 8> {}; | 118 class TagField : public BitField<Logger::LogEventsAndTags, 0, 8> {}; |
| 117 class BuiltinIdField : public BitField<Builtins::Name, 8, 24> {}; | 119 class BuiltinIdField : public BitField<Builtins::Name, 8, 24> {}; |
| 118 | 120 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 const char* GetFunctionName(Name* name) { | 306 const char* GetFunctionName(Name* name) { |
| 305 return function_and_resource_names_.GetFunctionName(name); | 307 return function_and_resource_names_.GetFunctionName(name); |
| 306 } | 308 } |
| 307 const char* GetFunctionName(const char* name) { | 309 const char* GetFunctionName(const char* name) { |
| 308 return function_and_resource_names_.GetFunctionName(name); | 310 return function_and_resource_names_.GetFunctionName(name); |
| 309 } | 311 } |
| 310 bool IsLastProfile(const char* title); | 312 bool IsLastProfile(const char* title); |
| 311 void RemoveProfile(CpuProfile* profile); | 313 void RemoveProfile(CpuProfile* profile); |
| 312 | 314 |
| 313 CodeEntry* NewCodeEntry( | 315 CodeEntry* NewCodeEntry( |
| 314 Logger::LogEventsAndTags tag, const char* name, | 316 CodeEventListener::LogEventsAndTags tag, const char* name, |
| 315 const char* name_prefix = CodeEntry::kEmptyNamePrefix, | 317 const char* name_prefix = CodeEntry::kEmptyNamePrefix, |
| 316 const char* resource_name = CodeEntry::kEmptyResourceName, | 318 const char* resource_name = CodeEntry::kEmptyResourceName, |
| 317 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, | 319 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, |
| 318 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, | 320 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, |
| 319 JITLineInfoTable* line_info = NULL, Address instruction_start = NULL); | 321 JITLineInfoTable* line_info = NULL, Address instruction_start = NULL); |
| 320 | 322 |
| 321 // Called from profile generator thread. | 323 // Called from profile generator thread. |
| 322 void AddPathToCurrentProfiles(base::TimeTicks timestamp, | 324 void AddPathToCurrentProfiles(base::TimeTicks timestamp, |
| 323 const std::vector<CodeEntry*>& path, | 325 const std::vector<CodeEntry*>& path, |
| 324 int src_line, bool update_stats); | 326 int src_line, bool update_stats); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 CodeEntry* unresolved_entry_; | 369 CodeEntry* unresolved_entry_; |
| 368 | 370 |
| 369 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 371 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
| 370 }; | 372 }; |
| 371 | 373 |
| 372 | 374 |
| 373 } // namespace internal | 375 } // namespace internal |
| 374 } // namespace v8 | 376 } // namespace v8 |
| 375 | 377 |
| 376 #endif // V8_PROFILER_PROFILE_GENERATOR_H_ | 378 #endif // V8_PROFILER_PROFILE_GENERATOR_H_ |
| OLD | NEW |