OLD | NEW |
---|---|
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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_OBJECTS_DEBUG_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_DEBUG_OBJECTS_H_ |
6 #define V8_OBJECTS_DEBUG_OBJECTS_H_ | 6 #define V8_OBJECTS_DEBUG_OBJECTS_H_ |
7 | 7 |
8 #include "src/objects.h" | 8 #include "src/objects.h" |
9 | 9 |
10 // Has to be the last include (doesn't have include guards): | 10 // Has to be the last include (doesn't have include guards): |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 // Get the number of break points for this function. | 67 // Get the number of break points for this function. |
68 int GetBreakPointCount(); | 68 int GetBreakPointCount(); |
69 | 69 |
70 inline bool HasDebugBytecodeArray(); | 70 inline bool HasDebugBytecodeArray(); |
71 inline bool HasDebugCode(); | 71 inline bool HasDebugCode(); |
72 | 72 |
73 inline BytecodeArray* OriginalBytecodeArray(); | 73 inline BytecodeArray* OriginalBytecodeArray(); |
74 inline BytecodeArray* DebugBytecodeArray(); | 74 inline BytecodeArray* DebugBytecodeArray(); |
75 inline Code* DebugCode(); | 75 inline Code* DebugCode(); |
76 | 76 |
77 // --- Block Coverage --- | |
78 // ---------------------- | |
79 | |
80 bool HasCoverageInfo() const; | |
81 | |
82 // Clears all fields related to block coverage. Returns true iff the | |
83 // DebugInfo is now empty. | |
84 bool ClearCoverageInfo(); | |
85 DECL_ACCESSORS(coverage_info, Object) | |
86 | |
77 DECLARE_CAST(DebugInfo) | 87 DECLARE_CAST(DebugInfo) |
78 | 88 |
79 // Dispatched behavior. | 89 // Dispatched behavior. |
80 DECLARE_PRINTER(DebugInfo) | 90 DECLARE_PRINTER(DebugInfo) |
81 DECLARE_VERIFIER(DebugInfo) | 91 DECLARE_VERIFIER(DebugInfo) |
82 | 92 |
83 static const int kSharedFunctionInfoOffset = Struct::kHeaderSize; | 93 static const int kSharedFunctionInfoOffset = Struct::kHeaderSize; |
84 static const int kDebuggerHintsOffset = | 94 static const int kDebuggerHintsOffset = |
85 kSharedFunctionInfoOffset + kPointerSize; | 95 kSharedFunctionInfoOffset + kPointerSize; |
86 static const int kDebugBytecodeArrayOffset = | 96 static const int kDebugBytecodeArrayOffset = |
87 kDebuggerHintsOffset + kPointerSize; | 97 kDebuggerHintsOffset + kPointerSize; |
88 static const int kBreakPointsStateOffset = | 98 static const int kBreakPointsStateOffset = |
89 kDebugBytecodeArrayOffset + kPointerSize; | 99 kDebugBytecodeArrayOffset + kPointerSize; |
90 static const int kFlagsOffset = kBreakPointsStateOffset + kPointerSize; | 100 static const int kFlagsOffset = kBreakPointsStateOffset + kPointerSize; |
91 static const int kSize = kFlagsOffset + kPointerSize; | 101 static const int kCoverageInfoOffset = kFlagsOffset + kPointerSize; |
102 static const int kSize = kCoverageInfoOffset + kPointerSize; | |
92 | 103 |
93 static const int kEstimatedNofBreakPointsInFunction = 4; | 104 static const int kEstimatedNofBreakPointsInFunction = 4; |
94 | 105 |
95 private: | 106 private: |
96 // Get the break point info object for a source position. | 107 // Get the break point info object for a source position. |
97 Object* GetBreakPointInfo(int source_position); | 108 Object* GetBreakPointInfo(int source_position); |
98 | 109 |
99 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo); | 110 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo); |
100 }; | 111 }; |
101 | 112 |
(...skipping 23 matching lines...) Expand all Loading... | |
125 | 136 |
126 DECLARE_CAST(BreakPointInfo) | 137 DECLARE_CAST(BreakPointInfo) |
127 | 138 |
128 static const int kSourcePositionOffset = kValue1Offset; | 139 static const int kSourcePositionOffset = kValue1Offset; |
129 static const int kBreakPointObjectsOffset = kValue2Offset; | 140 static const int kBreakPointObjectsOffset = kValue2Offset; |
130 | 141 |
131 private: | 142 private: |
132 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); | 143 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); |
133 }; | 144 }; |
134 | 145 |
146 // Holds information related to block code coverage. | |
147 // More information at go/v8-designdoc-block-code-coverage. | |
Michael Starzinger
2017/06/06 11:49:32
nit: Likewise, no "go" links.
jgruber
2017/06/06 14:52:46
Done.
| |
148 class CoverageInfo : public FixedArray { | |
149 public: | |
150 int SlotCount() const; | |
151 | |
152 int StartSourcePosition(int slot_index) const; | |
153 int EndSourcePosition(int slot_index) const; | |
154 int BlockCount(int slot_index) const; | |
155 | |
156 void InitializeSlot(int slot_index, int start_pos, int end_pos); | |
157 void IncrementBlockCount(int slot_index); | |
158 | |
159 static int FixedArrayLengthForSlotCount(int slot_count) { | |
160 return slot_count * kSlotIndexCount + kFirstSlotIndex; | |
161 } | |
162 | |
163 DECLARE_CAST(CoverageInfo) | |
164 | |
165 private: | |
166 static int FirstIndexForSlot(int slot_index) { | |
167 return kFirstSlotIndex + slot_index * kSlotIndexCount; | |
168 } | |
169 | |
170 static const int kFirstSlotIndex = 0; | |
171 | |
172 // Each slot is assigned a group of indices starting at kFirstSlotIndex. | |
173 // Within this group, semantics are as follows: | |
174 static const int kSlotStartSourcePositionIndex = 0; | |
175 static const int kSlotEndSourcePositionIndex = 1; | |
176 static const int kSlotBlockCountIndex = 2; | |
177 static const int kSlotIndexCount = 3; | |
178 | |
179 DISALLOW_IMPLICIT_CONSTRUCTORS(CoverageInfo); | |
180 }; | |
181 | |
135 } // namespace internal | 182 } // namespace internal |
136 } // namespace v8 | 183 } // namespace v8 |
137 | 184 |
138 #include "src/objects/object-macros-undef.h" | 185 #include "src/objects/object-macros-undef.h" |
139 | 186 |
140 #endif // V8_OBJECTS_DEBUG_OBJECTS_H_ | 187 #endif // V8_OBJECTS_DEBUG_OBJECTS_H_ |
OLD | NEW |