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

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

Issue 919953002: CPUProfiler: Push deopt reason further to ProfileNode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: unnecessary changes were removed Created 5 years, 10 months 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/ppc/lithium-codegen-ppc.cc ('k') | src/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_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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const char* resource_name() const { return resource_name_; } 83 const char* resource_name() const { return resource_name_; }
84 int line_number() const { return line_number_; } 84 int line_number() const { return line_number_; }
85 int column_number() const { return column_number_; } 85 int column_number() const { return column_number_; }
86 const JITLineInfoTable* line_info() const { return line_info_; } 86 const JITLineInfoTable* line_info() const { return line_info_; }
87 void set_shared_id(int shared_id) { shared_id_ = shared_id; } 87 void set_shared_id(int shared_id) { shared_id_ = shared_id; }
88 int script_id() const { return script_id_; } 88 int script_id() const { return script_id_; }
89 void set_script_id(int script_id) { script_id_ = script_id; } 89 void set_script_id(int script_id) { script_id_ = script_id; }
90 void set_bailout_reason(const char* bailout_reason) { 90 void set_bailout_reason(const char* bailout_reason) {
91 bailout_reason_ = bailout_reason; 91 bailout_reason_ = bailout_reason;
92 } 92 }
93 void set_deopt_reason(const char* deopt_reason) { 93 const char* bailout_reason() const { return bailout_reason_; }
94
95 void set_deopt_info(const char* deopt_reason, int location) {
96 DCHECK(!deopt_location_);
94 deopt_reason_ = deopt_reason; 97 deopt_reason_ = deopt_reason;
98 deopt_location_ = location;
95 } 99 }
96 void set_deopt_location(int location) { deopt_location_ = location; } 100 const char* deopt_reason() const { return deopt_reason_; }
97 const char* bailout_reason() const { return bailout_reason_; } 101 int deopt_location() const { return deopt_location_; }
102 bool has_deopt_info() const { return deopt_location_; }
103 void clear_deopt_info() {
104 deopt_reason_ = kNoDeoptReason;
105 deopt_location_ = 0;
106 }
98 107
99 static inline bool is_js_function_tag(Logger::LogEventsAndTags tag); 108 static inline bool is_js_function_tag(Logger::LogEventsAndTags tag);
100 109
101 List<OffsetRange>* no_frame_ranges() const { return no_frame_ranges_; } 110 List<OffsetRange>* no_frame_ranges() const { return no_frame_ranges_; }
102 void set_no_frame_ranges(List<OffsetRange>* ranges) { 111 void set_no_frame_ranges(List<OffsetRange>* ranges) {
103 no_frame_ranges_ = ranges; 112 no_frame_ranges_ = ranges;
104 } 113 }
105 114
106 void SetBuiltinId(Builtins::Name id); 115 void SetBuiltinId(Builtins::Name id);
107 Builtins::Name builtin_id() const { 116 Builtins::Name builtin_id() const {
108 return BuiltinIdField::decode(bit_field_); 117 return BuiltinIdField::decode(bit_field_);
109 } 118 }
110 119
111 uint32_t GetCallUid() const; 120 uint32_t GetCallUid() const;
112 bool IsSameAs(CodeEntry* entry) const; 121 bool IsSameAs(CodeEntry* entry) const;
113 122
114 int GetSourceLine(int pc_offset) const; 123 int GetSourceLine(int pc_offset) const;
115 124
116 Address instruction_start() const { return instruction_start_; } 125 Address instruction_start() const { return instruction_start_; }
117 126
118 static const char* const kEmptyNamePrefix; 127 static const char* const kEmptyNamePrefix;
119 static const char* const kEmptyResourceName; 128 static const char* const kEmptyResourceName;
120 static const char* const kEmptyBailoutReason; 129 static const char* const kEmptyBailoutReason;
130 static const char* const kNoDeoptReason;
121 131
122 private: 132 private:
123 class TagField : public BitField<Logger::LogEventsAndTags, 0, 8> {}; 133 class TagField : public BitField<Logger::LogEventsAndTags, 0, 8> {};
124 class BuiltinIdField : public BitField<Builtins::Name, 8, 8> {}; 134 class BuiltinIdField : public BitField<Builtins::Name, 8, 8> {};
125 Logger::LogEventsAndTags tag() const { return TagField::decode(bit_field_); } 135 Logger::LogEventsAndTags tag() const { return TagField::decode(bit_field_); }
126 136
127 uint32_t bit_field_; 137 uint32_t bit_field_;
128 const char* name_prefix_; 138 const char* name_prefix_;
129 const char* name_; 139 const char* name_;
130 const char* resource_name_; 140 const char* resource_name_;
131 int line_number_; 141 int line_number_;
132 int column_number_; 142 int column_number_;
133 int shared_id_; 143 int shared_id_;
134 int script_id_; 144 int script_id_;
135 List<OffsetRange>* no_frame_ranges_; 145 List<OffsetRange>* no_frame_ranges_;
136 const char* bailout_reason_; 146 const char* bailout_reason_;
137 const char* deopt_reason_; 147 const char* deopt_reason_;
138 int deopt_location_; 148 int deopt_location_;
139 JITLineInfoTable* line_info_; 149 JITLineInfoTable* line_info_;
140 Address instruction_start_; 150 Address instruction_start_;
141 151
142 DISALLOW_COPY_AND_ASSIGN(CodeEntry); 152 DISALLOW_COPY_AND_ASSIGN(CodeEntry);
143 }; 153 };
144 154
145 155
146 class ProfileTree; 156 class ProfileTree;
147 157
148 class ProfileNode { 158 class ProfileNode {
159 private:
160 struct DeoptInfo {
161 DeoptInfo(const char* deopt_reason, int deopt_location)
162 : deopt_reason(deopt_reason), deopt_location(deopt_location) {}
163 DeoptInfo(const DeoptInfo& info)
164 : deopt_reason(info.deopt_reason),
165 deopt_location(info.deopt_location) {}
166 const char* deopt_reason;
167 int deopt_location;
168 };
169
149 public: 170 public:
150 inline ProfileNode(ProfileTree* tree, CodeEntry* entry); 171 inline ProfileNode(ProfileTree* tree, CodeEntry* entry);
151 172
152 ProfileNode* FindChild(CodeEntry* entry); 173 ProfileNode* FindChild(CodeEntry* entry);
153 ProfileNode* FindOrAddChild(CodeEntry* entry); 174 ProfileNode* FindOrAddChild(CodeEntry* entry);
154 void IncrementSelfTicks() { ++self_ticks_; } 175 void IncrementSelfTicks() { ++self_ticks_; }
155 void IncreaseSelfTicks(unsigned amount) { self_ticks_ += amount; } 176 void IncreaseSelfTicks(unsigned amount) { self_ticks_ += amount; }
156 void IncrementLineTicks(int src_line); 177 void IncrementLineTicks(int src_line);
157 178
158 CodeEntry* entry() const { return entry_; } 179 CodeEntry* entry() const { return entry_; }
159 unsigned self_ticks() const { return self_ticks_; } 180 unsigned self_ticks() const { return self_ticks_; }
160 const List<ProfileNode*>* children() const { return &children_list_; } 181 const List<ProfileNode*>* children() const { return &children_list_; }
161 unsigned id() const { return id_; } 182 unsigned id() const { return id_; }
162 unsigned int GetHitLineCount() const { return line_ticks_.occupancy(); } 183 unsigned int GetHitLineCount() const { return line_ticks_.occupancy(); }
163 bool GetLineTicks(v8::CpuProfileNode::LineTick* entries, 184 bool GetLineTicks(v8::CpuProfileNode::LineTick* entries,
164 unsigned int length) const; 185 unsigned int length) const;
186 void CollectDeoptInfo(CodeEntry* entry);
187 const List<DeoptInfo>& deopt_infos() const { return deopt_infos_; }
165 188
166 void Print(int indent); 189 void Print(int indent);
167 190
168 private: 191 private:
169 static bool CodeEntriesMatch(void* entry1, void* entry2) { 192 static bool CodeEntriesMatch(void* entry1, void* entry2) {
170 return reinterpret_cast<CodeEntry*>(entry1)->IsSameAs( 193 return reinterpret_cast<CodeEntry*>(entry1)->IsSameAs(
171 reinterpret_cast<CodeEntry*>(entry2)); 194 reinterpret_cast<CodeEntry*>(entry2));
172 } 195 }
173 196
174 static uint32_t CodeEntryHash(CodeEntry* entry) { 197 static uint32_t CodeEntryHash(CodeEntry* entry) {
175 return entry->GetCallUid(); 198 return entry->GetCallUid();
176 } 199 }
177 200
178 static bool LineTickMatch(void* a, void* b) { return a == b; } 201 static bool LineTickMatch(void* a, void* b) { return a == b; }
179 202
180 ProfileTree* tree_; 203 ProfileTree* tree_;
181 CodeEntry* entry_; 204 CodeEntry* entry_;
182 unsigned self_ticks_; 205 unsigned self_ticks_;
183 // Mapping from CodeEntry* to ProfileNode* 206 // Mapping from CodeEntry* to ProfileNode*
184 HashMap children_; 207 HashMap children_;
185 List<ProfileNode*> children_list_; 208 List<ProfileNode*> children_list_;
186 unsigned id_; 209 unsigned id_;
187 HashMap line_ticks_; 210 HashMap line_ticks_;
188 211
212 List<DeoptInfo> deopt_infos_;
189 DISALLOW_COPY_AND_ASSIGN(ProfileNode); 213 DISALLOW_COPY_AND_ASSIGN(ProfileNode);
190 }; 214 };
191 215
192 216
193 class ProfileTree { 217 class ProfileTree {
194 public: 218 public:
195 ProfileTree(); 219 ProfileTree();
196 ~ProfileTree(); 220 ~ProfileTree();
197 221
198 ProfileNode* AddPathFromEnd( 222 ProfileNode* AddPathFromEnd(
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 CodeEntry* gc_entry_; 401 CodeEntry* gc_entry_;
378 CodeEntry* unresolved_entry_; 402 CodeEntry* unresolved_entry_;
379 403
380 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); 404 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator);
381 }; 405 };
382 406
383 407
384 } } // namespace v8::internal 408 } } // namespace v8::internal
385 409
386 #endif // V8_PROFILE_GENERATOR_H_ 410 #endif // V8_PROFILE_GENERATOR_H_
OLDNEW
« no previous file with comments | « src/ppc/lithium-codegen-ppc.cc ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698