| 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_PROFILE_GENERATOR_H_ | 5 #ifndef V8_PROFILE_GENERATOR_H_ |
| 6 #define V8_PROFILE_GENERATOR_H_ | 6 #define V8_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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // CodeEntry doesn't own name strings, just references them. | 42 // CodeEntry doesn't own name strings, just references them. |
| 43 inline CodeEntry(Logger::LogEventsAndTags tag, const char* name, | 43 inline CodeEntry(Logger::LogEventsAndTags tag, const char* name, |
| 44 const char* name_prefix = CodeEntry::kEmptyNamePrefix, | 44 const char* name_prefix = CodeEntry::kEmptyNamePrefix, |
| 45 const char* resource_name = CodeEntry::kEmptyResourceName, | 45 const char* resource_name = CodeEntry::kEmptyResourceName, |
| 46 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, | 46 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, |
| 47 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, | 47 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, |
| 48 JITLineInfoTable* line_info = NULL, | 48 JITLineInfoTable* line_info = NULL, |
| 49 Address instruction_start = NULL); | 49 Address instruction_start = NULL); |
| 50 ~CodeEntry(); | 50 ~CodeEntry(); |
| 51 | 51 |
| 52 bool is_js_function() const { return is_js_function_tag(tag()); } | |
| 53 const char* name_prefix() const { return name_prefix_; } | 52 const char* name_prefix() const { return name_prefix_; } |
| 54 bool has_name_prefix() const { return name_prefix_[0] != '\0'; } | 53 bool has_name_prefix() const { return name_prefix_[0] != '\0'; } |
| 55 const char* name() const { return name_; } | 54 const char* name() const { return name_; } |
| 56 const char* resource_name() const { return resource_name_; } | 55 const char* resource_name() const { return resource_name_; } |
| 57 int line_number() const { return line_number_; } | 56 int line_number() const { return line_number_; } |
| 58 int column_number() const { return column_number_; } | 57 int column_number() const { return column_number_; } |
| 59 const JITLineInfoTable* line_info() const { return line_info_; } | 58 const JITLineInfoTable* line_info() const { return line_info_; } |
| 60 int script_id() const { return script_id_; } | 59 int script_id() const { return script_id_; } |
| 61 void set_script_id(int script_id) { script_id_ = script_id; } | 60 void set_script_id(int script_id) { script_id_ = script_id; } |
| 62 int position() const { return position_; } | 61 int position() const { return position_; } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 77 const char* deopt_reason() const { return deopt_reason_; } | 76 const char* deopt_reason() const { return deopt_reason_; } |
| 78 SourcePosition deopt_position() const { return deopt_position_; } | 77 SourcePosition deopt_position() const { return deopt_position_; } |
| 79 bool has_deopt_info() const { return !deopt_position_.IsUnknown(); } | 78 bool has_deopt_info() const { return !deopt_position_.IsUnknown(); } |
| 80 void clear_deopt_info() { | 79 void clear_deopt_info() { |
| 81 deopt_reason_ = kNoDeoptReason; | 80 deopt_reason_ = kNoDeoptReason; |
| 82 deopt_position_ = SourcePosition::Unknown(); | 81 deopt_position_ = SourcePosition::Unknown(); |
| 83 } | 82 } |
| 84 | 83 |
| 85 void FillFunctionInfo(SharedFunctionInfo* shared); | 84 void FillFunctionInfo(SharedFunctionInfo* shared); |
| 86 | 85 |
| 87 static inline bool is_js_function_tag(Logger::LogEventsAndTags tag); | |
| 88 | |
| 89 List<OffsetRange>* no_frame_ranges() const { return no_frame_ranges_; } | 86 List<OffsetRange>* no_frame_ranges() const { return no_frame_ranges_; } |
| 90 void set_no_frame_ranges(List<OffsetRange>* ranges) { | 87 void set_no_frame_ranges(List<OffsetRange>* ranges) { |
| 91 no_frame_ranges_ = ranges; | 88 no_frame_ranges_ = ranges; |
| 92 } | 89 } |
| 93 void set_inlined_function_infos( | 90 void set_inlined_function_infos( |
| 94 const std::vector<InlinedFunctionInfo>& infos) { | 91 const std::vector<InlinedFunctionInfo>& infos) { |
| 95 inlined_function_infos_ = infos; | 92 inlined_function_infos_ = infos; |
| 96 } | 93 } |
| 97 const std::vector<InlinedFunctionInfo> inlined_function_infos() { | 94 const std::vector<InlinedFunctionInfo> inlined_function_infos() { |
| 98 return inlined_function_infos_; | 95 return inlined_function_infos_; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 DISALLOW_COPY_AND_ASSIGN(CpuProfile); | 259 DISALLOW_COPY_AND_ASSIGN(CpuProfile); |
| 263 }; | 260 }; |
| 264 | 261 |
| 265 | 262 |
| 266 class CodeMap { | 263 class CodeMap { |
| 267 public: | 264 public: |
| 268 CodeMap() {} | 265 CodeMap() {} |
| 269 ~CodeMap(); | 266 ~CodeMap(); |
| 270 void AddCode(Address addr, CodeEntry* entry, unsigned size); | 267 void AddCode(Address addr, CodeEntry* entry, unsigned size); |
| 271 void MoveCode(Address from, Address to); | 268 void MoveCode(Address from, Address to); |
| 272 CodeEntry* FindEntry(Address addr, Address* start = NULL); | 269 CodeEntry* FindEntry(Address addr); |
| 273 int GetSharedId(Address addr); | 270 int GetSharedId(Address addr); |
| 274 | 271 |
| 275 void Print(); | 272 void Print(); |
| 276 | 273 |
| 277 private: | 274 private: |
| 278 struct CodeEntryInfo { | 275 struct CodeEntryInfo { |
| 279 CodeEntryInfo(CodeEntry* an_entry, unsigned a_size) | 276 CodeEntryInfo(CodeEntry* an_entry, unsigned a_size) |
| 280 : entry(an_entry), size(a_size) { } | 277 : entry(an_entry), size(a_size) { } |
| 281 CodeEntry* entry; | 278 CodeEntry* entry; |
| 282 unsigned size; | 279 unsigned size; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 CodeEntry* gc_entry_; | 379 CodeEntry* gc_entry_; |
| 383 CodeEntry* unresolved_entry_; | 380 CodeEntry* unresolved_entry_; |
| 384 | 381 |
| 385 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 382 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
| 386 }; | 383 }; |
| 387 | 384 |
| 388 | 385 |
| 389 } } // namespace v8::internal | 386 } } // namespace v8::internal |
| 390 | 387 |
| 391 #endif // V8_PROFILE_GENERATOR_H_ | 388 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |