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

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

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