Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: src/profiler/profile-generator.h

Issue 2503393002: [cpu-profiler] use new source position information for deoptimization in cpu profiler (Closed)
Patch Set: addressed comment Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/profiler/cpu-profiler-inl.h ('k') | src/profiler/profile-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "src/allocation.h" 9 #include "src/allocation.h"
10 #include "src/base/hashmap.h" 10 #include "src/base/hashmap.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // CodeEntry doesn't own name strings, just references them. 42 // CodeEntry doesn't own name strings, just references them.
43 inline CodeEntry(CodeEventListener::LogEventsAndTags tag, const char* name, 43 inline CodeEntry(CodeEventListener::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 // Container describing inlined frames at eager deopt points. Is eventually
53 // being translated into v8::CpuProfileDeoptFrame by the profiler.
54 struct DeoptInlinedFrame {
55 int position;
56 int script_id;
57 };
58
59 const char* name_prefix() const { return name_prefix_; } 52 const char* name_prefix() const { return name_prefix_; }
60 bool has_name_prefix() const { return name_prefix_[0] != '\0'; } 53 bool has_name_prefix() const { return name_prefix_[0] != '\0'; }
61 const char* name() const { return name_; } 54 const char* name() const { return name_; }
62 const char* resource_name() const { return resource_name_; } 55 const char* resource_name() const { return resource_name_; }
63 int line_number() const { return line_number_; } 56 int line_number() const { return line_number_; }
64 int column_number() const { return column_number_; } 57 int column_number() const { return column_number_; }
65 const JITLineInfoTable* line_info() const { return line_info_; } 58 const JITLineInfoTable* line_info() const { return line_info_; }
66 int script_id() const { return script_id_; } 59 int script_id() const { return script_id_; }
67 void set_script_id(int script_id) { script_id_ = script_id; } 60 void set_script_id(int script_id) { script_id_ = script_id; }
68 int position() const { return position_; } 61 int position() const { return position_; }
69 void set_position(int position) { position_ = position; } 62 void set_position(int position) { position_ = position; }
70 void set_bailout_reason(const char* bailout_reason) { 63 void set_bailout_reason(const char* bailout_reason) {
71 bailout_reason_ = bailout_reason; 64 bailout_reason_ = bailout_reason;
72 } 65 }
73 const char* bailout_reason() const { return bailout_reason_; } 66 const char* bailout_reason() const { return bailout_reason_; }
74 67
75 void set_deopt_info(const char* deopt_reason, SourcePosition position, 68 void set_deopt_info(const char* deopt_reason, int deopt_id) {
76 int deopt_id) {
77 DCHECK(!has_deopt_info()); 69 DCHECK(!has_deopt_info());
78 deopt_reason_ = deopt_reason; 70 deopt_reason_ = deopt_reason;
79 deopt_position_ = position;
80 deopt_id_ = deopt_id; 71 deopt_id_ = deopt_id;
81 } 72 }
82 CpuProfileDeoptInfo GetDeoptInfo(); 73 CpuProfileDeoptInfo GetDeoptInfo();
83 bool has_deopt_info() const { return deopt_id_ != kNoDeoptimizationId; } 74 bool has_deopt_info() const { return deopt_id_ != kNoDeoptimizationId; }
84 void clear_deopt_info() { 75 void clear_deopt_info() {
85 deopt_reason_ = kNoDeoptReason; 76 deopt_reason_ = kNoDeoptReason;
86 deopt_position_ = SourcePosition::Unknown();
87 deopt_id_ = kNoDeoptimizationId; 77 deopt_id_ = kNoDeoptimizationId;
88 } 78 }
89 79
90 void FillFunctionInfo(SharedFunctionInfo* shared); 80 void FillFunctionInfo(SharedFunctionInfo* shared);
91 81
92 void SetBuiltinId(Builtins::Name id); 82 void SetBuiltinId(Builtins::Name id);
93 Builtins::Name builtin_id() const { 83 Builtins::Name builtin_id() const {
94 return BuiltinIdField::decode(bit_field_); 84 return BuiltinIdField::decode(bit_field_);
95 } 85 }
96 86
97 uint32_t GetHash() const; 87 uint32_t GetHash() const;
98 bool IsSameFunctionAs(CodeEntry* entry) const; 88 bool IsSameFunctionAs(CodeEntry* entry) const;
99 89
100 int GetSourceLine(int pc_offset) const; 90 int GetSourceLine(int pc_offset) const;
101 91
102 void AddInlineStack(int pc_offset, std::vector<CodeEntry*>& inline_stack); 92 void AddInlineStack(int pc_offset, std::vector<CodeEntry*> inline_stack);
103 const std::vector<CodeEntry*>* GetInlineStack(int pc_offset) const; 93 const std::vector<CodeEntry*>* GetInlineStack(int pc_offset) const;
104 94
105 void AddDeoptInlinedFrames(int deopt_id, std::vector<DeoptInlinedFrame>&); 95 void AddDeoptInlinedFrames(int deopt_id, std::vector<CpuProfileDeoptFrame>);
106 bool HasDeoptInlinedFramesFor(int deopt_id) const; 96 bool HasDeoptInlinedFramesFor(int deopt_id) const;
107 97
108 Address instruction_start() const { return instruction_start_; } 98 Address instruction_start() const { return instruction_start_; }
109 CodeEventListener::LogEventsAndTags tag() const { 99 CodeEventListener::LogEventsAndTags tag() const {
110 return TagField::decode(bit_field_); 100 return TagField::decode(bit_field_);
111 } 101 }
112 102
113 static const char* const kEmptyNamePrefix; 103 static const char* const kEmptyNamePrefix;
114 static const char* const kEmptyResourceName; 104 static const char* const kEmptyResourceName;
115 static const char* const kEmptyBailoutReason; 105 static const char* const kEmptyBailoutReason;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 uint32_t bit_field_; 150 uint32_t bit_field_;
161 const char* name_prefix_; 151 const char* name_prefix_;
162 const char* name_; 152 const char* name_;
163 const char* resource_name_; 153 const char* resource_name_;
164 int line_number_; 154 int line_number_;
165 int column_number_; 155 int column_number_;
166 int script_id_; 156 int script_id_;
167 int position_; 157 int position_;
168 const char* bailout_reason_; 158 const char* bailout_reason_;
169 const char* deopt_reason_; 159 const char* deopt_reason_;
170 SourcePosition deopt_position_;
171 int deopt_id_; 160 int deopt_id_;
172 JITLineInfoTable* line_info_; 161 JITLineInfoTable* line_info_;
173 Address instruction_start_; 162 Address instruction_start_;
174 // Should be an unordered_map, but it doesn't currently work on Win & MacOS. 163 // Should be an unordered_map, but it doesn't currently work on Win & MacOS.
175 std::map<int, std::vector<CodeEntry*>> inline_locations_; 164 std::map<int, std::vector<CodeEntry*>> inline_locations_;
176 std::map<int, std::vector<DeoptInlinedFrame>> deopt_inlined_frames_; 165 std::map<int, std::vector<CpuProfileDeoptFrame>> deopt_inlined_frames_;
177 166
178 DISALLOW_COPY_AND_ASSIGN(CodeEntry); 167 DISALLOW_COPY_AND_ASSIGN(CodeEntry);
179 }; 168 };
180 169
181 170
182 class ProfileTree; 171 class ProfileTree;
183 172
184 class ProfileNode { 173 class ProfileNode {
185 public: 174 public:
186 inline ProfileNode(ProfileTree* tree, CodeEntry* entry, ProfileNode* parent); 175 inline ProfileNode(ProfileTree* tree, CodeEntry* entry, ProfileNode* parent);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 CodeMap code_map_; 383 CodeMap code_map_;
395 384
396 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); 385 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator);
397 }; 386 };
398 387
399 388
400 } // namespace internal 389 } // namespace internal
401 } // namespace v8 390 } // namespace v8
402 391
403 #endif // V8_PROFILER_PROFILE_GENERATOR_H_ 392 #endif // V8_PROFILER_PROFILE_GENERATOR_H_
OLDNEW
« no previous file with comments | « src/profiler/cpu-profiler-inl.h ('k') | src/profiler/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698