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

Side by Side Diff: src/source-position.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/profiler-listener.cc ('k') | src/source-position.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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_SOURCE_POSITION_H_ 5 #ifndef V8_SOURCE_POSITION_H_
6 #define V8_SOURCE_POSITION_H_ 6 #define V8_SOURCE_POSITION_H_
7 7
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "src/flags.h" 10 #include "src/flags.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 DCHECK(inlining_id <= InliningIdField::kMax - 2); 60 DCHECK(inlining_id <= InliningIdField::kMax - 2);
61 DCHECK(inlining_id >= kNotInlined); 61 DCHECK(inlining_id >= kNotInlined);
62 value_ = InliningIdField::update(value_, inlining_id + 1); 62 value_ = InliningIdField::update(value_, inlining_id + 1);
63 } 63 }
64 64
65 static const int kNotInlined = -1; 65 static const int kNotInlined = -1;
66 STATIC_ASSERT(kNoSourcePosition == -1); 66 STATIC_ASSERT(kNoSourcePosition == -1);
67 67
68 int64_t raw() const { return static_cast<int64_t>(value_); } 68 int64_t raw() const { return static_cast<int64_t>(value_); }
69 static SourcePosition FromRaw(int64_t raw) { 69 static SourcePosition FromRaw(int64_t raw) {
70 SourcePosition position = Unknown(); 70 SourcePosition position;
71 DCHECK_GE(raw, 0); 71 DCHECK_GE(raw, 0);
72 position.value_ = static_cast<uint64_t>(raw); 72 position.value_ = static_cast<uint64_t>(raw);
73 return position; 73 return position;
74 } 74 }
75 75
76 private: 76 private:
77 // SourcePosition is used in a union in CodeEventsContainer, which requires a
78 // trivial constructor.
79 SourcePosition() = default;
80
77 void Print(std::ostream& out, SharedFunctionInfo* function) const; 81 void Print(std::ostream& out, SharedFunctionInfo* function) const;
78 SourcePositionInfo Info(Handle<SharedFunctionInfo> script) const; 82 SourcePositionInfo Info(Handle<SharedFunctionInfo> script) const;
79 83
80 // InliningId is in the high bits for better compression in 84 // InliningId is in the high bits for better compression in
81 // SourcePositionTable. 85 // SourcePositionTable.
82 typedef BitField64<int, 0, 31> ScriptOffsetField; 86 typedef BitField64<int, 0, 31> ScriptOffsetField;
83 typedef BitField64<int, 31, 16> InliningIdField; 87 typedef BitField64<int, 31, 16> InliningIdField;
84 // Leaving the highest bit untouched to allow for signed conversion. 88 // Leaving the highest bit untouched to allow for signed conversion.
85 uint64_t value_; 89 uint64_t value_;
86 }; 90 };
87 91
88 inline bool operator==(const SourcePosition& lhs, const SourcePosition& rhs) { 92 inline bool operator==(const SourcePosition& lhs, const SourcePosition& rhs) {
89 return lhs.raw() == rhs.raw(); 93 return lhs.raw() == rhs.raw();
90 } 94 }
91 95
92 inline bool operator!=(const SourcePosition& lhs, const SourcePosition& rhs) { 96 inline bool operator!=(const SourcePosition& lhs, const SourcePosition& rhs) {
93 return !(lhs == rhs); 97 return !(lhs == rhs);
94 } 98 }
95 99
96 struct InliningPosition { 100 struct InliningPosition {
97 // position of the inlined call 101 // position of the inlined call
98 SourcePosition position = SourcePosition::Unknown(); 102 SourcePosition position = SourcePosition::Unknown();
99 103
100 // references position in DeoptimizationInputData::literals() 104 // references position in DeoptimizationInputData::literals()
101 int inlined_function_id; 105 int inlined_function_id;
102 }; 106 };
103 107
104 struct SourcePositionInfo { 108 struct SourcePositionInfo {
105 explicit SourcePositionInfo(SourcePosition pos, Handle<SharedFunctionInfo> f) 109 explicit SourcePositionInfo(SourcePosition pos) : position(pos) {}
106 : position(pos), function(f) {}
107 110
108 SourcePosition position; 111 SourcePosition position;
109 Handle<SharedFunctionInfo> function; 112 MaybeHandle<SharedFunctionInfo> function;
110 int line = -1; 113 int line = -1;
111 int column = -1; 114 int column = -1;
112 }; 115 };
113 116
114 std::ostream& operator<<(std::ostream& out, const SourcePosition& pos); 117 std::ostream& operator<<(std::ostream& out, const SourcePosition& pos);
115 118
116 std::ostream& operator<<(std::ostream& out, const SourcePositionInfo& pos); 119 std::ostream& operator<<(std::ostream& out, const SourcePositionInfo& pos);
117 std::ostream& operator<<(std::ostream& out, 120 std::ostream& operator<<(std::ostream& out,
118 const std::vector<SourcePositionInfo>& stack); 121 const std::vector<SourcePositionInfo>& stack);
119 122
120 } // namespace internal 123 } // namespace internal
121 } // namespace v8 124 } // namespace v8
122 125
123 #endif // V8_SOURCE_POSITION_H_ 126 #endif // V8_SOURCE_POSITION_H_
OLDNEW
« no previous file with comments | « src/profiler/profiler-listener.cc ('k') | src/source-position.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698