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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-printer.cc ('k') | src/objects/debug-objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects/debug-objects.h
diff --git a/src/objects/debug-objects.h b/src/objects/debug-objects.h
index 66edfac1c3ec5b637c488beb4cd0bf0499882547..8910786a8c0967c1f62fdd5193ada1bb848b281b 100644
--- a/src/objects/debug-objects.h
+++ b/src/objects/debug-objects.h
@@ -74,6 +74,16 @@ class DebugInfo : public Struct {
inline BytecodeArray* DebugBytecodeArray();
inline Code* DebugCode();
+ // --- Block Coverage ---
+ // ----------------------
+
+ bool HasCoverageInfo() const;
+
+ // Clears all fields related to block coverage. Returns true iff the
+ // DebugInfo is now empty.
+ bool ClearCoverageInfo();
+ DECL_ACCESSORS(coverage_info, Object)
+
DECLARE_CAST(DebugInfo)
// Dispatched behavior.
@@ -88,7 +98,8 @@ class DebugInfo : public Struct {
static const int kBreakPointsStateOffset =
kDebugBytecodeArrayOffset + kPointerSize;
static const int kFlagsOffset = kBreakPointsStateOffset + kPointerSize;
- static const int kSize = kFlagsOffset + kPointerSize;
+ static const int kCoverageInfoOffset = kFlagsOffset + kPointerSize;
+ static const int kSize = kCoverageInfoOffset + kPointerSize;
static const int kEstimatedNofBreakPointsInFunction = 4;
@@ -132,6 +143,41 @@ class BreakPointInfo : public Tuple2 {
DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo);
};
+// Holds information related to block code coverage.
+class CoverageInfo : public FixedArray {
+ public:
+ int SlotCount() const;
+
+ int StartSourcePosition(int slot_index) const;
+ int EndSourcePosition(int slot_index) const;
+ int BlockCount(int slot_index) const;
+
+ void InitializeSlot(int slot_index, int start_pos, int end_pos);
+ void IncrementBlockCount(int slot_index);
+
+ static int FixedArrayLengthForSlotCount(int slot_count) {
+ return slot_count * kSlotIndexCount + kFirstSlotIndex;
+ }
+
+ DECLARE_CAST(CoverageInfo)
+
+ private:
+ static int FirstIndexForSlot(int slot_index) {
+ return kFirstSlotIndex + slot_index * kSlotIndexCount;
+ }
+
+ static const int kFirstSlotIndex = 0;
+
+ // Each slot is assigned a group of indices starting at kFirstSlotIndex.
+ // Within this group, semantics are as follows:
+ static const int kSlotStartSourcePositionIndex = 0;
+ static const int kSlotEndSourcePositionIndex = 1;
+ static const int kSlotBlockCountIndex = 2;
+ static const int kSlotIndexCount = 3;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(CoverageInfo);
+};
+
} // namespace internal
} // namespace v8
« 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