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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // --- Block Coverage --- | 77 // --- Block Coverage --- |
78 // ---------------------- | 78 // ---------------------- |
79 | 79 |
80 bool HasCoverageInfo() const; | 80 bool HasCoverageInfo() const; |
81 | 81 |
82 // Clears all fields related to block coverage. Returns true iff the | 82 // Clears all fields related to block coverage. Returns true iff the |
83 // DebugInfo is now empty. | 83 // DebugInfo is now empty. |
84 bool ClearCoverageInfo(); | 84 bool ClearCoverageInfo(); |
85 DECL_ACCESSORS(coverage_info, Object) | 85 DECL_ACCESSORS(coverage_info, Object) |
86 | 86 |
87 DECLARE_CAST(DebugInfo) | 87 DECL_CAST(DebugInfo) |
88 | 88 |
89 // Dispatched behavior. | 89 // Dispatched behavior. |
90 DECLARE_PRINTER(DebugInfo) | 90 DECL_PRINTER(DebugInfo) |
91 DECLARE_VERIFIER(DebugInfo) | 91 DECL_VERIFIER(DebugInfo) |
92 | 92 |
93 static const int kSharedFunctionInfoOffset = Struct::kHeaderSize; | 93 static const int kSharedFunctionInfoOffset = Struct::kHeaderSize; |
94 static const int kDebuggerHintsOffset = | 94 static const int kDebuggerHintsOffset = |
95 kSharedFunctionInfoOffset + kPointerSize; | 95 kSharedFunctionInfoOffset + kPointerSize; |
96 static const int kDebugBytecodeArrayOffset = | 96 static const int kDebugBytecodeArrayOffset = |
97 kDebuggerHintsOffset + kPointerSize; | 97 kDebuggerHintsOffset + kPointerSize; |
98 static const int kBreakPointsStateOffset = | 98 static const int kBreakPointsStateOffset = |
99 kDebugBytecodeArrayOffset + kPointerSize; | 99 kDebugBytecodeArrayOffset + kPointerSize; |
100 static const int kFlagsOffset = kBreakPointsStateOffset + kPointerSize; | 100 static const int kFlagsOffset = kBreakPointsStateOffset + kPointerSize; |
101 static const int kCoverageInfoOffset = kFlagsOffset + kPointerSize; | 101 static const int kCoverageInfoOffset = kFlagsOffset + kPointerSize; |
(...skipping 25 matching lines...) Expand all Loading... |
127 static void SetBreakPoint(Handle<BreakPointInfo> info, | 127 static void SetBreakPoint(Handle<BreakPointInfo> info, |
128 Handle<Object> break_point_object); | 128 Handle<Object> break_point_object); |
129 // Check if break point info has this break point object. | 129 // Check if break point info has this break point object. |
130 static bool HasBreakPointObject(Handle<BreakPointInfo> info, | 130 static bool HasBreakPointObject(Handle<BreakPointInfo> info, |
131 Handle<Object> break_point_object); | 131 Handle<Object> break_point_object); |
132 // Get the number of break points for this code offset. | 132 // Get the number of break points for this code offset. |
133 int GetBreakPointCount(); | 133 int GetBreakPointCount(); |
134 | 134 |
135 int GetStatementPosition(Handle<DebugInfo> debug_info); | 135 int GetStatementPosition(Handle<DebugInfo> debug_info); |
136 | 136 |
137 DECLARE_CAST(BreakPointInfo) | 137 DECL_CAST(BreakPointInfo) |
138 | 138 |
139 static const int kSourcePositionOffset = kValue1Offset; | 139 static const int kSourcePositionOffset = kValue1Offset; |
140 static const int kBreakPointObjectsOffset = kValue2Offset; | 140 static const int kBreakPointObjectsOffset = kValue2Offset; |
141 | 141 |
142 private: | 142 private: |
143 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); | 143 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); |
144 }; | 144 }; |
145 | 145 |
146 // Holds information related to block code coverage. | 146 // Holds information related to block code coverage. |
147 class CoverageInfo : public FixedArray { | 147 class CoverageInfo : public FixedArray { |
148 public: | 148 public: |
149 int SlotCount() const; | 149 int SlotCount() const; |
150 | 150 |
151 int StartSourcePosition(int slot_index) const; | 151 int StartSourcePosition(int slot_index) const; |
152 int EndSourcePosition(int slot_index) const; | 152 int EndSourcePosition(int slot_index) const; |
153 int BlockCount(int slot_index) const; | 153 int BlockCount(int slot_index) const; |
154 | 154 |
155 void InitializeSlot(int slot_index, int start_pos, int end_pos); | 155 void InitializeSlot(int slot_index, int start_pos, int end_pos); |
156 void IncrementBlockCount(int slot_index); | 156 void IncrementBlockCount(int slot_index); |
157 void ResetBlockCount(int slot_index); | 157 void ResetBlockCount(int slot_index); |
158 | 158 |
159 static int FixedArrayLengthForSlotCount(int slot_count) { | 159 static int FixedArrayLengthForSlotCount(int slot_count) { |
160 return slot_count * kSlotIndexCount + kFirstSlotIndex; | 160 return slot_count * kSlotIndexCount + kFirstSlotIndex; |
161 } | 161 } |
162 | 162 |
163 DECLARE_CAST(CoverageInfo) | 163 DECL_CAST(CoverageInfo) |
164 | 164 |
165 private: | 165 private: |
166 static int FirstIndexForSlot(int slot_index) { | 166 static int FirstIndexForSlot(int slot_index) { |
167 return kFirstSlotIndex + slot_index * kSlotIndexCount; | 167 return kFirstSlotIndex + slot_index * kSlotIndexCount; |
168 } | 168 } |
169 | 169 |
170 static const int kFirstSlotIndex = 0; | 170 static const int kFirstSlotIndex = 0; |
171 | 171 |
172 // Each slot is assigned a group of indices starting at kFirstSlotIndex. | 172 // Each slot is assigned a group of indices starting at kFirstSlotIndex. |
173 // Within this group, semantics are as follows: | 173 // Within this group, semantics are as follows: |
174 static const int kSlotStartSourcePositionIndex = 0; | 174 static const int kSlotStartSourcePositionIndex = 0; |
175 static const int kSlotEndSourcePositionIndex = 1; | 175 static const int kSlotEndSourcePositionIndex = 1; |
176 static const int kSlotBlockCountIndex = 2; | 176 static const int kSlotBlockCountIndex = 2; |
177 static const int kSlotIndexCount = 3; | 177 static const int kSlotIndexCount = 3; |
178 | 178 |
179 DISALLOW_IMPLICIT_CONSTRUCTORS(CoverageInfo); | 179 DISALLOW_IMPLICIT_CONSTRUCTORS(CoverageInfo); |
180 }; | 180 }; |
181 | 181 |
182 } // namespace internal | 182 } // namespace internal |
183 } // namespace v8 | 183 } // namespace v8 |
184 | 184 |
185 #include "src/objects/object-macros-undef.h" | 185 #include "src/objects/object-macros-undef.h" |
186 | 186 |
187 #endif // V8_OBJECTS_DEBUG_OBJECTS_H_ | 187 #endif // V8_OBJECTS_DEBUG_OBJECTS_H_ |
OLD | NEW |