Index: src/interpreter/bytecode-generator.h |
diff --git a/src/interpreter/bytecode-generator.h b/src/interpreter/bytecode-generator.h |
index 579365952b9fae9bd4fc51e4c902c0b8bd0c4133..c145a1e1c230d04a6cb699e53ae0b7e7c40e5202 100644 |
--- a/src/interpreter/bytecode-generator.h |
+++ b/src/interpreter/bytecode-generator.h |
@@ -236,6 +236,22 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> { |
inline LanguageMode language_mode() const; |
int feedback_index(FeedbackSlot slot) const; |
+ bool is_block_coverage() const; |
+ static const int kNoCoverageArraySlot = -1; |
+ int AllocateBlockCoverageSlot(SourceRange range) { |
+ if (!is_block_coverage() || range.IsEmpty()) { |
+ return kNoCoverageArraySlot; |
+ } |
+ const int slot = static_cast<int>(block_coverage_slots_.size()); |
+ block_coverage_slots_.emplace_back(range); |
+ return slot; |
+ } |
+ void IncBlockCounter(int coverage_array_slot) { |
+ if (coverage_array_slot == kNoCoverageArraySlot) return; |
+ DCHECK(is_block_coverage()); |
+ builder()->IncBlockCounter(coverage_array_slot); |
+ } |
rmcilroy
2017/06/01 14:01:50
I still have this comment here which was unanswere
jgruber
2017/06/02 06:39:27
Sorry I missed that one. I'm happy to factor out i
|
+ |
Zone* zone_; |
BytecodeArrayBuilder* builder_; |
CompilationInfo* info_; |
@@ -251,6 +267,10 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> { |
ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_; |
ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_; |
+ // Contains source range information for allocated block coverage counter |
+ // slots. Slot i covers range block_coverage_slots_[i]. |
+ ZoneVector<SourceRange> block_coverage_slots_; |
+ |
ControlScope* execution_control_; |
ContextScope* execution_context_; |
ExpressionResultScope* execution_result_; |