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

Side by Side Diff: src/objects/debug-objects.h

Issue 2882973002: [coverage] Block coverage with support for IfStatements (Closed)
Patch Set: Address comments Created 3 years, 6 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/objects-printer.cc ('k') | src/objects/debug-objects.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 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
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
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 class CoverageInfo : public FixedArray {
148 public:
149 int SlotCount() const;
150
151 int StartSourcePosition(int slot_index) const;
152 int EndSourcePosition(int slot_index) const;
153 int BlockCount(int slot_index) const;
154
155 void InitializeSlot(int slot_index, int start_pos, int end_pos);
156 void IncrementBlockCount(int slot_index);
157
158 static int FixedArrayLengthForSlotCount(int slot_count) {
159 return slot_count * kSlotIndexCount + kFirstSlotIndex;
160 }
161
162 DECLARE_CAST(CoverageInfo)
163
164 private:
165 static int FirstIndexForSlot(int slot_index) {
166 return kFirstSlotIndex + slot_index * kSlotIndexCount;
167 }
168
169 static const int kFirstSlotIndex = 0;
170
171 // Each slot is assigned a group of indices starting at kFirstSlotIndex.
172 // Within this group, semantics are as follows:
173 static const int kSlotStartSourcePositionIndex = 0;
174 static const int kSlotEndSourcePositionIndex = 1;
175 static const int kSlotBlockCountIndex = 2;
176 static const int kSlotIndexCount = 3;
177
178 DISALLOW_IMPLICIT_CONSTRUCTORS(CoverageInfo);
179 };
180
135 } // namespace internal 181 } // namespace internal
136 } // namespace v8 182 } // namespace v8
137 183
138 #include "src/objects/object-macros-undef.h" 184 #include "src/objects/object-macros-undef.h"
139 185
140 #endif // V8_OBJECTS_DEBUG_OBJECTS_H_ 186 #endif // V8_OBJECTS_DEBUG_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/objects/debug-objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698