5 #ifndef V8_INTERPRETER_BLOCK_COVERAGE_BUILDER_H_ 6 #define V8_INTERPRETER_BLOCK_COVERAGE_BUILDER_H_ 8 #include "src/ast/ast-source-ranges.h" 9 #include "src/interpreter/bytecode-array-builder.h" 11 #include "src/zone/zone-containers.h" 15 namespace interpreter {
25 source_range_map_(source_range_map) {
26 DCHECK_NOT_NULL(builder);
27 DCHECK_NOT_NULL(source_range_map);
30 static constexpr
int kNoCoverageArraySlot = -1;
32 int AllocateBlockCoverageSlot(
ZoneObject* node, SourceRangeKind kind) {
34 if (ranges ==
nullptr)
return kNoCoverageArraySlot;
37 if (range.IsEmpty())
return kNoCoverageArraySlot;
39 const int slot =
static_cast<int>(slots_.size());
40 slots_.emplace_back(range);
44 int AllocateNaryBlockCoverageSlot(
NaryOperation* node,
size_t index) {
47 if (ranges ==
nullptr)
return kNoCoverageArraySlot;
50 if (range.IsEmpty())
return kNoCoverageArraySlot;
52 const int slot =
static_cast<int>(slots_.size());
53 slots_.emplace_back(range);
57 void IncrementBlockCounter(
int coverage_array_slot) {
58 if (coverage_array_slot == kNoCoverageArraySlot)
return;
59 builder_->IncBlockCounter(coverage_array_slot);
62 void IncrementBlockCounter(
ZoneObject* node, SourceRangeKind kind) {
63 int slot = AllocateBlockCoverageSlot(node, kind);
64 IncrementBlockCounter(slot);
81 #endif // V8_INTERPRETER_BLOCK_COVERAGE_BUILDER_H_