| Index: src/interpreter/bytecode-generator.h
|
| diff --git a/src/interpreter/bytecode-generator.h b/src/interpreter/bytecode-generator.h
|
| index 579365952b9fae9bd4fc51e4c902c0b8bd0c4133..55c6fc1342da0d82ce0c2545880077aacbfb71a4 100644
|
| --- a/src/interpreter/bytecode-generator.h
|
| +++ b/src/interpreter/bytecode-generator.h
|
| @@ -236,6 +236,19 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
|
| inline LanguageMode language_mode() const;
|
| int feedback_index(FeedbackSlot slot) const;
|
|
|
| + bool is_block_coverage() const;
|
| + int AllocateBlockCoverageSlot(SourceRange range) {
|
| + if (!is_block_coverage() || range.IsEmpty()) return -1;
|
| + const int slot = static_cast<int>(block_coverage_slots_.size());
|
| + block_coverage_slots_.emplace_back(range);
|
| + return slot;
|
| + }
|
| + void IncBlockCounter(SourceRange range) {
|
| + if (is_block_coverage() && !range.IsEmpty()) {
|
| + builder()->IncBlockCounter(AllocateBlockCoverageSlot(range));
|
| + }
|
| + }
|
| +
|
| Zone* zone_;
|
| BytecodeArrayBuilder* builder_;
|
| CompilationInfo* info_;
|
| @@ -251,6 +264,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_;
|
|
|