diff options
author | Myles Borins <mylesborins@google.com> | 2019-09-24 11:56:38 -0400 |
---|---|---|
committer | Myles Borins <myles.borins@gmail.com> | 2019-10-07 03:19:23 -0400 |
commit | f7f6c928c1c9c136b7926f892b8a2fda11d8b4b2 (patch) | |
tree | f5edbccb3ffda2573d70a6e291e7157f290e0ae0 /deps/v8/src/debug/debug-coverage.cc | |
parent | ffd22e81983056d09c064c59343a0e488236272d (diff) | |
download | node-new-f7f6c928c1c9c136b7926f892b8a2fda11d8b4b2.tar.gz |
deps: update V8 to 7.8.279.9
PR-URL: https://github.com/nodejs/node/pull/29694
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Diffstat (limited to 'deps/v8/src/debug/debug-coverage.cc')
-rw-r--r-- | deps/v8/src/debug/debug-coverage.cc | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/deps/v8/src/debug/debug-coverage.cc b/deps/v8/src/debug/debug-coverage.cc index 15aad1fcc2..cb466ab6ab 100644 --- a/deps/v8/src/debug/debug-coverage.cc +++ b/deps/v8/src/debug/debug-coverage.cc @@ -476,6 +476,25 @@ void CollectBlockCoverage(CoverageFunction* function, SharedFunctionInfo info, ResetAllBlockCounts(info); } +void PrintBlockCoverage(const CoverageFunction* function, + SharedFunctionInfo info, bool has_nonempty_source_range, + bool function_is_relevant) { + DCHECK(FLAG_trace_block_coverage); + std::unique_ptr<char[]> function_name = + function->name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); + i::PrintF( + "Coverage for function='%s', SFI=%p, has_nonempty_source_range=%d, " + "function_is_relevant=%d\n", + function_name.get(), reinterpret_cast<void*>(info.ptr()), + has_nonempty_source_range, function_is_relevant); + i::PrintF("{start: %d, end: %d, count: %d}\n", function->start, function->end, + function->count); + for (const auto& block : function->blocks) { + i::PrintF("{start: %d, end: %d, count: %d}\n", block.start, block.end, + block.count); + } +} + void CollectAndMaybeResetCounts(Isolate* isolate, SharedToCounterMap* counter_map, v8::debug::CoverageMode coverage_mode) { @@ -668,9 +687,7 @@ std::unique_ptr<Coverage> Coverage::Collect( } // Only include a function range if itself or its parent function is - // covered, or if it contains non-trivial block coverage. It must also - // have a non-empty source range (otherwise it is not interesting to - // report). + // covered, or if it contains non-trivial block coverage. bool is_covered = (count != 0); bool parent_is_covered = (!nesting.empty() && functions->at(nesting.back()).count != 0); @@ -678,10 +695,19 @@ std::unique_ptr<Coverage> Coverage::Collect( bool function_is_relevant = (is_covered || parent_is_covered || has_block_coverage); - if (function.HasNonEmptySourceRange() && function_is_relevant) { + // It must also have a non-empty source range (otherwise it is not + // interesting to report). + bool has_nonempty_source_range = function.HasNonEmptySourceRange(); + + if (has_nonempty_source_range && function_is_relevant) { nesting.push_back(functions->size()); functions->emplace_back(function); } + + if (FLAG_trace_block_coverage) { + PrintBlockCoverage(&function, info, has_nonempty_source_range, + function_is_relevant); + } } // Remove entries for scripts that have no coverage. @@ -691,6 +717,13 @@ std::unique_ptr<Coverage> Coverage::Collect( } void Coverage::SelectMode(Isolate* isolate, debug::CoverageMode mode) { + if (mode != isolate->code_coverage_mode()) { + // Changing the coverage mode can change the bytecode that would be + // generated for a function, which can interfere with lazy source positions, + // so just force source position collection whenever there's such a change. + isolate->CollectSourcePositionsForAllBytecodeArrays(); + } + switch (mode) { case debug::CoverageMode::kBestEffort: // Note that DevTools switches back to best-effort coverage once the |