| 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" |
| 11 #include "src/compiler.h" |
| 11 #include "src/hashmap.h" | 12 #include "src/hashmap.h" |
| 12 #include "src/strings-storage.h" | 13 #include "src/strings-storage.h" |
| 13 | 14 |
| 14 namespace v8 { | 15 namespace v8 { |
| 15 namespace internal { | 16 namespace internal { |
| 16 | 17 |
| 17 struct OffsetRange; | 18 struct OffsetRange; |
| 18 | 19 |
| 19 // Provides a mapping from the offsets within generated code to | 20 // Provides a mapping from the offsets within generated code to |
| 20 // the source line. | 21 // the source line. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 const JITLineInfoTable* line_info() const { return line_info_; } | 58 const JITLineInfoTable* line_info() const { return line_info_; } |
| 58 int script_id() const { return script_id_; } | 59 int script_id() const { return script_id_; } |
| 59 void set_script_id(int script_id) { script_id_ = script_id; } | 60 void set_script_id(int script_id) { script_id_ = script_id; } |
| 60 int position() const { return position_; } | 61 int position() const { return position_; } |
| 61 void set_position(int position) { position_ = position; } | 62 void set_position(int position) { position_ = position; } |
| 62 void set_bailout_reason(const char* bailout_reason) { | 63 void set_bailout_reason(const char* bailout_reason) { |
| 63 bailout_reason_ = bailout_reason; | 64 bailout_reason_ = bailout_reason; |
| 64 } | 65 } |
| 65 const char* bailout_reason() const { return bailout_reason_; } | 66 const char* bailout_reason() const { return bailout_reason_; } |
| 66 | 67 |
| 67 void set_deopt_info(const char* deopt_reason, int location) { | 68 void set_deopt_info(const char* deopt_reason, SourcePosition position) { |
| 68 DCHECK(!deopt_location_); | 69 DCHECK(deopt_position_.IsUnknown()); |
| 69 deopt_reason_ = deopt_reason; | 70 deopt_reason_ = deopt_reason; |
| 70 deopt_location_ = location; | 71 deopt_position_ = position; |
| 71 } | 72 } |
| 72 const char* deopt_reason() const { return deopt_reason_; } | 73 const char* deopt_reason() const { return deopt_reason_; } |
| 73 int deopt_location() const { return deopt_location_; } | 74 SourcePosition deopt_position() const { return deopt_position_; } |
| 74 bool has_deopt_info() const { return deopt_location_; } | 75 bool has_deopt_info() const { return !deopt_position_.IsUnknown(); } |
| 75 void clear_deopt_info() { | 76 void clear_deopt_info() { |
| 76 deopt_reason_ = kNoDeoptReason; | 77 deopt_reason_ = kNoDeoptReason; |
| 77 deopt_location_ = 0; | 78 deopt_position_ = SourcePosition::Unknown(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 void FillFunctionInfo(SharedFunctionInfo* shared); | 81 void FillFunctionInfo(SharedFunctionInfo* shared); |
| 81 | 82 |
| 82 static inline bool is_js_function_tag(Logger::LogEventsAndTags tag); | 83 static inline bool is_js_function_tag(Logger::LogEventsAndTags tag); |
| 83 | 84 |
| 84 List<OffsetRange>* no_frame_ranges() const { return no_frame_ranges_; } | 85 List<OffsetRange>* no_frame_ranges() const { return no_frame_ranges_; } |
| 85 void set_no_frame_ranges(List<OffsetRange>* ranges) { | 86 void set_no_frame_ranges(List<OffsetRange>* ranges) { |
| 86 no_frame_ranges_ = ranges; | 87 no_frame_ranges_ = ranges; |
| 87 } | 88 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 112 const char* name_prefix_; | 113 const char* name_prefix_; |
| 113 const char* name_; | 114 const char* name_; |
| 114 const char* resource_name_; | 115 const char* resource_name_; |
| 115 int line_number_; | 116 int line_number_; |
| 116 int column_number_; | 117 int column_number_; |
| 117 int script_id_; | 118 int script_id_; |
| 118 int position_; | 119 int position_; |
| 119 List<OffsetRange>* no_frame_ranges_; | 120 List<OffsetRange>* no_frame_ranges_; |
| 120 const char* bailout_reason_; | 121 const char* bailout_reason_; |
| 121 const char* deopt_reason_; | 122 const char* deopt_reason_; |
| 122 int deopt_location_; | 123 SourcePosition deopt_position_; |
| 123 JITLineInfoTable* line_info_; | 124 JITLineInfoTable* line_info_; |
| 124 Address instruction_start_; | 125 Address instruction_start_; |
| 125 | 126 |
| 126 DISALLOW_COPY_AND_ASSIGN(CodeEntry); | 127 DISALLOW_COPY_AND_ASSIGN(CodeEntry); |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 | 130 |
| 130 class ProfileTree; | 131 class ProfileTree; |
| 131 | 132 |
| 132 class ProfileNode { | 133 class ProfileNode { |
| 133 private: | 134 private: |
| 134 struct DeoptInfo { | 135 struct DeoptInfo { |
| 135 DeoptInfo(const char* deopt_reason, int deopt_location) | 136 DeoptInfo(const char* deopt_reason, SourcePosition deopt_position) |
| 136 : deopt_reason(deopt_reason), deopt_location(deopt_location) {} | 137 : deopt_reason(deopt_reason), deopt_position(deopt_position) {} |
| 137 DeoptInfo(const DeoptInfo& info) | 138 DeoptInfo(const DeoptInfo& info) |
| 138 : deopt_reason(info.deopt_reason), | 139 : deopt_reason(info.deopt_reason), |
| 139 deopt_location(info.deopt_location) {} | 140 deopt_position(info.deopt_position) {} |
| 140 const char* deopt_reason; | 141 const char* deopt_reason; |
| 141 int deopt_location; | 142 SourcePosition deopt_position; |
| 142 }; | 143 }; |
| 143 | 144 |
| 144 public: | 145 public: |
| 145 inline ProfileNode(ProfileTree* tree, CodeEntry* entry); | 146 inline ProfileNode(ProfileTree* tree, CodeEntry* entry); |
| 146 | 147 |
| 147 ProfileNode* FindChild(CodeEntry* entry); | 148 ProfileNode* FindChild(CodeEntry* entry); |
| 148 ProfileNode* FindOrAddChild(CodeEntry* entry); | 149 ProfileNode* FindOrAddChild(CodeEntry* entry); |
| 149 void IncrementSelfTicks() { ++self_ticks_; } | 150 void IncrementSelfTicks() { ++self_ticks_; } |
| 150 void IncreaseSelfTicks(unsigned amount) { self_ticks_ += amount; } | 151 void IncreaseSelfTicks(unsigned amount) { self_ticks_ += amount; } |
| 151 void IncrementLineTicks(int src_line); | 152 void IncrementLineTicks(int src_line); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 CodeEntry* gc_entry_; | 375 CodeEntry* gc_entry_; |
| 375 CodeEntry* unresolved_entry_; | 376 CodeEntry* unresolved_entry_; |
| 376 | 377 |
| 377 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 378 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
| 378 }; | 379 }; |
| 379 | 380 |
| 380 | 381 |
| 381 } } // namespace v8::internal | 382 } } // namespace v8::internal |
| 382 | 383 |
| 383 #endif // V8_PROFILE_GENERATOR_H_ | 384 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |