Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 549137a08e710dbfa38f7d8e98647eadb45a11d5..0d756c9a681fb7856c9d162d58d6097508acc701 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -13657,6 +13657,7 @@ void SharedFunctionInfo::InitFromFunctionLiteral( |
shared_info->set_needs_home_object(lit->scope()->NeedsHomeObject()); |
shared_info->set_asm_function(lit->scope()->asm_function()); |
shared_info->set_function_literal_id(lit->function_literal_id()); |
+ shared_info->set_coverage_info(Smi::kZero); // Set later on bytecode-gen. |
// For lazy parsed functions, the following flags will be inaccurate since we |
// don't have the information yet. They're set later in |
@@ -19284,6 +19285,43 @@ int BreakPointInfo::GetBreakPointCount() { |
return FixedArray::cast(break_point_objects())->length(); |
} |
+int CoverageInfo::SlotCount() const { |
+ DCHECK_EQ(kFirstSlotIndex, length() % kSlotIndexCount); |
+ return (length() - kFirstSlotIndex) / kSlotIndexCount; |
+} |
+ |
+int CoverageInfo::FromSourcePosition(int slot_index) const { |
+ DCHECK_LT(slot_index, SlotCount()); |
+ const int slot_start = CoverageInfo::FirstIndexForSlot(slot_index); |
+ return Smi::ToInt(get(slot_start + kSlotFromSourcePositionIndex)); |
+} |
+ |
+int CoverageInfo::ToSourcePosition(int slot_index) const { |
+ DCHECK_LT(slot_index, SlotCount()); |
+ const int slot_start = CoverageInfo::FirstIndexForSlot(slot_index); |
+ return Smi::ToInt(get(slot_start + kSlotToSourcePositionIndex)); |
+} |
+ |
+int CoverageInfo::BlockCount(int slot_index) const { |
+ DCHECK_LT(slot_index, SlotCount()); |
+ const int slot_start = CoverageInfo::FirstIndexForSlot(slot_index); |
+ return Smi::ToInt(get(slot_start + kSlotBlockCountIndex)); |
+} |
+ |
+void CoverageInfo::InitializeSlot(int slot_index, int from_pos, int to_pos) { |
+ DCHECK_LT(slot_index, SlotCount()); |
+ const int slot_start = CoverageInfo::FirstIndexForSlot(slot_index); |
+ set(slot_start + kSlotFromSourcePositionIndex, Smi::FromInt(from_pos)); |
+ set(slot_start + kSlotToSourcePositionIndex, Smi::FromInt(to_pos)); |
+ set(slot_start + kSlotBlockCountIndex, Smi::kZero); |
+} |
+ |
+void CoverageInfo::IncrementBlockCount(int slot_index) { |
+ DCHECK_LT(slot_index, SlotCount()); |
+ const int slot_start = CoverageInfo::FirstIndexForSlot(slot_index); |
+ const int old_count = BlockCount(slot_index); |
+ set(slot_start + kSlotBlockCountIndex, Smi::FromInt(old_count + 1)); |
+} |
// static |
MaybeHandle<JSDate> JSDate::New(Handle<JSFunction> constructor, |