Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Issue 2882973002: [coverage] Block coverage with support for IfStatements (Closed)

Created:
3 years, 7 months ago by jgruber
Modified:
3 years, 6 months ago
CC:
v8-reviews_googlegroups.com, kozy
Target Ref:
refs/heads/master
Project:
v8
Visibility:
Public.

Description

[coverage] Block coverage with support for IfStatements 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} Committed: https://chromium.googlesource.com/v8/v8/+/b42415402f0d251ab879bb168b386bcd71fdc35d

Patch Set 1 #

Patch Set 2 : Clean up #

Patch Set 3 : Compile nit #

Patch Set 4 : Comment nit #

Total comments: 25

Patch Set 5 : Rebase #

Patch Set 6 : Rename from->start, to->end #

Patch Set 7 : arm,arm64,ia32 ports #

Patch Set 8 : Rebase #

Patch Set 9 : Rebase #

Total comments: 1

Patch Set 10 : Address self-review #

Patch Set 11 : Remove coverage infos #

Total comments: 9

Patch Set 12 : Address comments #

Patch Set 13 : Whitespace #

Total comments: 6

Patch Set 14 : Main thread DCHECK #

Patch Set 15 : Two fixes #

Total comments: 12

Patch Set 16 : Address comments #

Total comments: 15

Patch Set 17 : Address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+707 lines, -72 lines) Patch
M src/api.cc View 1 2 3 4 5 6 7 8 2 chunks +13 lines, -0 lines 0 comments Download
M src/ast/ast.h View 1 2 3 4 5 6 7 8 5 chunks +21 lines, -8 lines 0 comments Download
M src/compilation-info.h View 1 2 3 4 5 6 7 8 5 chunks +18 lines, -0 lines 0 comments Download
M src/compilation-info.cc View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -0 lines 0 comments Download
M src/compiler.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +7 lines, -0 lines 0 comments Download
M src/compiler/bytecode-graph-builder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +12 lines, -0 lines 0 comments Download
M src/compiler/linkage.cc View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/d8.cc View 1 2 3 4 5 6 7 8 3 chunks +61 lines, -26 lines 0 comments Download
M src/debug/debug.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +8 lines, -0 lines 0 comments Download
M src/debug/debug.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +41 lines, -14 lines 0 comments Download
M src/debug/debug-coverage.h View 1 2 3 4 5 2 chunks +9 lines, -0 lines 0 comments Download
M src/debug/debug-coverage.cc View 1 2 3 4 5 6 7 8 9 10 6 chunks +44 lines, -1 line 0 comments Download
M src/debug/debug-interface.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +23 lines, -2 lines 0 comments Download
M src/factory.h View 1 2 3 4 2 chunks +4 lines, -0 lines 0 comments Download
M src/factory.cc View 1 2 3 4 5 1 chunk +16 lines, -0 lines 0 comments Download
M src/flag-definitions.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M src/interpreter/bytecode-array-builder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +3 lines, -0 lines 0 comments Download
M src/interpreter/bytecode-array-builder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +6 lines, -0 lines 0 comments Download
M src/interpreter/bytecode-generator.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 chunks +5 lines, -0 lines 0 comments Download
M src/interpreter/bytecode-generator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 6 chunks +65 lines, -0 lines 0 comments Download
M src/interpreter/bytecodes.h View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M src/interpreter/interpreter-generator.cc View 1 2 3 4 5 6 7 8 1 chunk +14 lines, -0 lines 0 comments Download
M src/isolate.h View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -0 lines 0 comments Download
M src/objects.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M src/objects.cc View 1 2 3 4 5 6 7 8 1 chunk +8 lines, -0 lines 0 comments Download
M src/objects-inl.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download
M src/objects-printer.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M src/objects/debug-objects.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +47 lines, -1 line 0 comments Download
M src/objects/debug-objects.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +61 lines, -0 lines 0 comments Download
M src/objects/debug-objects-inl.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M src/objects/shared-function-info.h View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -0 lines 0 comments Download
M src/parsing/parser-base.h View 1 2 3 4 5 6 7 8 2 chunks +45 lines, -2 lines 0 comments Download
M src/parsing/preparser.h View 1 2 3 4 1 chunk +3 lines, -2 lines 0 comments Download
M src/runtime/runtime.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +3 lines, -1 line 0 comments Download
M src/runtime/runtime-debug.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +61 lines, -15 lines 0 comments Download
A test/mjsunit/code-coverage-block.js View 1 2 3 4 5 6 7 8 1 chunk +83 lines, -0 lines 0 comments Download
M test/unittests/interpreter/bytecode-array-builder-unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 85 (62 generated)
jgruber
Hi Marja, Ross, the block coverage prototype is getting closer in shape to how I ...
3 years, 7 months ago (2017-05-17 16:14:53 UTC) #13
marja
ast/* and parsing/* lgtm with comments https://codereview.chromium.org/2882973002/diff/60001/src/ast/ast.h File src/ast/ast.h (right): https://codereview.chromium.org/2882973002/diff/60001/src/ast/ast.h#newcode187 src/ast/ast.h:187: int32_t from, to; ...
3 years, 7 months ago (2017-05-18 11:30:17 UTC) #14
rmcilroy
Just looked at the interpreter bits. Overall looks reasonable, but a couple of suggestions. Also, ...
3 years, 7 months ago (2017-05-18 14:18:00 UTC) #15
jgruber
Thanks for the look, answers inline. > Also, are you going to do this for ...
3 years, 7 months ago (2017-05-22 09:43:32 UTC) #16
rmcilroy
https://codereview.chromium.org/2882973002/diff/60001/src/objects.h File src/objects.h (right): https://codereview.chromium.org/2882973002/diff/60001/src/objects.h#newcode1580 src/objects.h:1580: static inline int ToInt(Object* o); On 2017/05/22 09:43:32, jgruber ...
3 years, 7 months ago (2017-05-22 11:08:46 UTC) #17
jgruber
https://codereview.chromium.org/2882973002/diff/60001/src/runtime/runtime-debug.cc File src/runtime/runtime-debug.cc (right): https://codereview.chromium.org/2882973002/diff/60001/src/runtime/runtime-debug.cc#newcode1979 src/runtime/runtime-debug.cc:1979: CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 0); On 2017/05/22 11:08:46, rmcilroy wrote: > ...
3 years, 7 months ago (2017-05-22 11:10:08 UTC) #18
marja
https://codereview.chromium.org/2882973002/diff/60001/src/ast/ast.h File src/ast/ast.h (right): https://codereview.chromium.org/2882973002/diff/60001/src/ast/ast.h#newcode187 src/ast/ast.h:187: int32_t from, to; On 2017/05/22 09:43:32, jgruber wrote: > ...
3 years, 7 months ago (2017-05-22 12:55:37 UTC) #19
jgruber
Now that DebugInfo changes have landed, I think this is ready for review. There's a ...
3 years, 6 months ago (2017-06-01 11:56:27 UTC) #45
rmcilroy
Thanks for moving to DebugInfo. A couple more comments. https://codereview.chromium.org/2882973002/diff/200001/src/compiler.cc File src/compiler.cc (right): https://codereview.chromium.org/2882973002/diff/200001/src/compiler.cc#newcode466 src/compiler.cc:466: ...
3 years, 6 months ago (2017-06-01 14:01:50 UTC) #48
jgruber
Addressed comments & removed Smi::ToInt from this CL to reduce noise. https://codereview.chromium.org/2882973002/diff/200001/src/compiler.cc File src/compiler.cc (right): ...
3 years, 6 months ago (2017-06-02 06:39:27 UTC) #51
marja
parsing & ast still lgtm https://codereview.chromium.org/2882973002/diff/240001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2882973002/diff/240001/src/interpreter/bytecode-generator.cc#newcode822 src/interpreter/bytecode-generator.cc:822: Since you're touching this, ...
3 years, 6 months ago (2017-06-02 07:01:23 UTC) #54
jgruber
https://codereview.chromium.org/2882973002/diff/240001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2882973002/diff/240001/src/interpreter/bytecode-generator.cc#newcode822 src/interpreter/bytecode-generator.cc:822: On 2017/06/02 07:01:23, marja wrote: > Since you're touching ...
3 years, 6 months ago (2017-06-02 07:18:32 UTC) #57
rmcilroy
A couple more comments, but LGTM once they are addressed, thanks. https://codereview.chromium.org/2882973002/diff/200001/src/interpreter/bytecodes.h File src/interpreter/bytecodes.h (right): ...
3 years, 6 months ago (2017-06-02 09:36:00 UTC) #62
jgruber
https://codereview.chromium.org/2882973002/diff/280001/src/compiler/bytecode-graph-builder.cc File src/compiler/bytecode-graph-builder.cc (right): https://codereview.chromium.org/2882973002/diff/280001/src/compiler/bytecode-graph-builder.cc#newcode2237 src/compiler/bytecode-graph-builder.cc:2237: environment()->RecordAfterState(node, Environment::kAttachFrameState); On 2017/06/02 09:35:59, rmcilroy wrote: > I ...
3 years, 6 months ago (2017-06-02 11:38:49 UTC) #67
rmcilroy
https://codereview.chromium.org/2882973002/diff/280001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2882973002/diff/280001/src/interpreter/bytecode-generator.cc#newcode1233 src/interpreter/bytecode-generator.cc:1233: int else_slot = AllocateBlockCoverageSlot(stmt->else_range()); On 2017/06/02 11:38:49, jgruber wrote: ...
3 years, 6 months ago (2017-06-02 12:52:50 UTC) #70
jgruber
https://codereview.chromium.org/2882973002/diff/280001/src/interpreter/bytecode-generator.cc File src/interpreter/bytecode-generator.cc (right): https://codereview.chromium.org/2882973002/diff/280001/src/interpreter/bytecode-generator.cc#newcode1233 src/interpreter/bytecode-generator.cc:1233: int else_slot = AllocateBlockCoverageSlot(stmt->else_range()); On 2017/06/02 12:52:49, rmcilroy wrote: ...
3 years, 6 months ago (2017-06-02 13:01:54 UTC) #71
rmcilroy
LGTM
3 years, 6 months ago (2017-06-02 14:27:54 UTC) #72
Michael Starzinger
LGTM if comments are addressed. https://codereview.chromium.org/2882973002/diff/300001/src/debug/debug-interface.h File src/debug/debug-interface.h (right): https://codereview.chromium.org/2882973002/diff/300001/src/debug/debug-interface.h#newcode251 src/debug/debug-interface.h:251: // lower granularity. See ...
3 years, 6 months ago (2017-06-06 11:49:33 UTC) #73
rmcilroy
https://codereview.chromium.org/2882973002/diff/300001/test/unittests/interpreter/bytecode-array-builder-unittest.cc File test/unittests/interpreter/bytecode-array-builder-unittest.cc (right): https://codereview.chromium.org/2882973002/diff/300001/test/unittests/interpreter/bytecode-array-builder-unittest.cc#newcode377 test/unittests/interpreter/bytecode-array-builder-unittest.cc:377: FLAG_block_coverage = true; // Satisfy DCHECKs. On 2017/06/06 11:49:32, ...
3 years, 6 months ago (2017-06-06 13:02:32 UTC) #74
jgruber
https://codereview.chromium.org/2882973002/diff/300001/src/debug/debug-interface.h File src/debug/debug-interface.h (right): https://codereview.chromium.org/2882973002/diff/300001/src/debug/debug-interface.h#newcode251 src/debug/debug-interface.h:251: // lower granularity. See go/v8-designdoc-block-code-coverage. On 2017/06/06 11:49:32, Michael ...
3 years, 6 months ago (2017-06-06 14:52:46 UTC) #75
jgruber
https://codereview.chromium.org/2882973002/diff/300001/test/mjsunit/code-coverage-block.js File test/mjsunit/code-coverage-block.js (right): https://codereview.chromium.org/2882973002/diff/300001/test/mjsunit/code-coverage-block.js#newcode5 test/mjsunit/code-coverage-block.js:5: // Flags: --allow-natives-syntax --no-always-opt --block-coverage On 2017/06/06 14:52:46, jgruber ...
3 years, 6 months ago (2017-06-06 15:06:33 UTC) #78
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2882973002/320001
3 years, 6 months ago (2017-06-06 15:08:12 UTC) #82
commit-bot: I haz the power
3 years, 6 months ago (2017-06-06 15:45:07 UTC) #85
Message was sent while issue was closed.
Committed patchset #17 (id:320001) as
https://chromium.googlesource.com/v8/v8/+/b42415402f0d251ab879bb168b386bcd71f...

Powered by Google App Engine
This is Rietveld 408576698