diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-10-24 15:30:26 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-10-28 10:17:58 +0100 |
commit | 124d91667abb203098baa7d6cf6011e8df5eeeff (patch) | |
tree | 105c8717e6a97f67656b3744863a1b8b310c74ce /deps/v8/src/debug/debug-coverage.cc | |
parent | 1b473542dc54cbf6185c12021076d5c7626046ea (diff) | |
download | node-new-124d91667abb203098baa7d6cf6011e8df5eeeff.tar.gz |
deps: patch V8 to 7.0.276.32
Refs: https://github.com/v8/v8/compare/7.0.276.28...7.0.276.32
PR-URL: https://github.com/nodejs/node/pull/23851
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'deps/v8/src/debug/debug-coverage.cc')
-rw-r--r-- | deps/v8/src/debug/debug-coverage.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/deps/v8/src/debug/debug-coverage.cc b/deps/v8/src/debug/debug-coverage.cc index a71c9e572b..f8b716f7c9 100644 --- a/deps/v8/src/debug/debug-coverage.cc +++ b/deps/v8/src/debug/debug-coverage.cc @@ -171,6 +171,12 @@ class CoverageBlockIterator final { return function_->blocks[read_index_ + 1]; } + CoverageBlock& GetPreviousBlock() { + DCHECK(IsActive()); + DCHECK_GT(read_index_, 0); + return function_->blocks[read_index_ - 1]; + } + CoverageBlock& GetParent() { DCHECK(IsActive()); return nesting_stack_.back(); @@ -325,6 +331,30 @@ void MergeNestedRanges(CoverageFunction* function) { } } +void FilterAliasedSingletons(CoverageFunction* function) { + CoverageBlockIterator iter(function); + + iter.Next(); // Advance once since we reference the previous block later. + + while (iter.Next()) { + CoverageBlock& previous_block = iter.GetPreviousBlock(); + CoverageBlock& block = iter.GetBlock(); + + bool is_singleton = block.end == kNoSourcePosition; + bool aliases_start = block.start == previous_block.start; + + if (is_singleton && aliases_start) { + // The previous block must have a full range since duplicate singletons + // have already been merged. + DCHECK_NE(previous_block.end, kNoSourcePosition); + // Likewise, the next block must have another start position since + // singletons are sorted to the end. + DCHECK_IMPLIES(iter.HasNext(), iter.GetNextBlock().start != block.start); + iter.DeleteBlock(); + } + } +} + void FilterUncoveredRanges(CoverageFunction* function) { CoverageBlockIterator iter(function); @@ -397,6 +427,15 @@ void CollectBlockCoverage(CoverageFunction* function, SharedFunctionInfo* info, // Remove duplicate singleton ranges, keeping the max count. MergeDuplicateSingletons(function); + // Remove singleton ranges with the same start position as a full range and + // throw away their counts. + // Singleton ranges are only intended to split existing full ranges and should + // never expand into a full range. Consider 'if (cond) { ... } else { ... }' + // as a problematic example; if the then-block produces a continuation + // singleton, it would incorrectly expand into the else range. + // For more context, see https://crbug.com/v8/8237. + FilterAliasedSingletons(function); + // Rewrite all singletons (created e.g. by continuations and unconditional // control flow) to ranges. RewritePositionSingletonsToRanges(function); |