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

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

Issue 2561773002: Revert of Merged: [cpu-profiler] use new source position information for deoptimization in cpu profiler (Closed)
Patch Set: Created 4 years 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
52 const char* name_prefix() const { return name_prefix_; } 59 const char* name_prefix() const { return name_prefix_; }
53 bool has_name_prefix() const { return name_prefix_[0] != '\0'; } 60 bool has_name_prefix() const { return name_prefix_[0] != '\0'; }
54 const char* name() const { return name_; } 61 const char* name() const { return name_; }
55 const char* resource_name() const { return resource_name_; } 62 const char* resource_name() const { return resource_name_; }
56 int line_number() const { return line_number_; } 63 int line_number() const { return line_number_; }
57 int column_number() const { return column_number_; } 64 int column_number() const { return column_number_; }
58 const JITLineInfoTable* line_info() const { return line_info_; } 65 const JITLineInfoTable* line_info() const { return line_info_; }
59 int script_id() const { return script_id_; } 66 int script_id() const { return script_id_; }
60 void set_script_id(int script_id) { script_id_ = script_id; } 67 void set_script_id(int script_id) { script_id_ = script_id; }
61 int position() const { return position_; } 68 int position() const { return position_; }
62 void set_position(int position) { position_ = position; } 69 void set_position(int position) { position_ = position; }
63 void set_bailout_reason(const char* bailout_reason) { 70 void set_bailout_reason(const char* bailout_reason) {
64 bailout_reason_ = bailout_reason; 71 bailout_reason_ = bailout_reason;
65 } 72 }
66 const char* bailout_reason() const { return bailout_reason_; } 73 const char* bailout_reason() const { return bailout_reason_; }
67 74
68 void set_deopt_info(const char* deopt_reason, int deopt_id) { 75 void set_deopt_info(const char* deopt_reason, SourcePosition position,
76 int deopt_id) {
69 DCHECK(!has_deopt_info()); 77 DCHECK(!has_deopt_info());
70 deopt_reason_ = deopt_reason; 78 deopt_reason_ = deopt_reason;
79 deopt_position_ = position;
71 deopt_id_ = deopt_id; 80 deopt_id_ = deopt_id;
72 } 81 }
73 CpuProfileDeoptInfo GetDeoptInfo(); 82 CpuProfileDeoptInfo GetDeoptInfo();
74 bool has_deopt_info() const { return deopt_id_ != kNoDeoptimizationId; } 83 bool has_deopt_info() const { return deopt_id_ != kNoDeoptimizationId; }
75 void clear_deopt_info() { 84 void clear_deopt_info() {
76 deopt_reason_ = kNoDeoptReason; 85 deopt_reason_ = kNoDeoptReason;
86 deopt_position_ = SourcePosition::Unknown();
77 deopt_id_ = kNoDeoptimizationId; 87 deopt_id_ = kNoDeoptimizationId;
78 } 88 }
79 89
80 void FillFunctionInfo(SharedFunctionInfo* shared); 90 void FillFunctionInfo(SharedFunctionInfo* shared);
81 91
82 void SetBuiltinId(Builtins::Name id); 92 void SetBuiltinId(Builtins::Name id);
83 Builtins::Name builtin_id() const { 93 Builtins::Name builtin_id() const {
84 return BuiltinIdField::decode(bit_field_); 94 return BuiltinIdField::decode(bit_field_);
85 } 95 }
86 96
87 uint32_t GetHash() const; 97 uint32_t GetHash() const;
88 bool IsSameFunctionAs(CodeEntry* entry) const; 98 bool IsSameFunctionAs(CodeEntry* entry) const;
89 99
90 int GetSourceLine(int pc_offset) const; 100 int GetSourceLine(int pc_offset) const;
91 101
92 void AddInlineStack(int pc_offset, std::vector<CodeEntry*> inline_stack); 102 void AddInlineStack(int pc_offset, std::vector<CodeEntry*>& inline_stack);
93 const std::vector<CodeEntry*>* GetInlineStack(int pc_offset) const; 103 const std::vector<CodeEntry*>* GetInlineStack(int pc_offset) const;
94 104
95 void AddDeoptInlinedFrames(int deopt_id, std::vector<CpuProfileDeoptFrame>); 105 void AddDeoptInlinedFrames(int deopt_id, std::vector<DeoptInlinedFrame>&);
96 bool HasDeoptInlinedFramesFor(int deopt_id) const; 106 bool HasDeoptInlinedFramesFor(int deopt_id) const;
97 107
98 Address instruction_start() const { return instruction_start_; } 108 Address instruction_start() const { return instruction_start_; }
99 CodeEventListener::LogEventsAndTags tag() const { 109 CodeEventListener::LogEventsAndTags tag() const {
100 return TagField::decode(bit_field_); 110 return TagField::decode(bit_field_);
101 } 111 }
102 112
103 static const char* const kEmptyNamePrefix; 113 static const char* const kEmptyNamePrefix;
104 static const char* const kEmptyResourceName; 114 static const char* const kEmptyResourceName;
105 static const char* const kEmptyBailoutReason; 115 static const char* const kEmptyBailoutReason;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 uint32_t bit_field_; 160 uint32_t bit_field_;
151 const char* name_prefix_; 161 const char* name_prefix_;
152 const char* name_; 162 const char* name_;
153 const char* resource_name_; 163 const char* resource_name_;
154 int line_number_; 164 int line_number_;
155 int column_number_; 165 int column_number_;
156 int script_id_; 166 int script_id_;
157 int position_; 167 int position_;
158 const char* bailout_reason_; 168 const char* bailout_reason_;
159 const char* deopt_reason_; 169 const char* deopt_reason_;
170 SourcePosition deopt_position_;
160 int deopt_id_; 171 int deopt_id_;
161 JITLineInfoTable* line_info_; 172 JITLineInfoTable* line_info_;
162 Address instruction_start_; 173 Address instruction_start_;
163 // Should be an unordered_map, but it doesn't currently work on Win & MacOS. 174 // Should be an unordered_map, but it doesn't currently work on Win & MacOS.
164 std::map<int, std::vector<CodeEntry*>> inline_locations_; 175 std::map<int, std::vector<CodeEntry*>> inline_locations_;
165 std::map<int, std::vector<CpuProfileDeoptFrame>> deopt_inlined_frames_; 176 std::map<int, std::vector<DeoptInlinedFrame>> deopt_inlined_frames_;
166 177
167 DISALLOW_COPY_AND_ASSIGN(CodeEntry); 178 DISALLOW_COPY_AND_ASSIGN(CodeEntry);
168 }; 179 };
169 180
170 181
171 class ProfileTree; 182 class ProfileTree;
172 183
173 class ProfileNode { 184 class ProfileNode {
174 public: 185 public:
175 inline ProfileNode(ProfileTree* tree, CodeEntry* entry, ProfileNode* parent); 186 inline ProfileNode(ProfileTree* tree, CodeEntry* entry, ProfileNode* parent);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 CodeMap code_map_; 394 CodeMap code_map_;
384 395
385 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); 396 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator);
386 }; 397 };
387 398
388 399
389 } // namespace internal 400 } // namespace internal
390 } // namespace v8 401 } // namespace v8
391 402
392 #endif // V8_PROFILER_PROFILE_GENERATOR_H_ 403 #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