• jgruber's avatar
    [coverage] Block coverage with support for IfStatements · b4241540
    jgruber authored
    This CL implements general infrastructure for block coverage together with
    initial support for if-statements.
    
    Coverage output can be generated in lcov format by d8 as follows:
    
    $ d8 --block-coverage --lcov=$(echo ~/simple-if.lcov) ~/simple-if.js
    $ genhtml ~/simple-if.lcov -o ~/simple-if
    $ chrome ~/simple-if/index.html
    
    A high level overview of the implementation follows:
    
    The parser now collects source ranges unconditionally for relevant AST nodes.
    Memory overhead is very low and this seemed like the cleanest and simplest
    alternative.
    
    Bytecode generation uses these ranges to allocate coverage slots and insert
    IncBlockCounter instructions (e.g. at the beginning of then- and else blocks
    for if-statements). The slot-range mapping is generated here and passed on
    through CompilationInfo, and is later accessible through the
    SharedFunctionInfo.
    
    The IncBlockCounter bytecode fetches the slot-range mapping (called
    CoverageInfo) from the shared function info and simply increments the counter.
    We don't collect native-context-specific counts as they are irrelevant to our
    use-cases.
    
    Coverage information is finally generated on-demand through Coverage::Collect.
    The only current consumer is a d8 front-end with lcov-style output, but the
    short-term goal is to expose this through the inspector protocol.
    
    BUG=v8:6000
    CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_rel_ng
    
    Review-Url: https://codereview.chromium.org/2882973002
    Cr-Commit-Position: refs/heads/master@{#45737}
    b4241540
Name
Last commit
Last update
..
api Loading commit data...
asmjs Loading commit data...
base Loading commit data...
compiler Loading commit data...
compiler-dispatcher Loading commit data...
heap Loading commit data...
interpreter Loading commit data...
libplatform Loading commit data...
parser Loading commit data...
wasm Loading commit data...
zone Loading commit data...
BUILD.gn Loading commit data...
DEPS Loading commit data...
cancelable-tasks-unittest.cc Loading commit data...
char-predicates-unittest.cc Loading commit data...
counters-unittest.cc Loading commit data...
eh-frame-iterator-unittest.cc Loading commit data...
eh-frame-writer-unittest.cc Loading commit data...
locked-queue-unittest.cc Loading commit data...
object-unittest.cc Loading commit data...
register-configuration-unittest.cc Loading commit data...
run-all-unittests.cc Loading commit data...
source-position-table-unittest.cc Loading commit data...
test-helpers.cc Loading commit data...
test-helpers.h Loading commit data...
test-utils.cc Loading commit data...
test-utils.h Loading commit data...
unicode-unittest.cc Loading commit data...
unittests.gyp Loading commit data...
unittests.isolate Loading commit data...
unittests.status Loading commit data...
value-serializer-unittest.cc Loading commit data...